Beispiel #1
0
void  LOOL_OLED::LCD_Num(uint8_t ch,uint8_t  x,uint8_t y)
{
     y=y%4;
	 Set_Pos(x,y*2);
     LCD_shuzi_1(ch);
     Set_Pos(x,y*2+1);
     LCD_shuzi_2(ch);

}
void OLED80XX_Class::BigChar(unsigned char x, unsigned char y, unsigned char chr, char mode)
{
	unsigned char c = 0, i = 0, num = 8;
	c = chr - ' ';
	num = (x <= 120) ? 8 : (128 - x);
	Set_Pos(x, y);
	// WR_8_Byte(&(F8X16[c*16]), mode);
	WR_Bytes(&(F8X16[c * 16]), mode, num);
	Set_Pos(x, y + 1);
	WR_Bytes(&(F8X16[c * 16 + 8]), mode, num);
	// WR_8_Byte(&(F8X16[c*16+8]), mode);
}
Beispiel #3
0
void LOOL_OLED::LCD_Str(uint8_t ch[],uint8_t length,uint8_t y)
{
	uint8_t x=0;
    for(uint8_t j=0;j<length;j++)
        {
		if(x>126){x=0;y++;}
		Set_Pos(x,y);
		LCD_shuzi_1(ch[j]);
        Set_Pos(x,y+1);
        LCD_shuzi_2(ch[j]);
		x+=10;
  }
}
Beispiel #4
0
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 )) );
}
Beispiel #5
0
void cEato::Create_From_Stream(XMLElement* attributes)
{
    int posx = 0, posy = 0;
    std::string image_dir = m_img_dir;
    std::string direction = Get_Direction_Name(m_start_direction);

    for (XMLElement* node = attributes->FirstChildElement(); node; node = node->NextSiblingElement())
    {
        const char* name = node->Attribute("name");
        const char* value = node->Attribute("value");

        if (!strcmp(name, "posx"))
        {
            posx = atoi(value);
        }
        else if (!strcmp(name, "posy"))
        {
            posy = atoi(value);
        }
        else if (!strcmp(name, "image_dir"))
        {
            image_dir = value;
        }
        else if (!strcmp(name, "direction"))
        {
            direction = value;
        }
    }

    Set_Pos(static_cast<float>(posx), static_cast<float>(posy), 1);
    Set_Image_Dir(image_dir.c_str());
    Set_Direction(Get_Direction_Id(direction.c_str()));
}
Beispiel #6
0
cRandom_Sound::cRandom_Sound(XmlAttributes& attributes, cSprite_Manager* sprite_manager)
    : cSprite(sprite_manager, "sound")
{
    cRandom_Sound::Init();

    // filename
    Set_Filename(attributes["file"]);

    // position
    Set_Pos(string_to_float(attributes["posx"]), string_to_float(attributes["posy"]), true);

    //
    Set_Continuous(attributes.fetch<bool>("continuous", m_continuous));

    // delay
    Set_Delay_Min(attributes.fetch<int>("delay_min", m_delay_min));
    Set_Delay_Min(attributes.fetch<int>("delay_max", m_delay_max));

    // volume
    Set_Volume_Min(attributes.fetch<float>("volume_min", m_volume_min));
    Set_Volume_Max(attributes.fetch<float>("volume_min", m_volume_max));

    // volume reduction
    Set_Volume_Reduction_Begin(attributes.fetch<float>("volume_reduction_begin", m_volume_reduction_begin));
    Set_Volume_Reduction_End(attributes.fetch<float>("volume_reduction_end", m_volume_reduction_end));
}
Beispiel #7
0
 void cMushroom::Create_From_Stream(XMLElement* attributes)
 {
     int posx = 0, posy = 0;
     
     int mushroom_type = TYPE_MUSHROOM_DEFAULT;
     
     for (XMLElement* node = attributes->FirstChildElement(); node; node = node->NextSiblingElement())
     {
         const char* name = node->Attribute("name");
         const char* value = node->Attribute("value");
     
         if (!strcmp(name, "posx"))
         {
             posx = atoi(value);
         }
         else if (!strcmp(name, "posy"))
         {
             posy = atoi(value);
         }
         else if (!strcmp(name, "mushroom_type"))
         {
             mushroom_type = atoi(value);
         }
     }
     
     Set_Pos(static_cast<float>(posx), static_cast<float>(posy));
     
     Set_Type(static_cast<SpriteType>(mushroom_type));
 }
Beispiel #8
0
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() ) );
}
Beispiel #9
0
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 ) );
}
Beispiel #10
0
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" );
}
void OLED80XX_Class::SmallChar(unsigned char x, unsigned char y, unsigned char chr, char mode)
{
	unsigned char c = 0, i = 0, num = 6;
	c = chr - ' ';
	num = (x <= 122) ? 6 : (128 - x);
	Set_Pos(x, y);
	// WR_6_Byte(&(F6x8[c][0]), mode);
	WR_Bytes(&(F6x8[c][0]), mode, num);
}
Beispiel #12
0
 void cBaseBox::Update_Collision(void)
 {
     if (move_col_dir == DIR_UNDEFINED)
     {
         return;
     }
     
     if (move_col_dir != DIR_UP && move_col_dir != DIR_DOWN && move_col_dir != DIR_RIGHT && move_col_dir != DIR_LEFT)
     {
         printf("Warning : wrong box collision direction %d\n", move_col_dir);
         move_col_dir = DIR_UNDEFINED;
         Update_Valid_Update();
         return;
     }
     
     float mod = pFramerate->m_speed_factor * 0.05f;
     
     move_counter += pFramerate->m_speed_factor * 0.2f;
     
     if (!move_back)
     {
         Add_Scale(mod);
         
         Generate_Activation_Particles();
         
         if (move_counter > 1.0f)
         {
             move_back = 1;
             move_counter = 0.0f;
         }
     }
     else
     {
         Add_Scale(-mod);
         
         if (move_counter > 1.0f)
         {
             move_col_dir = DIR_UNDEFINED;
             Update_Valid_Update();
             move_back = 0;
             move_counter = 0.0f;
             
             m_col_pos = m_image->m_col_pos;
             
             Set_Scale(1);
             Set_Scale_Directions(1, 1, 1, 1);
             
             Set_Pos(m_start_pos_x, m_start_pos_y);
         }
     }
 }
Beispiel #13
0
cRokko::cRokko(XmlAttributes& attributes, cSprite_Manager* sprite_manager)
    : cEnemy(sprite_manager)
{
    cRokko::Init();

    // position
    Set_Pos(string_to_float(attributes["posx"]), string_to_float(attributes["posy"]), true);

    // direction
    Set_Direction(Get_Direction_Id(attributes.fetch("direction", Get_Direction_Name(m_start_direction))));

    // speed
    Set_Speed(string_to_float(attributes.fetch("speed", float_to_string(m_speed))));
}
void OLED80XX_Class::Init(byte _CS, byte _RES, byte _RW, byte _DC, byte _RD, byte *data, byte reverse)
{
	// DDRA = 0xFF;
	// DDRL = CMD_MASK;	byte cs;
	cs = _CS;
	res = _RES;
	rw = _RW;
	dc = _DC;
	rd = _RD;
	for (byte i = 0; i < 8; i++)
		dataPort[i] = data[i];

	pinMode(cs, OUTPUT);
	pinMode(res, OUTPUT);
	pinMode(rw, OUTPUT);
	pinMode(dc, OUTPUT);
	pinMode(rd, OUTPUT);
	for (byte i = 0; i < 8; i++)
		pinMode(dataPort[i], OUTPUT);
	RESET;

	wr_byte_cmd(0xFD);		  //Command Lock
	wr_byte_cmd(0x12);		  //unlock oled
	wr_byte_cmd(0xAE);		  //Set Display Off
	wr_byte_cmd2(0xD5, 0xA0); //Set Display Clock Divide Ratio/Oscillator Frequency
	wr_byte_cmd2(0xA8, 0x3F); //Set Multiplex Ratio
	wr_byte_cmd2(0xD3, 0X00); //Set Display Offset
	wr_byte_cmd(0x40);		  //Set Display Start Line
	if (0 == reverse)
	{
		wr_byte_cmd(0XA1); //Set Segment Re-Map. Normal horizantal.
		wr_byte_cmd(0xC8); //Set COM Output Scan Direction. Normal vertical.
	}
	else
	{
		wr_byte_cmd(0XA0); //Set Segment Re-Map.Inverse horizantal.
		wr_byte_cmd(0xC0); //Set COM Output Scan Direction. Inverse vertical.
	}
	wr_byte_cmd2(0xDA, 0x12); //Set COM Pins Hardware Configuration
	wr_byte_cmd2(0x81, 0xFF); //Set Current Control
	wr_byte_cmd2(0xD9, 0x82); //Set Pre-Charge Period
	wr_byte_cmd2(0xDB, 0x34); //Set VCOMH Deselect Level
	wr_byte_cmd(0xA4);		  //Set Entire Display On/Off
	wr_byte_cmd(0xA6);		  //Set Normal/Inverse Display
	wr_byte_cmd(0xAF);		  //Set Display On
	ClearScreen();
	Set_Pos(0, 0);
}
Beispiel #15
0
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 ) );
}
Beispiel #16
0
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 ) );
}
Beispiel #17
0
 void cBaseBox::Create_From_Stream(XMLElement* attributes)
 {
     int _posx, _posy;
     std::string _animation = anim_type;
     int _invisible;
     int _useable_count = start_useable_count;
     
     for (XMLElement* node = attributes->FirstChildElement(); node; node = node->NextSiblingElement())
     {
         const char* name = node->Attribute("name");
         const char* value = node->Attribute("value");
     
         if (!strcmp(name, "posx"))
         {
             _posx = atoi(value);
         }
         else if (!strcmp(name, "posy"))
         {
             _posy = atoi(value);
         }
         else if (!strcmp(name, "animation"))
         {
             _animation = value;
         }
         else if (!strcmp(name, "invisible"))
         {
             _invisible = atoi(value);
         }
         else if (!strcmp(name, "useable_count"))
         {
             _useable_count = atoi(value);
         }
     }
     
     Set_Pos(static_cast<float>(_posx), static_cast<float>(_posy), 1);
     if (box_type != TYPE_SPINBOX && box_type != TYPE_TEXT_BOX)
     {
         Set_Animation_Type(_animation.c_str());
     }
     Set_Invisible(static_cast<Box_Invisible_Type>(_invisible));
     Set_Useable_Count(_useable_count, 1);
 }
Beispiel #18
0
cFlyon::cFlyon(XmlAttributes& attributes, cSprite_Manager* sprite_manager)
    : cEnemy(sprite_manager)
{
    cFlyon::Init();

    // position
    Set_Pos(string_to_float(attributes["posx"]), string_to_float(attributes["posy"]), true);

    // image directory
    Set_Image_Dir(utf8_to_path(attributes.fetch("image_dir", path_to_utf8(m_img_dir))));

    // direction
    Set_Direction(Get_Direction_Id(attributes.fetch("direction", Get_Direction_Name(m_start_direction))));

    // max distance
    Set_Max_Distance(string_to_int(attributes.fetch("max_distance", int_to_string(m_max_distance))));

    // speed
    Set_Speed(string_to_float(attributes.fetch("speed", float_to_string(m_speed))));
}
Beispiel #19
0
 void cMoon::Create_From_Stream(XMLElement* attributes)
 {
     int posx = 0, posy = 0;
     
     for (XMLElement* node = attributes->FirstChildElement(); node; node = node->NextSiblingElement())
     {
         const char* name = node->Attribute("name");
         const char* value = node->Attribute("value");
         
         if (!strcmp(name, "posx"))
         {
             posx = atoi(value);
         }
         else if (!strcmp(name, "posy"))
         {
             posy = atoi(value);
         }
         
         Set_Pos(static_cast<float>(posx), static_cast<float>(posy));
     }
 }
Beispiel #20
0
void LOOL_OLED::LCD_Str(char ch[],uint8_t x,uint8_t y)
{
	uint8_t c=0,i=0,j=0;
	while (ch[j]!='\0')
	{
		if(ch[j]>=65 && ch[j]<=122)
		{
		if(ch[j]>=97)
		  ch[j]=ch[j]-32;
		c =ch[j]-55;
		if(x>126){x=0;y++;}
		Set_Pos(x,y*2);
		LCD_shuzi_1(c);
        Set_Pos(x,y*2+1);
        LCD_shuzi_2(c);
		x+=8;
		}
		else if(ch[j]>=48 && ch[j]<=58)
		{
		c =ch[j]-48;
		if(x>126){x=0;y++;}
		Set_Pos(x,y*2);
		LCD_shuzi_1(c);
        Set_Pos(x,y*2+1);
        LCD_shuzi_2(c);
		x+=8;
		}
	    else
		{
		if(x>126){x=0;y++;}
		Set_Pos(x,y*2);
		LCD_shuzi_1(38);
        Set_Pos(x,y*2+1);
        LCD_shuzi_2(38);
		x+=8;	
		}
		j++;
	}
}
Beispiel #21
0
 void cStaticEnemy::Create_From_Stream(XMLElement* attributes)
 {
     int _posx, _posy;
     float _rotation_speed = -7.5f;
     std::string _image = "enemy/static/saw/default.png";
     std::string _path = "";
     float _speed = m_speed;
     bool _fire_resistant = m_fire_resistant;
     float _ice_resistance = m_ice_resistance;
     
     for (XMLElement* node = attributes->FirstChildElement(); node; node = node->NextSiblingElement())
     {
         const char* name = node->Attribute("name");
         const char* value = node->Attribute("value");
         
         if (!strcmp(name, "posx"))
         {
             _posx = atoi(value);
         }
         else if (!strcmp(name, "posy"))
         {
             _posy = atoi(value);
         }
         else if (!strcmp(name, "rotation_speed"))
         {
             _rotation_speed = atof(value);
         }
         else if (!strcmp(name, "image"))
         {
             _image = value;
         }
         else if (!strcmp(name, "path"))
         {
             _path = value;
         }
         else if (!strcmp(name, "speed"))
         {
             _speed = atof(value);
         }
         else if (!strcmp(name, "fire_resistatnt"))
         {
             if (value[0] == '0')
             {
                 _fire_resistant = false;
             }
             else if (value[0] == '1')
             {
                 _fire_resistant = true;
             }
         }
         else if (!strcmp(name, "ice_resistance"))
         {
             _ice_resistance = atof(value);
         }
     }
     
     Set_Pos(static_cast<float>(_posx), static_cast<float>(_posy), 1);
     Set_Rotation_Speed(static_cast<float>(_rotation_speed));
     Set_Static_Image(_image.c_str());
     Set_Path_Identifier(_path.c_str());
     Set_Speed(static_cast<float>(_speed));
     m_fire_resistant = _fire_resistant;
     m_ice_resistance = _ice_resistance;
 }
Beispiel #22
0
void cFlyon::Update(void)
{
    cEnemy::Update();

    if (!m_valid_update || !Is_In_Range()) {
        return;
    }

    Update_Animation();

    // standing ( waiting )
    if (m_state == STA_STAY) {
        // if waiting time
        if (m_wait_time > 0.0f) {
            m_wait_time -= pFramerate->m_speed_factor;

            if (m_wait_time < 0.0f) {
                m_wait_time = 0.0f;
            }
        }
        // no more waiting try to jump out
        else {
            GL_rect rect1 = m_col_rect;

            if (m_direction == DIR_UP) {
                rect1.m_y -= 40.0f;
                rect1.m_h += 40.0f;
            }
            else if (m_direction == DIR_DOWN) {
                rect1.m_y += 40.0f;
                rect1.m_h -= 40.0f;
            }
            else if (m_direction == DIR_LEFT) {
                rect1.m_x -= 35.0f;
                rect1.m_w += 35.0f;
            }
            else if (m_direction == DIR_RIGHT) {
                rect1.m_x += 35.0f;
                rect1.m_w += 35.0f;
            }

            // if player is in front: wait again
            if (pLevel_Player->m_maryo_type != MARYO_GHOST && pLevel_Player->m_col_rect.Intersects(rect1)) {
                m_wait_time = speedfactor_fps * 2;
            }
            // if not: jump out
            else {
                Set_Moving_State(STA_FLY);
            }
        }
    }
    // flying ( moving into the destination direction )
    else {
        // distance to final position
        float dist_to_final_pos = Get_End_Distance();
        // multiplier for the minimal velocity
        float vel_mod_min = (dist_to_final_pos + (m_max_distance * 0.1f)) / m_max_distance;

        // if behind max distance
        if (vel_mod_min <= 0.1f) {
            vel_mod_min = 0.1f;
        }

        /* slow down
         * with the velocity mod which is calculated from the distance to the final position
        */
        switch (m_direction) {
        case DIR_LEFT: {
            // move forward
            if (!m_move_back) {
                m_velx = m_dest_velx * vel_mod_min;
            }
            // move back
            else {
                m_velx = -m_dest_velx * vel_mod_min;
            }
            break;
        }
        case DIR_RIGHT: {
            // move forward
            if (!m_move_back) {
                m_velx = m_dest_velx * vel_mod_min;
            }
            // move back
            else {
                m_velx = -m_dest_velx * vel_mod_min;
            }
            break;
        }
        case DIR_UP: {
            // move forward
            if (!m_move_back) {
                m_vely = m_dest_vely * vel_mod_min;
            }
            // move back
            else {
                m_vely = -m_dest_vely * vel_mod_min;
            }
            break;
        }
        case DIR_DOWN: {
            // move forward
            if (!m_move_back) {
                m_vely = m_dest_vely * vel_mod_min;
            }
            // move back
            else {
                m_vely = -m_dest_vely * vel_mod_min;
            }
            break;
        }
        default: {
            break;
        }
        }

        // moving forward
        if (!m_move_back) {
            // reached final position move back
            if (dist_to_final_pos < 0.0f) {
                m_velx = -m_dest_velx * 0.01f;
                m_vely = -m_dest_vely * 0.01f;

                m_move_back = 1;
            }
        }
        // moving back
        else {
            // reached original position
            if (dist_to_final_pos > m_max_distance) {
                Set_Pos(m_start_pos_x, m_start_pos_y);
                m_wait_time = speedfactor_fps * 2;

                Set_Moving_State(STA_STAY);
            }
        }
    }
}
Beispiel #23
0
void cEnemyStopper :: Create_From_Stream( CEGUI::XMLAttributes &attributes )
{
	Set_Pos( static_cast<float>(attributes.getValueAsInteger( "posx" )), static_cast<float>(attributes.getValueAsInteger( "posy" )), 1 );
}
Beispiel #24
0
void cMoon :: Create_From_Stream( CEGUI::XMLAttributes &attributes )
{
	// position
	Set_Pos( static_cast<float>(attributes.getValueAsInteger( "posx" )), static_cast<float>(attributes.getValueAsInteger( "posy" )) );
}
Beispiel #25
0
 void cWaypoint::Create_From_Stream(XMLElement* attributes)
 {
     int x, y;
     waypoint_type = WAYPOINT_NORMAL;
     std::string destination;
     
     std::string _direction_backward = "left";
     std::string _direction_forward = "right";
     
     bool _access = true;
     
     for (XMLElement* node = attributes->FirstChildElement(); node; node = node->NextSiblingElement())
     {
         const char* name = node->Attribute("name");
         const char* value = node->Attribute("value");
         
         if (!strcmp(name, "x"))
         {
             x = atoi(value);
         }
         else if (!strcmp(name, "y"))
         {
             y = atoi(value);
         }
         else if (!strcmp(name, "type"))
         {
             waypoint_type = static_cast<Waypoint_type>(atoi(value));
         }
         else if (!strcmp(name, "world"))
         {
             destination = value;
         }
         else if (!strcmp(name, "level"))
         {
             destination = value;
         }
         else if (!strcmp(name, "destination"))
         {
             destination = value;
         }
         else if (!strcmp(name, "direction_backward"))
         {
             _direction_backward = value;
         }
         else if (!strcmp(name, "direction_forward"))
         {
             _direction_forward = value;
         }
         else if (!strcmp(name, "access"))
         {
             if (value[0] == '0')
             {
                 _access = false;
             }
             else
             {
                 _access = true;
             }
         }
     }
     
     Set_Pos(static_cast<float>(x), static_cast<float>(y), 1);
     
     Set_Destination(destination);
     
     direction_backward = Get_Direction_Id(_direction_backward.c_str());
     
     direction_forward = Get_Direction_Id(_direction_forward.c_str());
     
     Set_Access(_access, 1);
 }
Beispiel #26
0
 void cPath::Create_From_Stream(XMLElement* attributes)
 {
     segments.clear();
     
     int _posx, _posy;
     std::string _identifier;
     bool _rewind = m_rewind;
     
     std::map<std::string, std::string> map_segments;
     
     for (XMLElement* node = attributes->FirstChildElement(); node; node = node->NextSiblingElement())
     {
         const char* name = node->Attribute("name");
         const char* value = node->Attribute("value");
     
         if (!strcmp(name, "posx"))
         {
             _posx = atoi(value);
         }
         else if (!strcmp(name, "posy"))
         {
             _posy = atoi(value);
         }
         else if (!strcmp(name, "identifier"))
         {
             _identifier = value;
         }
         else if (!strcmp(name, "rewind"))
         {
             if (value[0] == '0')
             {
                 _rewind = false;
             }
             else if (value[0] == '1')
             {
                 _rewind = true;
             }
         }
         else
         {
             map_segments.insert(std::make_pair(std::string(name), std::string(value)));
         }
     }
     
     Set_Pos(static_cast<float>(_posx), static_cast<float>(_posy), 1);
     
     Set_Identifier(_identifier.c_str());
     
     Set_Rewind(_rewind);
     
     unsigned int count = 0;
     
     while (1)
     {
         char tempBuf[100];
         sprintf(tempBuf, "%d", count);
         
         std::string str_pos = tempBuf;
         
         if (map_segments.find("segment_" + str_pos + "_x1") == map_segments.end())
         {
             break;
         }
         
         cPath_Segment obj;
         
         obj.Set_Pos(atof(map_segments.at("segment_" + str_pos + "_x1").c_str()), atof(map_segments.at("segment_" + str_pos + "_y1").c_str()), atof(map_segments.at("segment_" + str_pos + "_x2").c_str()), atof(map_segments.at("segment_" + str_pos + "_y2").c_str()));
         
         segments.push_back(obj);
         
         count++;
     }
 }
Beispiel #27
0
void  LOOL_OLED::LCD_Number(uint16_t ch,uint8_t  x,uint8_t y)
{
	uint8_t num1=0,num2=0,num3=0,num4=0,num5=0;
	num1 = ch/10000;
	num2 = (ch%10000)/1000;
	num3 = (ch%1000)/100;
	num4 = (ch%100)/10;
	num5 = ch%10;
	
	 y=y%4;
	 if(num1!=0)
	 {
	 if(x>126){x=0;y++;}
	 Set_Pos(x,y*2);
     LCD_shuzi_1(num1);
     Set_Pos(x,y*2+1);
     LCD_shuzi_2(num1);
	 x+=8;
	 }
	 if(num1==0 && num2==0)
	 {}
     else
	 {
	 if(x>126){x=0;y++;}
	 Set_Pos(x,y*2);
     LCD_shuzi_1(num2);
     Set_Pos(x,y*2+1);
     LCD_shuzi_2(num2);
	 x+=8;
	 }
	if(num1==0 && num2==0 && num3==0)
	 {}
     else
	 {
	 if(x>126){x=0;y++;}
	 Set_Pos(x,y*2);
     LCD_shuzi_1(num3);
     Set_Pos(x,y*2+1);
     LCD_shuzi_2(num3);
	 x+=8;
	 }
	if(num1==0 && num2==0 && num3==0&&num4==0)
	 {}
     else
	 {
	 if(x>126){x=0;y++;}
	 Set_Pos(x,y*2);
     LCD_shuzi_1(num4);
     Set_Pos(x,y*2+1);
     LCD_shuzi_2(num4);
	 x+=8;
	 }
	if(num1==0 && num2==0 && num3==0&&num4==0&&num5==0)
	 {}
     else
	 {
	 if(x>126){x=0;y++;}
	 Set_Pos(x,y*2);
     LCD_shuzi_1(num5);
     Set_Pos(x,y*2+1);
     LCD_shuzi_2(num5);
	 x+=8;
	 }
}