1
0
Fork 0
Space Walk board game
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

47 Zeilen
892 B

#include "infowindow.h"
#include "maingame.h"
#include "player.h"
#include "spaceship.h"
InfoWindow::InfoWindow(int height, int width, Player **player, SpaceShip **ship) :
height(height),
width(width),
player(player),
ship(ship) {
}
InfoWindow::~InfoWindow() {
}
void InfoWindow::update() {
Window::update();
this->resize();
int y = 0;
int x = 1;
for (unsigned char i = 0; i < PLAYER_SIZE; i++) {
this->player[i]->render(this, y, x, i + 1);
y += 6;
int shipIdx = i * SHIP_SIZE / 2;
for (unsigned char j = shipIdx; j < shipIdx + SHIP_SIZE / 2; j++) {
this->ship[j]->render(this, y, x);
x++;
if (x > 3) {
y++;
x = 1;
}
}
y += 2;
}
}
void InfoWindow::resize() {
int rows = this->getMaxRows() - this->height;
int x = this->getMaxCols() - this->width;
int cols = this->getMaxCols() - x;
this->setWindow(rows, cols, 0, x);
Window::resize();
}