本文整理汇总了C++中cegui::XMLAttributes类的典型用法代码示例。如果您正苦于以下问题:C++ XMLAttributes类的具体用法?C++ XMLAttributes怎么用?C++ XMLAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XMLAttributes类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: elementStart
void cLayer :: elementStart( const CEGUI::String &element, const CEGUI::XMLAttributes &attributes )
{
if( element == "property" || element == "Property" )
{
m_xml_attributes.add( attributes.getValueAsString( "name" ), attributes.getValueAsString( "value" ) );
}
}
开发者ID:120pulsations,项目名称:SMC,代码行数:7,代码来源:world_layer.cpp
示例2:
void cMushroom :: Create_From_Stream( CEGUI::XMLAttributes &attributes )
{
// position
Set_Pos( static_cast<float>(attributes.getValueAsInteger( "posx" )), static_cast<float>(attributes.getValueAsInteger( "posy" )) );
// type
Set_Type( static_cast<SpriteType>(attributes.getValueAsInteger( "mushroom_type", TYPE_MUSHROOM_DEFAULT )) );
}
开发者ID:as02700,项目名称:Eta-Chronicles,代码行数:7,代码来源:powerup.cpp
示例3: Handle_Game_Events
void Handle_Game_Events(void)
{
// if game action is set
while (Game_Action != GA_NONE) {
// get current data
const GameMode current_game_mode = Game_Mode;
const GameModeType current_game_mode_type = Game_Mode_Type;
const GameAction current_game_action = Game_Action;
const CEGUI::XMLAttributes current_game_action_data_start = Game_Action_Data_Start;
const CEGUI::XMLAttributes current_game_action_data_middle = Game_Action_Data_Middle;
const CEGUI::XMLAttributes current_game_action_data_end = Game_Action_Data_End;
void* current_game_action_ptr = Game_Action_ptr;
// clear
Game_Action = GA_NONE;
Game_Action_Data_Start = CEGUI::XMLAttributes();
Game_Action_Data_Middle = CEGUI::XMLAttributes();
Game_Action_Data_End = CEGUI::XMLAttributes();
Game_Action_ptr = NULL;
// handle player downgrade
if (current_game_action == GA_DOWNGRADE_PLAYER) {
Handle_Generic_Game_Events(current_game_action_data_start);
pLevel_Player->DownGrade_Player(false, current_game_action_data_middle.getValueAsBool("downgrade_force"), current_game_action_data_middle.getValueAsBool("downgrade_ignore_invincible"));
Handle_Generic_Game_Events(current_game_action_data_middle);
Handle_Generic_Game_Events(current_game_action_data_end);
}
// activate level exit
else if (current_game_action == GA_ACTIVATE_LEVEL_EXIT) {
Handle_Generic_Game_Events(current_game_action_data_start);
cLevel_Exit* level_exit = static_cast<cLevel_Exit*>(current_game_action_ptr);
level_exit->Activate();
Handle_Generic_Game_Events(current_game_action_data_middle);
Handle_Generic_Game_Events(current_game_action_data_end);
}
// full events
else {
GameMode new_mode = MODE_NOTHING;
if (current_game_action == GA_ENTER_LEVEL) {
new_mode = MODE_LEVEL;
}
else if (current_game_action == GA_ENTER_WORLD) {
new_mode = MODE_OVERWORLD;
}
else if (current_game_action == GA_ENTER_MENU) {
new_mode = MODE_MENU;
}
else if (current_game_action == GA_ENTER_LEVEL_SETTINGS) {
new_mode = MODE_LEVEL_SETTINGS;
}
Handle_Generic_Game_Events(current_game_action_data_start);
Leave_Game_Mode(new_mode);
Handle_Generic_Game_Events(current_game_action_data_middle);
Enter_Game_Mode(new_mode);
Handle_Generic_Game_Events(current_game_action_data_end);
}
}
}
开发者ID:Clever-Boy,项目名称:TSC,代码行数:59,代码来源:game_core.cpp
示例4: Relocate_Image
void Relocate_Image( CEGUI::XMLAttributes &xml_attributes, const std::string &filename_old, const std::string &filename_new, const CEGUI::String &attribute_name /* = "image" */ )
{
if( xml_attributes.getValueAsString( attribute_name ).compare( filename_old ) == 0 || xml_attributes.getValueAsString( attribute_name ).compare( DATA_DIR "/" GAME_PIXMAPS_DIR "/" + filename_old ) == 0 )
{
xml_attributes.remove( attribute_name );
xml_attributes.add( attribute_name, filename_new );
}
}
开发者ID:sKabYY,项目名称:SMC,代码行数:8,代码来源:game_core.cpp
示例5: elementStart
// XML element start
void cOverworld_Manager :: elementStart( const CEGUI::String &element, const CEGUI::XMLAttributes &attributes )
{
// Property of an Element
if( element == "Property" )
{
m_xml_attributes.add( attributes.getValueAsString( "Name" ), attributes.getValueAsString( "Value" ) );
}
}
开发者ID:sKabYY,项目名称:SMC,代码行数:9,代码来源:world_manager.cpp
示例6:
void cLayer_Line_Point_Start :: Load_From_XML( CEGUI::XMLAttributes &attributes )
{
// Start
Set_Pos( static_cast<float>(attributes.getValueAsInteger( "X1" )) - 2, static_cast<float>(attributes.getValueAsInteger( "Y1" )) - 2, 1 );
// End
m_linked_point->Set_Pos( static_cast<float>(attributes.getValueAsInteger( "X2" )) - 2, static_cast<float>(attributes.getValueAsInteger( "Y2" )) - 2, 1 );
// origin
m_origin = attributes.getValueAsInteger( "origin" );
}
开发者ID:120pulsations,项目名称:SMC,代码行数:9,代码来源:world_layer.cpp
示例7:
void cRokko :: Create_From_Stream( CEGUI::XMLAttributes &attributes )
{
// position
Set_Pos( static_cast<float>(attributes.getValueAsInteger( "posx" )), static_cast<float>(attributes.getValueAsInteger( "posy" )), 1 );
// direction
Set_Direction( Get_Direction_Id( attributes.getValueAsString( "direction", Get_Direction_Name( m_start_direction ) ).c_str() ) );
// speed
Set_Speed( attributes.getValueAsFloat( "speed", m_speed ) );
}
开发者ID:as02700,项目名称:Eta-Chronicles,代码行数:9,代码来源:rokko.cpp
示例8:
void cSpikeball :: Create_From_Stream( CEGUI::XMLAttributes &attributes )
{
// position
Set_Pos( static_cast<float>(attributes.getValueAsInteger( "posx" )), static_cast<float>(attributes.getValueAsInteger( "posy" )), 1 );
// color
Set_Color( static_cast<DefaultColor>(Get_Color_Id( attributes.getValueAsString( "color", Get_Color_Name( m_color_type ) ).c_str() )) );
// direction
Set_Direction( Get_Direction_Id( attributes.getValueAsString( "direction", Get_Direction_Name( m_start_direction ) ).c_str() ) );
}
开发者ID:sKabYY,项目名称:SMC,代码行数:9,代码来源:spikeball.cpp
示例9: startElement
void ExpatParser::startElement(void* data, const char* element, const char** attr)
{
CEGUI::XMLHandler* handler = static_cast<XMLHandler*>(data);
CEGUI::XMLAttributes attrs;
for(size_t i = 0 ; attr[i] ; i += 2)
attrs.add((CEGUI::utf8*)attr[i], (CEGUI::utf8*)attr[i+1]);
handler->elementStart((CEGUI::utf8*)element, attrs);
}
开发者ID:brock7,项目名称:TianLong,代码行数:10,代码来源:CEGUIExpatParser.cpp
示例10: if
void cOverworld_description :: elementStart( const CEGUI::String &element, const CEGUI::XMLAttributes &attributes )
{
if( element == "property" )
{
m_xml_attributes.add( attributes.getValueAsString( "name" ), attributes.getValueAsString( "value" ) );
}
else if( element == "Property" )
{
m_xml_attributes.add( attributes.getValueAsString( "Name" ), attributes.getValueAsString( "Value" ) );
}
}
开发者ID:120pulsations,项目名称:SMC,代码行数:11,代码来源:overworld.cpp
示例11:
void cBonusBox :: Create_From_Stream( CEGUI::XMLAttributes &attributes )
{
cBaseBox::Create_From_Stream( attributes );
// item
Set_Bonus_Type( static_cast<SpriteType>(attributes.getValueAsInteger( "item" )) );
// force best possible item
Set_Force_Best_Item( attributes.getValueAsBool( "force_best_item" ) );
// gold color
if( box_type == TYPE_GOLDPIECE )
{
Set_Goldcolor( Get_Color_Id( attributes.getValueAsString( "gold_color", Get_Color_Name( m_gold_color ) ).c_str() ) );
}
}
开发者ID:sKabYY,项目名称:SMC,代码行数:14,代码来源:bonusbox.cpp
示例12:
void cOverworld_Manager :: handle_world( const CEGUI::XMLAttributes &attributes )
{
std::string ow_name = attributes.getValueAsString( "Name" ).c_str();
std::string ow_comment = attributes.getValueAsString( "Comment" ).c_str();
// if available
cOverworld *overworld = Get_from_Name( ow_name );
// set comment
if( overworld )
{
overworld->m_description->m_comment = ow_comment;
}
}
开发者ID:sKabYY,项目名称:SMC,代码行数:14,代码来源:world_manager.cpp
示例13:
void cText_Box :: Create_From_Stream( CEGUI::XMLAttributes &attributes )
{
cBaseBox::Create_From_Stream( attributes );
// text
Set_Text( xml_string_to_string( attributes.getValueAsString( "text" ).c_str() ) );
}
开发者ID:as02700,项目名称:Eta-Chronicles,代码行数:7,代码来源:text_box.cpp
示例14:
void cStaticEnemy :: Create_From_Stream( CEGUI::XMLAttributes &attributes )
{
// position
Set_Pos( static_cast<float>(attributes.getValueAsInteger( "posx" )), static_cast<float>(attributes.getValueAsInteger( "posy" )), 1 );
// rotation speed
Set_Rotation_Speed( static_cast<float>( attributes.getValueAsFloat( "rotation_speed", -7.5f ) ) );
// image
Set_Static_Image( attributes.getValueAsString( "image", "enemy/static/saw/default.png" ).c_str() );
// path
Set_Path_Identifier( attributes.getValueAsString( "path", "" ).c_str() );
// movement speed
Set_Speed( static_cast<float>( attributes.getValueAsFloat( "speed", m_speed ) ) );
// fire resistant
m_fire_resistant = attributes.getValueAsBool( "fire_resistant", m_fire_resistant );
// ice resistance
m_ice_resistance = static_cast<float>( attributes.getValueAsFloat( "ice_resistance", m_ice_resistance ) );
}
开发者ID:as02700,项目名称:Eta-Chronicles,代码行数:17,代码来源:static.cpp
示例15:
void cRandom_Sound :: Create_From_Stream( CEGUI::XMLAttributes &attributes )
{
// filename
Set_Filename( attributes.getValueAsString( "file" ).c_str() );
// position
Set_Pos( static_cast<float>(attributes.getValueAsInteger( "pos_x" )), static_cast<float>(attributes.getValueAsInteger( "pos_y" )), 1 );
//
Set_Continuous( attributes.getValueAsBool( "continuous", m_continuous ) );
// delay
Set_Delay_Min( attributes.getValueAsInteger( "delay_min", m_delay_min ) );
Set_Delay_Max( attributes.getValueAsInteger( "delay_max", m_delay_max ) );
// volume
Set_Volume_Min( attributes.getValueAsFloat( "volume_min", m_volume_min ) );
Set_Volume_Max( attributes.getValueAsFloat( "volume_max", m_volume_max ) );
// volume reduction
Set_Volume_Reduction_Begin( attributes.getValueAsFloat( "volume_reduction_begin", m_volume_reduction_begin ) );
Set_Volume_Reduction_End( attributes.getValueAsFloat( "volume_reduction_end", m_volume_reduction_end ) );
}
开发者ID:as02700,项目名称:Eta-Chronicles,代码行数:18,代码来源:random_sound.cpp
示例16:
void cEnemyStopper :: Create_From_Stream( CEGUI::XMLAttributes &attributes )
{
Set_Pos( static_cast<float>(attributes.getValueAsInteger( "posx" )), static_cast<float>(attributes.getValueAsInteger( "posy" )), 1 );
}
开发者ID:sKabYY,项目名称:SMC,代码行数:4,代码来源:enemystopper.cpp
示例17:
void cOverworld_description :: handle_world( const CEGUI::XMLAttributes &attributes )
{
m_name = xml_string_to_string( attributes.getValueAsString( "name", m_name.c_str() ).c_str() );
m_visible = attributes.getValueAsBool( "visible", 1 );
}
开发者ID:120pulsations,项目名称:SMC,代码行数:5,代码来源:overworld.cpp
示例18: if
void cPreferences :: handle_item( const CEGUI::XMLAttributes& attributes )
{
std::string name = attributes.getValueAsString( "Name" ).c_str();
// Game
if( name.compare( "game_version" ) == 0 )
{
m_game_version = attributes.getValueAsFloat( "Value" );
}
else if( name.compare( "game_language" ) == 0 )
{
m_language = attributes.getValueAsString( "Value" ).c_str();
}
else if( name.compare( "game_always_run" ) == 0 || name.compare( "always_run" ) == 0 )
{
m_always_run = attributes.getValueAsBool( "Value" );
}
else if( name.compare( "game_menu_level" ) == 0 )
{
m_menu_level = attributes.getValueAsString( "Value" ).c_str();
}
else if( name.compare( "game_user_data_dir" ) == 0 || name.compare( "user_data_dir" ) == 0 )
{
m_force_user_data_dir = attributes.getValueAsString( "Value" ).c_str();
// if user data dir is set
if( !m_force_user_data_dir.empty() )
{
Convert_Path_Separators( m_force_user_data_dir );
// add trailing slash if missing
if( *(m_force_user_data_dir.end() - 1) != '/' )
{
m_force_user_data_dir.insert( m_force_user_data_dir.length(), "/" );
}
}
}
else if( name.compare( "game_camera_hor_speed" ) == 0 || name.compare( "camera_hor_speed" ) == 0 )
{
m_camera_hor_speed = attributes.getValueAsFloat( "Value" );
}
else if( name.compare( "game_camera_ver_speed" ) == 0 || name.compare( "camera_ver_speed" ) == 0 )
{
m_camera_ver_speed = attributes.getValueAsFloat( "Value" );
}
// Video
else if( name.compare( "video_screen_h" ) == 0 )
{
int val = attributes.getValueAsInteger( "Value" );
if( val < 200 )
{
val = 200;
}
else if( val > 2560 )
{
val = 2560;
}
m_video_screen_h = val;
}
else if( name.compare( "video_screen_w" ) == 0 )
{
int val = attributes.getValueAsInteger( "Value" );
if( val < 200 )
{
val = 200;
}
else if( val > 2560 )
{
val = 2560;
}
m_video_screen_w = val;
}
else if( name.compare( "video_screen_bpp" ) == 0 )
{
int val = attributes.getValueAsInteger( "Value" );
if( val < 8 )
{
val = 8;
}
else if( val > 32 )
{
val = 32;
}
m_video_screen_bpp = val;
}
else if( name.compare( "video_vsync" ) == 0 )
{
m_video_vsync = attributes.getValueAsBool( "Value" );
}
else if( name.compare( "video_fullscreen" ) == 0 )
{
m_video_fullscreen = attributes.getValueAsBool( "Value" );
}
else if( name.compare( "video_geometry_detail" ) == 0 || name.compare( "video_geometry_quality" ) == 0 )
//.........这里部分代码省略.........
开发者ID:as02700,项目名称:Eta-Chronicles,代码行数:101,代码来源:preferences.cpp
示例19: Handle_Generic_Game_Events
void Handle_Generic_Game_Events(const CEGUI::XMLAttributes& action_data)
{
if (action_data.exists("music_fadeout")) {
pAudio->Fadeout_Music(action_data.getValueAsInteger("music_fadeout"));
}
if (action_data.getValueAsBool("reset_save")) {
pLevel_Player->Reset_Save();
}
if (action_data.getValueAsBool("unload_levels")) {
pLevel_Manager->Unload();
}
if (action_data.getValueAsBool("unload_menu")) {
pMenuCore->Unload();
}
if (action_data.exists("load_menu")) {
MenuID menu = static_cast<MenuID>(action_data.getValueAsInteger("load_menu"));
pMenuCore->Load(menu, static_cast<GameMode>(action_data.getValueAsInteger("menu_exit_back_to")));
if (menu == MENU_START && action_data.exists("menu_start_current_level")) {
cMenu_Start* menu_start = static_cast<cMenu_Start*>(pMenuCore->m_menu_data);
menu_start->Highlight_Level(action_data.getValueAsString("menu_start_current_level").c_str());
}
}
// set active world
if (action_data.exists("enter_world")) {
pOverworld_Manager->Set_Active(action_data.getValueAsString("enter_world").c_str());
}
// set player waypoint
if (action_data.exists("world_player_waypoint")) {
// get world waypoint
int waypoint_num = pActive_Overworld->Get_Waypoint_Num(action_data.getValueAsString("world_player_waypoint").c_str());
// waypoint available
if (waypoint_num >= 0) {
// set the previous waypoints accessible
pActive_Overworld->Set_Progress(waypoint_num, 0);
pOverworld_Player->Set_Waypoint(waypoint_num);
}
}
if (action_data.exists("new_level")) {
std::string str_level = action_data.getValueAsString("new_level").c_str();
// new level
cLevel* level = pLevel_Manager->New(str_level);
if (level) {
pLevel_Manager->Set_Active(level);
level->Init();
}
}
if (action_data.exists("load_level")) {
bool loading_sublevel = action_data.exists("load_level_sublevel");
std::string str_level = action_data.getValueAsString("load_level").c_str();
// load the level
cLevel* level = pLevel_Manager->Load(str_level, loading_sublevel);
if (level) {
pLevel_Manager->Set_Active(level);
level->Init();
if (action_data.exists("load_level_entry")) {
std::string str_entry = action_data.getValueAsString("load_level_entry").c_str();
cLevel_Entry* entry = level->Get_Entry(str_entry);
// set camera position to show the entry
if (entry) {
// set position
pLevel_Player->Set_Pos(entry->Get_Player_Pos_X(), entry->Get_Player_Pos_Y());
// center camera position
pActive_Camera->Center();
// set invisible for warp animation
pLevel_Player->Set_Active(0);
}
else if (!str_entry.empty()) {
printf("Warning : Level entry %s not found\n", str_entry.c_str());
}
}
}
// loading failed
else {
printf("Error : Level not found %s\n", str_level.c_str());
pHud_Debug->Set_Text(_("Loading Level failed : ") + str_level);
pLevel_Manager->Finish_Level();
}
}
if (action_data.exists("load_savegame")) {
pSavegame->Load_Game(action_data.getValueAsInteger("load_savegame"));
}
if (action_data.exists("play_music")) {
pAudio->Play_Music(action_data.getValueAsString("play_music").c_str(), action_data.getValueAsInteger("music_loops"), action_data.getValueAsBool("music_force", 1), action_data.getValueAsInteger("music_fadein"));
}
if (action_data.exists("screen_fadeout")) {
Draw_Effect_Out(static_cast<Effect_Fadeout>(action_data.getValueAsInteger("screen_fadeout")), action_data.getValueAsFloat("screen_fadeout_speed", 1));
}
if (action_data.exists("screen_fadein")) {
Draw_Effect_In(static_cast<Effect_Fadein>(action_data.getValueAsInteger("screen_fadein")), action_data.getValueAsFloat("screen_fadein_speed", 1));
}
if (action_data.exists("activate_level_entry")) {
std::string str_entry = action_data.getValueAsString("activate_level_entry").c_str();
cLevel_Entry* entry = pActive_Level->Get_Entry(str_entry);
//.........这里部分代码省略.........
开发者ID:Clever-Boy,项目名称:TSC,代码行数:101,代码来源:game_core.cpp
注:本文中的cegui::XMLAttributes类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论