void game::gamecore::show_ui(sdl::createwin& ecran, game::player& player) { sdl::color white(255,255,255); std::ostringstream oss; oss << "Score : " << player.get_score() << " Vie Restante : " << player.get_vie(); std::string result = oss.str(); ecran.refresh_zone(0,0,700,80); sdl::create_text scoreTmp(result,"HungerGames.ttf",white.getcolor(),0,0,ecran.getsurface()); }
int game::weapon_player::toucher(sdl::createwin& ecran) { status = 0; std::cout << "CLEAN ARME PIXEL " << posX << " : : " << posY << std::endl; ecran.refresh_zone(posX,posY,5,5); posX = 0; posY = 0; return 0; }
void game::player::move(sdl::createwin& ecran,int sens) { sdl::color blue(0,0,255); // std::cout << sens << std::endl; if(sens == 12) { posX = posX - speed; ecran.refresh_zone(posX + 20,posY,speed,20); } else if(sens == 13) { posX = posX + speed; ecran.refresh_zone(posX - speed,posY,speed,20); } rect->rect_color_move(blue.getcolor(),ecran,posX,posY,20,20); }
void game::weapon_ennemy::refresh_pos(sdl::createwin& ecran) { sdl::color cyan; if(status == 1) { ecran.refresh_zone(posX,posY,5,5); if (posY >= 680) { status = 0; posX = 0; posY = 0; return; } posY = posY + 20; rect->rect_color_move(cyan.getcolor(),ecran, posX, posY,5,5); } }
void game::weapon_player::refresh_pos(sdl::createwin& ecran) { sdl::color cyan; if(status == 1) { ecran.refresh_zone(posX,posY,5,5); if (posY <= 50) { status = 0; posX = 0; posY = 0; return; } posY = posY - 20; std::cout << "ARME REDRAW" << std::endl; rect->rect_color_move(cyan.getcolor(),ecran, posX, posY,5,5); } }
void game::player::change_score(sdl::createwin& ecran, int s) { score = score + s; ecran.getsurface(); }