background + score support but the true one
This commit is contained in:
parent
8dc711bd2b
commit
bffc3bf04c
@ -18,7 +18,8 @@ public:
|
||||
void drawPlayer(const nsGraphics::Vec2D& baseVector, unsigned width, const nsGraphics::RGBAcolor &color);
|
||||
void drawTorpedo(const nsGraphics::Vec2D& baseVector, unsigned width, const nsGraphics::RGBAcolor& color);
|
||||
void drawMissile(const nsGraphics::Vec2D& baseVector, unsigned width, const nsGraphics::RGBAcolor& color);
|
||||
void drawSprite(const nsGraphics::Vec2D& baseVector, const std::string& spritePath);
|
||||
nsGui::Sprite background = nsGui::Sprite("./assets/bg.sl2", nsGraphics::Vec2D(0,0)); // you cant create an empty sprite for some reasons
|
||||
void drawBackground();
|
||||
|
||||
unsigned showInitialMenu();
|
||||
unsigned showDeathMenu();
|
||||
@ -26,6 +27,7 @@ public:
|
||||
unsigned getScreenWidth();
|
||||
void startFrame();
|
||||
void endFrame();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@ -21,6 +21,7 @@ void Game::managedGames() {
|
||||
playMode = initialMenuHandler();
|
||||
}else{
|
||||
playGame(); // will read the playMode
|
||||
cout << players[0].score << endl; // will remove
|
||||
cout << "END OF GAME" << endl;
|
||||
break; // TODO remove
|
||||
if(!deathMenuHandler()) playMode = NONE; // back to the main menu
|
||||
@ -87,7 +88,6 @@ WinValue Game::playGame(){ // returns when game is finished
|
||||
players[0].x = confData.startXPosition;
|
||||
|
||||
basePos = position(0,0);
|
||||
|
||||
// GAMELOOP
|
||||
|
||||
#define FPS 1000
|
||||
@ -120,6 +120,7 @@ WinValue Game::playGame(){ // returns when game is finished
|
||||
*
|
||||
*/
|
||||
void Game::display() {
|
||||
pm.drawBackground();
|
||||
for (unsigned i = 0; i < this->grid.size(); ++i){
|
||||
for (unsigned j = 0; j < this->grid[i].size(); ++j){
|
||||
nsGraphics::Vec2D vec(
|
||||
|
@ -161,6 +161,7 @@ bool Game::checkTorpedosAndInvaders() {
|
||||
}
|
||||
if(i==grid.size()) ++tor_ite;
|
||||
else{
|
||||
players[tor_ite->owner].score += 100;
|
||||
torpedos.erase(tor_ite);
|
||||
grid[i].pop_back();
|
||||
}
|
||||
|
@ -52,9 +52,8 @@ void PixelManager::drawTorpedo(const nsGraphics::Vec2D& baseVector, unsigned wid
|
||||
window << nsShape::Rectangle(baseVector, baseVector+position(width, width*PROJ_LENGTH_FACTOR), color);
|
||||
}
|
||||
|
||||
void PixelManager::drawSprite(const nsGraphics::Vec2D& baseVector, const std::string& spritePath){
|
||||
nsGui::Sprite sprite(spritePath,baseVector);
|
||||
sprite.draw(window);
|
||||
void PixelManager::drawBackground(){
|
||||
background.draw(window);
|
||||
}
|
||||
|
||||
unsigned PixelManager::showInitialMenu(){
|
||||
|
Loading…
Reference in New Issue
Block a user