Added god
This commit is contained in:
parent
632031cedb
commit
8160ca1b0b
@ -9,4 +9,5 @@ Questions que je (Thomas Rubini) voudrais poser
|
||||
- Que pensez-vous de la sémantique de déplacement, plutot que la référence constante ?
|
||||
- Est-ce qu'on doit forcément utiliser const pour des valeurs primitives (int, float...) qu'on ne touche pas en paramètres de fonction ?
|
||||
- Est-ce que vouloir faire des structures optimisées (pas de redondance de mémoire) est une bonne chose, ou pas importa,t ?
|
||||
- Pour import MinGL, il vaut mieux utiliser "" ou <> ?
|
||||
- Pour import MinGL, il vaut mieux utiliser "" ou <> ?
|
||||
- copier ou ref constante pour Position (Vec2D) ?
|
BIN
assets/hand_closed.png
Normal file
BIN
assets/hand_closed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
BIN
assets/hand_open.png
Normal file
BIN
assets/hand_open.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
@ -10,6 +10,7 @@
|
||||
#include "configData.h"
|
||||
#include "projectiles.h"
|
||||
#include "scoresManager.h"
|
||||
#include "god.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -19,6 +20,7 @@ private:
|
||||
PixelManager pm;
|
||||
ConfigData confData;
|
||||
ScoresManager sm;
|
||||
God god;
|
||||
|
||||
Position basePos;
|
||||
InvadersGrid grid;
|
||||
@ -34,10 +36,15 @@ private:
|
||||
unsigned fireCooldown=120;
|
||||
|
||||
// basic methods
|
||||
void display();
|
||||
void updateColumns();
|
||||
void handleScoreSaving();
|
||||
|
||||
// drawing methods
|
||||
void display();
|
||||
void displayGod();
|
||||
void displayInvader(const Position& basePos, unsigned size, InvaderType type);
|
||||
|
||||
|
||||
// managers
|
||||
void managePlayers();
|
||||
void manageOnePlayer(unsigned);
|
||||
@ -51,6 +58,10 @@ private:
|
||||
bool checkTorpedosAndInvaders();
|
||||
bool invadersTouchPlayer();
|
||||
|
||||
// god things
|
||||
void manageGod();
|
||||
void _manageGod_retrieve(bool back);
|
||||
|
||||
public:
|
||||
// in case someone wants to mess with the code, here's a minimal API, costs nothing to us
|
||||
Game();
|
||||
|
37
headers/god.h
Normal file
37
headers/god.h
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef GUARD_GOD_H
|
||||
#define GUARD_GOD_H
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
enum class GodState{
|
||||
NONE,
|
||||
LOAD,
|
||||
WAIT,
|
||||
RETRIEVE1,
|
||||
RETRIEVE2,
|
||||
THROW,
|
||||
};
|
||||
// I don't want to put that in config, I feel like it would be useless and overkill at this point
|
||||
#define GOD_BENCH_SIZE 64
|
||||
#define GOD_HAND_SIZE 64
|
||||
#define GOD_HAND_DISTANCE 100
|
||||
|
||||
|
||||
/*
|
||||
* Hand position is determined
|
||||
*/
|
||||
|
||||
|
||||
class God{
|
||||
public:
|
||||
GodState state;
|
||||
unsigned counter;
|
||||
|
||||
Position throwedInvPos;
|
||||
InvaderType thrownInvType;
|
||||
Position thrownVector;
|
||||
Position thrownTransition;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -11,6 +11,7 @@
|
||||
#include "utils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace nsGraphics;
|
||||
|
||||
class PixelManager{
|
||||
public:
|
||||
@ -19,12 +20,13 @@ public:
|
||||
nsGui::Sprite background = nsGui::Sprite("./assets/bg.sl2"); // you cant create an empty sprite for some reasons
|
||||
|
||||
explicit PixelManager(MinGL&);
|
||||
void drawInvader1(const nsGraphics::Vec2D& baseVector, unsigned size);
|
||||
void drawInvader2(const nsGraphics::Vec2D& baseVector, unsigned size);
|
||||
void drawInvader3(const nsGraphics::Vec2D& baseVector, unsigned size);
|
||||
void drawPlayer(const unsigned x, 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 drawInvaderA(const Position& baseVector, unsigned size, RGBAcolor& color);
|
||||
void drawInvaderB(const Position& baseVector, unsigned size, RGBAcolor& color);
|
||||
void drawInvaderC(const Position& baseVector, unsigned size, RGBAcolor& color);
|
||||
void drawPlayer(const unsigned x, unsigned width, const nsGraphics::RGBAcolor& color);
|
||||
void drawTorpedo(const Position& baseVector, unsigned width, const nsGraphics::RGBAcolor& color);
|
||||
void drawMissile(const Position& baseVector, unsigned width, const nsGraphics::RGBAcolor& color);
|
||||
void drawBackground();
|
||||
|
||||
unsigned showInitialMenu();
|
||||
@ -36,6 +38,11 @@ public:
|
||||
|
||||
void askPlayerNameMenu(playerID pID, string& name);
|
||||
|
||||
// y will be negative sometimes, so not unsigned
|
||||
void displayGodBench(int y);
|
||||
|
||||
void displayGodRightHand(const Position& pos);
|
||||
void displayGodLeftHand(const Position& pos);
|
||||
};
|
||||
|
||||
|
||||
|
@ -7,6 +7,9 @@
|
||||
// hardcoded values
|
||||
#define PLAYER_HEIGHT 100
|
||||
#define PROJ_LENGTH_FACTOR 2
|
||||
// TODO utiliser ca de partout
|
||||
// ou alors faire une method dans Game ?
|
||||
#define INV_POS(i) confData.invadersSize*(i)+confData.invadersDistance*(i)
|
||||
|
||||
enum class WinValue{
|
||||
NOBODY, // should never be used
|
||||
@ -27,7 +30,7 @@ public:
|
||||
size_t getOutterInvader();
|
||||
};
|
||||
typedef vector<InvadersColumn> InvadersGrid;
|
||||
typedef nsGraphics::Vec2D Position;
|
||||
typedef nsGraphics::Vec2D Position; // in case we need to ad dmore methods, we defined our own type
|
||||
typedef unsigned playerID; // 0 for player 1, 1 for player 2
|
||||
|
||||
// didn't want to use Position because of the semantic with x and y
|
||||
|
@ -1,5 +1,6 @@
|
||||
1722516557529414056
|
||||
13651974094361129891
|
||||
Thomas,1000
|
||||
Thomas,0
|
||||
Thomas,0
|
||||
Thomas,0
|
||||
Thomas,0
|
||||
|
50
src/game/display.cpp
Normal file
50
src/game/display.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
#include "game.h"
|
||||
|
||||
|
||||
/** Displays the screen once, and returns
|
||||
*
|
||||
*/
|
||||
void Game::display() {
|
||||
pm.drawBackground();
|
||||
for (unsigned i = 0; i < this->grid.size(); ++i){
|
||||
for (unsigned j = 0; j < this->grid[i].size(); ++j){
|
||||
Position vec(
|
||||
basePos.getX() + i * confData.invadersSize + i * confData.invadersDistance,
|
||||
basePos.getY() + j * confData.invadersSize + j * confData.invadersDistance
|
||||
);
|
||||
displayInvader(vec, confData.invadersSize, grid[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
for(missile& miss : missiles){
|
||||
pm.drawMissile(miss, confData.missilesWidth, confData.missilesColor);
|
||||
}
|
||||
for(torpedo& tor : torpedos){
|
||||
pm.drawTorpedo(tor, confData.torpedosWidth, confData.torpedosColor);
|
||||
}
|
||||
|
||||
for(size_t i=0;i<players.size();++i){
|
||||
pm.drawPlayer(players[i].x, confData.playersWidth, confData.playerDefs[i].color);
|
||||
}
|
||||
|
||||
displayGod();
|
||||
}
|
||||
|
||||
void Game::displayInvader(const Position& pos, unsigned size, InvaderType type){
|
||||
if(type==InvaderType::NONE)return;
|
||||
InvaderTypeDef invDef = confData.invadersDef[type];
|
||||
switch(type){
|
||||
case InvaderType::TYPEA:{
|
||||
pm.drawInvaderA(pos, size, invDef.color);
|
||||
return;
|
||||
}
|
||||
case InvaderType::TYPEB:{
|
||||
pm.drawInvaderB(pos, size, invDef.color);
|
||||
return;
|
||||
}
|
||||
case InvaderType::TYPEC:{
|
||||
pm.drawInvaderC(pos, size, invDef.color);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
#include "game.h"
|
||||
#include "playMode.h"
|
||||
|
||||
#define WININIT window("space invader du turfu", nsGraphics::Vec2D(1280, 720), nsGraphics::Vec2D(128, 128), nsGraphics::KBlack)
|
||||
#define WININIT window("space invader du turfu", Position(1280, 720), Position(128, 128), nsGraphics::KBlack)
|
||||
|
||||
|
||||
Game::Game() : WININIT, pm(window) {
|
||||
@ -41,6 +41,7 @@ void Game::handleScoreSaving(){
|
||||
void Game::managedGames() {
|
||||
|
||||
playMode = PlayMode::NONE;
|
||||
god.state = GodState::NONE;
|
||||
|
||||
while(playMode!=PlayMode::EXIT){
|
||||
if(playMode==PlayMode::NONE){
|
||||
@ -132,43 +133,3 @@ WinValue Game::playGame(){ // returns when game is finished
|
||||
}
|
||||
return WinValue::NOBODY;
|
||||
}
|
||||
|
||||
/** Displays the screen once, and returns
|
||||
*
|
||||
*/
|
||||
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(
|
||||
basePos.getX() + i * confData.invadersSize + i * confData.invadersDistance,
|
||||
basePos.getY() + j * confData.invadersSize + j * confData.invadersDistance
|
||||
);
|
||||
switch(grid[i][j]){
|
||||
case InvaderType::TYPEA:{
|
||||
pm.drawInvader1(vec, confData.invadersSize);
|
||||
break;
|
||||
}
|
||||
case InvaderType::TYPEB:{
|
||||
pm.drawInvader2(vec, confData.invadersSize);
|
||||
break;
|
||||
}
|
||||
case InvaderType::TYPEC:{
|
||||
pm.drawInvader3(vec, confData.invadersSize);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(missile& miss : missiles){
|
||||
pm.drawMissile(miss, confData.missilesWidth, confData.missilesColor);
|
||||
}
|
||||
for(torpedo& tor : torpedos){
|
||||
pm.drawTorpedo(tor, confData.torpedosWidth, confData.torpedosColor);
|
||||
}
|
||||
|
||||
for(size_t i=0;i<players.size();++i){
|
||||
pm.drawPlayer(players[i].x, confData.playersWidth, confData.playerDefs[i].color);
|
||||
}
|
||||
}
|
95
src/godThings.cpp
Normal file
95
src/godThings.cpp
Normal file
@ -0,0 +1,95 @@
|
||||
#include "game.h"
|
||||
|
||||
void Game::manageGod(){
|
||||
switch(god.state){
|
||||
case GodState::NONE:{
|
||||
return;
|
||||
}
|
||||
case GodState::LOAD:{
|
||||
++god.counter;
|
||||
if(god.counter==GOD_BENCH_SIZE){
|
||||
god.counter = 0;
|
||||
god.state = GodState::WAIT;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void applyBezier(Position& pos, const Position& point, double percent){
|
||||
pos += (point-pos)*percent;
|
||||
}
|
||||
|
||||
void Game::displayGod() {
|
||||
switch (god.state) {
|
||||
case GodState::NONE:
|
||||
return;
|
||||
case GodState::LOAD: {
|
||||
pm.displayGodBench(god.counter - GOD_BENCH_SIZE);
|
||||
|
||||
Position leftHand = Position(pm.getScreenWidth()-GOD_HAND_DISTANCE-GOD_HAND_SIZE, god.counter - GOD_BENCH_SIZE);
|
||||
Position rightHand = Position(GOD_HAND_DISTANCE, god.counter - GOD_BENCH_SIZE);
|
||||
pm.displayGodLeftHand(leftHand);
|
||||
pm.displayGodRightHand(rightHand);
|
||||
}
|
||||
case GodState::WAIT:{
|
||||
pm.displayGodBench(0);
|
||||
|
||||
Position leftHand(GOD_HAND_DISTANCE, 0);
|
||||
Position rightHand(pm.getScreenWidth()-GOD_HAND_DISTANCE-GOD_HAND_SIZE, 0);
|
||||
pm.displayGodLeftHand(leftHand);
|
||||
pm.displayGodRightHand(rightHand);
|
||||
|
||||
++god.counter;
|
||||
if(god.counter==1000){
|
||||
// init throw
|
||||
god.counter = 0;
|
||||
god.state = GodState::RETRIEVE1;
|
||||
unsigned rx = rand()%grid.size();
|
||||
unsigned ry = rand()%grid[0].size();
|
||||
god.throwedInvPos.setX(rx);
|
||||
god.throwedInvPos.setY(ry);
|
||||
|
||||
god.thrownInvType = grid[rx][ry];
|
||||
|
||||
god.thrownTransition.setX(GOD_HAND_SIZE);
|
||||
god.thrownTransition.setY(rx);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GodState::RETRIEVE1:{
|
||||
// Bezier curve
|
||||
// counter goes [0-100]
|
||||
|
||||
Position startPos(GOD_HAND_DISTANCE, 0);
|
||||
Position endPos = basePos+Position(INV_POS(god.throwedInvPos.getX()), INV_POS(god.throwedInvPos.getY()));
|
||||
|
||||
applyBezier(startPos, god.thrownTransition, god.counter/100);
|
||||
applyBezier(startPos, endPos, god.counter/100);
|
||||
|
||||
// startPos is now the position we need to draw our hand to
|
||||
pm.displayGodRightHand(startPos);
|
||||
pm.displayGodLeftHand(Position(GOD_HAND_DISTANCE, 0));
|
||||
|
||||
break;
|
||||
}
|
||||
case GodState::RETRIEVE2:{
|
||||
// similar with RETRIEVE1
|
||||
Position startPos(GOD_HAND_DISTANCE, 0);
|
||||
Position endPos = basePos+Position(INV_POS(god.throwedInvPos.getX()), INV_POS(god.throwedInvPos.getY()));
|
||||
|
||||
applyBezier(startPos, god.thrownTransition, 1-(god.counter/100));
|
||||
applyBezier(startPos, endPos, 1-(god.counter/100));
|
||||
|
||||
pm.displayGodRightHand(startPos);
|
||||
pm.displayGodLeftHand(Position(GOD_HAND_DISTANCE, 0));
|
||||
|
||||
// but now, you come with me you invader !
|
||||
// pm.drawInvader1();
|
||||
break;
|
||||
}
|
||||
case GodState::THROW:{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -6,43 +6,42 @@ PixelManager::PixelManager(MinGL& a) : window(a) {
|
||||
window.initGraphic();
|
||||
}
|
||||
|
||||
void PixelManager::drawInvader1(const nsGraphics::Vec2D& baseVector, unsigned size){
|
||||
void PixelManager::drawInvaderA(const Position& baseVector, unsigned size, RGBAcolor& color){
|
||||
float scale = size/(float)100;
|
||||
window << nsShape::Circle(nsGraphics::Vec2D(50*scale, 50*scale)+baseVector, 50*scale, nsGraphics::KGray);
|
||||
window << nsShape::Triangle(nsGraphics::Vec2D(35*scale, 50*scale)+baseVector, nsGraphics::Vec2D(15*scale, 25*scale)+baseVector, nsGraphics::Vec2D(15*scale, 75*scale)+baseVector, nsGraphics::KBlack);
|
||||
window << nsShape::Triangle(nsGraphics::Vec2D(25*scale, 50*scale)+baseVector, nsGraphics::Vec2D(10*scale, 25*scale)+baseVector, nsGraphics::Vec2D(10*scale, 75*scale)+baseVector, nsGraphics::KGray);
|
||||
window << nsShape::Triangle(nsGraphics::Vec2D(65*scale, 50*scale)+baseVector, nsGraphics::Vec2D(85*scale, 25*scale)+baseVector, nsGraphics::Vec2D(85*scale, 75*scale)+baseVector, nsGraphics::KBlack);
|
||||
window << nsShape::Triangle(nsGraphics::Vec2D(75*scale, 50*scale)+baseVector, nsGraphics::Vec2D(90*scale, 25*scale)+baseVector, nsGraphics::Vec2D(90*scale, 75*scale)+baseVector, nsGraphics::KGray);
|
||||
window << nsShape::Rectangle(nsGraphics::Vec2D(35*scale, 65*scale)+baseVector, nsGraphics::Vec2D(65*scale, 72*scale)+baseVector, nsGraphics::KBlack);
|
||||
|
||||
window << nsShape::Circle(Position(50*scale, 50*scale)+baseVector, 50*scale, nsGraphics::KGray);
|
||||
window << nsShape::Triangle(Position(35*scale, 50*scale)+baseVector, Position(15*scale, 25*scale)+baseVector, Position(15*scale, 75*scale)+baseVector, nsGraphics::KBlack);
|
||||
window << nsShape::Triangle(Position(25*scale, 50*scale)+baseVector, Position(10*scale, 25*scale)+baseVector, Position(10*scale, 75*scale)+baseVector, nsGraphics::KGray);
|
||||
window << nsShape::Triangle(Position(65*scale, 50*scale)+baseVector, Position(85*scale, 25*scale)+baseVector, Position(85*scale, 75*scale)+baseVector, nsGraphics::KBlack);
|
||||
window << nsShape::Triangle(Position(75*scale, 50*scale)+baseVector, Position(90*scale, 25*scale)+baseVector, Position(90*scale, 75*scale)+baseVector, nsGraphics::KGray);
|
||||
window << nsShape::Rectangle(Position(35*scale, 65*scale)+baseVector, Position(65*scale, 72*scale)+baseVector, nsGraphics::KBlack);
|
||||
}
|
||||
|
||||
void PixelManager::drawInvader2(const nsGraphics::Vec2D& baseVector, unsigned size){
|
||||
void PixelManager::drawInvaderB(const Position& baseVector, unsigned size, RGBAcolor& color){
|
||||
float scale = size/(float)100;
|
||||
window << nsShape::Circle(nsGraphics::Vec2D(50*scale, 50*scale)+baseVector, 50*scale, nsGraphics::KRed);
|
||||
window << nsShape::Rectangle(nsGraphics::Vec2D(25*scale, 30*scale)+baseVector, nsGraphics::Vec2D(45*scale, 40*scale)+baseVector, nsGraphics::KBlack);
|
||||
window << nsShape::Rectangle(nsGraphics::Vec2D(55*scale, 30*scale)+baseVector, nsGraphics::Vec2D(75*scale, 40*scale)+baseVector, nsGraphics::KBlack);
|
||||
window << nsShape::Rectangle(nsGraphics::Vec2D(35*scale, 65*scale)+baseVector, nsGraphics::Vec2D(65*scale, 72*scale)+baseVector, nsGraphics::KBlack);
|
||||
window << nsShape::Circle(Position(50*scale, 50*scale)+baseVector, 50*scale, nsGraphics::KRed);
|
||||
window << nsShape::Rectangle(Position(25*scale, 30*scale)+baseVector, Position(45*scale, 40*scale)+baseVector, nsGraphics::KBlack);
|
||||
window << nsShape::Rectangle(Position(55*scale, 30*scale)+baseVector, Position(75*scale, 40*scale)+baseVector, nsGraphics::KBlack);
|
||||
window << nsShape::Rectangle(Position(35*scale, 65*scale)+baseVector, Position(65*scale, 72*scale)+baseVector, nsGraphics::KBlack);
|
||||
}
|
||||
|
||||
void PixelManager::drawInvader3(const nsGraphics::Vec2D& baseVector, unsigned size){
|
||||
void PixelManager::drawInvaderC(const Position& baseVector, unsigned size, RGBAcolor& color){
|
||||
float scale = size/(float)100;
|
||||
window << nsShape::Circle(nsGraphics::Vec2D(50*scale, 50*scale)+baseVector, 50*scale, nsGraphics::KGreen);
|
||||
window << nsShape::Circle(nsGraphics::Vec2D(35*scale, 35*scale)+baseVector, 10*scale, nsGraphics::KBlack);
|
||||
window << nsShape::Circle(nsGraphics::Vec2D(65*scale, 35*scale)+baseVector, 10*scale, nsGraphics::KBlack);
|
||||
window << nsShape::Rectangle(nsGraphics::Vec2D(35*scale, 65*scale)+baseVector, nsGraphics::Vec2D(65*scale, 72*scale)+baseVector, nsGraphics::KBlack);
|
||||
window << nsShape::Circle(Position(50*scale, 50*scale)+baseVector, 50*scale, nsGraphics::KGreen);
|
||||
window << nsShape::Circle(Position(35*scale, 35*scale)+baseVector, 10*scale, nsGraphics::KBlack);
|
||||
window << nsShape::Circle(Position(65*scale, 35*scale)+baseVector, 10*scale, nsGraphics::KBlack);
|
||||
window << nsShape::Rectangle(Position(35*scale, 65*scale)+baseVector, Position(65*scale, 72*scale)+baseVector, nsGraphics::KBlack);
|
||||
}
|
||||
|
||||
void PixelManager::drawPlayer(const unsigned x, unsigned width, const nsGraphics::RGBAcolor& color){
|
||||
width = width-10-10;
|
||||
width = width/2;
|
||||
window << nsShape::Triangle(nsGraphics::Vec2D(0+x, 720), nsGraphics::Vec2D(5+x, 720), nsGraphics::Vec2D(5+x, 720-PLAYER_HEIGHT/2), color);
|
||||
window << nsShape::Rectangle(nsGraphics::Vec2D(5+x, 720), nsGraphics::Vec2D(5+width+x, 720-PLAYER_HEIGHT/2), color);
|
||||
window << nsShape::Rectangle(nsGraphics::Vec2D(5+width+x, 720), nsGraphics::Vec2D(15+width+x, 720-PLAYER_HEIGHT), color);
|
||||
window << nsShape::Rectangle(nsGraphics::Vec2D(15+width+x, 720), nsGraphics::Vec2D(15+width*2+x, 720-PLAYER_HEIGHT/2), color);
|
||||
window << nsShape::Triangle(nsGraphics::Vec2D(15+width*2+x, 720), nsGraphics::Vec2D(15+width*2+x, 720-PLAYER_HEIGHT/2), nsGraphics::Vec2D(20+width*2+x, 720), color);
|
||||
window << nsShape::Triangle(nsGraphics::Vec2D(5+x,720-PLAYER_HEIGHT/2), nsGraphics::Vec2D(5+width+x,720-PLAYER_HEIGHT/2), nsGraphics::Vec2D(5+width+x,720-PLAYER_HEIGHT*0.9), color);
|
||||
window << nsShape::Triangle(nsGraphics::Vec2D(15+width+x,720-PLAYER_HEIGHT/2), nsGraphics::Vec2D(15+width*2+x,720-PLAYER_HEIGHT/2), nsGraphics::Vec2D(15+width+x,720-PLAYER_HEIGHT*0.9), color);
|
||||
window << nsShape::Triangle(Position(0+x, 720), Position(5+x, 720), Position(5+x, 720-PLAYER_HEIGHT/2), color);
|
||||
window << nsShape::Rectangle(Position(5+x, 720), Position(5+width+x, 720-PLAYER_HEIGHT/2), color);
|
||||
window << nsShape::Rectangle(Position(5+width+x, 720), Position(15+width+x, 720-PLAYER_HEIGHT), color);
|
||||
window << nsShape::Rectangle(Position(15+width+x, 720), Position(15+width*2+x, 720-PLAYER_HEIGHT/2), color);
|
||||
window << nsShape::Triangle(Position(15+width*2+x, 720), Position(15+width*2+x, 720-PLAYER_HEIGHT/2), Position(20+width*2+x, 720), color);
|
||||
window << nsShape::Triangle(Position(5+x,720-PLAYER_HEIGHT/2), Position(5+width+x,720-PLAYER_HEIGHT/2), Position(5+width+x,720-PLAYER_HEIGHT*0.9), color);
|
||||
window << nsShape::Triangle(Position(15+width+x,720-PLAYER_HEIGHT/2), Position(15+width*2+x,720-PLAYER_HEIGHT/2), Position(15+width+x,720-PLAYER_HEIGHT*0.9), color);
|
||||
}
|
||||
|
||||
void PixelManager::askPlayerNameMenu(playerID pID, string& name){
|
||||
@ -50,11 +49,11 @@ void PixelManager::askPlayerNameMenu(playerID pID, string& name){
|
||||
name = "Thomas";
|
||||
}
|
||||
|
||||
void PixelManager::drawMissile(const nsGraphics::Vec2D& baseVector, unsigned width, const nsGraphics::RGBAcolor& color){
|
||||
void PixelManager::drawMissile(const Position& baseVector, unsigned width, const nsGraphics::RGBAcolor& color){
|
||||
window << nsShape::Rectangle(baseVector, baseVector + Position(width, width * PROJ_LENGTH_FACTOR), color);
|
||||
}
|
||||
|
||||
void PixelManager::drawTorpedo(const nsGraphics::Vec2D& baseVector, unsigned width, const nsGraphics::RGBAcolor& color){
|
||||
void PixelManager::drawTorpedo(const Position& baseVector, unsigned width, const nsGraphics::RGBAcolor& color){
|
||||
window << nsShape::Rectangle(baseVector, baseVector + Position(width, width * PROJ_LENGTH_FACTOR), color);
|
||||
}
|
||||
|
||||
@ -84,4 +83,16 @@ void PixelManager::startFrame() {
|
||||
|
||||
void PixelManager::endFrame() {
|
||||
window.finishFrame();
|
||||
}
|
||||
}
|
||||
|
||||
void PixelManager::displayGodBench(int y) {
|
||||
|
||||
}
|
||||
|
||||
void PixelManager::displayGodRightHand(const Position& pos) {
|
||||
|
||||
}
|
||||
|
||||
void PixelManager::displayGodLeftHand(const Position& pos) {
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user