The code now properly updates and writes to the console.
This commit is contained in:
22
game.c
22
game.c
@@ -4,9 +4,9 @@
|
||||
|
||||
#include "game.h"
|
||||
|
||||
void gameINIT(Game *pGame)
|
||||
void consoleInit(ConsoleApp *pGame)
|
||||
{
|
||||
Game game = *pGame;
|
||||
ConsoleApp game = *pGame;
|
||||
//HANDLE hConsole = &pGame->hConsole;
|
||||
//CONSOLE_SCREEN_BUFFER_INFO *pCsbi = &game.csbi;
|
||||
//GetConsoleScreenBufferInfo(hConsole, pCsbi);
|
||||
@@ -22,17 +22,12 @@ void gameINIT(Game *pGame)
|
||||
// INIT Entities
|
||||
// const int MAX_ENTITIES = 10;
|
||||
Entity entities[10];
|
||||
Entity *pEntities = &entities;
|
||||
//Entity *pEntities = &entities;
|
||||
entities[0] = (Entity) {0, (char)'X', (char)'P', (COORD) {(SHORT) 20,(SHORT) 20}};
|
||||
entities[1] = (Entity) {1, (char)'N', (char)'N', (COORD) {(SHORT) 10,(SHORT) 10}};
|
||||
entities[2] = (Entity) {2, (char)'N', (char)'N', (COORD) {(SHORT) 11,(SHORT) 10}};
|
||||
entities[3] = (Entity) {3, (char)'N', (char)'N', (COORD) {(SHORT) 12,(SHORT) 10}};
|
||||
entities[4] = (Entity) {4, (char)'N', (char)'N', (COORD) {(SHORT) 13,(SHORT) 10}};
|
||||
// append(&pEntities, 0, (char)'X', (char)'P', (COORD) {(SHORT) 20,(SHORT) 20});
|
||||
/*append(&pEntities, 1, (char)'N', (char)'N', (COORD) {(SHORT) 10,(SHORT) 10});
|
||||
append(&pEntities, 2, (char)'N', (char)'N', (COORD) {(SHORT) 11,(SHORT) 10});
|
||||
append(&pEntities, 3, (char)'N', (char)'N', (COORD) {(SHORT) 12,(SHORT) 10});
|
||||
append(&pEntities, 4, (char)'N', (char)'N', (COORD) {(SHORT) 13,(SHORT) 10});*/
|
||||
|
||||
// INIT Clock targeting
|
||||
const int targetFPS = 60; // Target frames per second
|
||||
@@ -44,18 +39,11 @@ void gameINIT(Game *pGame)
|
||||
{
|
||||
|
||||
GetConsoleScreenBufferInfo(&pGame->hConsole,
|
||||
&pGame->csbi);
|
||||
|
||||
//printBoundsToConsole(&pGame->hConsole,
|
||||
// pGame->charsWritten,
|
||||
// game.csbi.srWindow);
|
||||
|
||||
getUserInput(&pEntities[0],
|
||||
®ion);
|
||||
pGame->csbi);
|
||||
|
||||
printList(&pGame->hConsole,
|
||||
pGame->charsWritten,
|
||||
&entities);
|
||||
entities);
|
||||
|
||||
clock_t startTime = clock();
|
||||
// Calculate the elapsed time and delay if necessary
|
||||
|
||||
Reference in New Issue
Block a user