本文整理汇总了C++中cegui::XMLAttributes类的典型用法代码示例。如果您正苦于以下问题:C++ XMLAttributes类的具体用法?C++ XMLAttributes怎么用?C++ XMLAttributes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XMLAttributes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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" ) );
}
}
示例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 )) );
}
示例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);
}
}
}
示例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 );
}
}
示例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" ) );
}
}
示例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" );
}
示例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 ) );
}
示例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() ) );
}
示例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);
}
示例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" ) );
}
}
示例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() ) );
}
}
示例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;
}
}
示例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() ) );
}
示例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 ) );
}
示例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 ) );
}