#pragma clang diagnostic push #pragma ide diagnostic ignored "cppcoreguidelines-narrowing-conversions" #include "game.h" int randomSeed[78] = { 26, 38, 69, 23, 29, 35, 45, 59, 60, 86, 55, 64, 3, 92, 74, 18, 16, 81, 17, 67, 98, 89, 49, 51, 83, 36, 72, 7, 75, 84, 31, 81, 29, 15, 96, 58, 96, 27, 88, 40, 1, 47, 30, 7, 61, 3, 4, 72, 39, 44, 69, 8, 24, 69, 11, 7, 19, 74, 79, 70, 71, 86, 78, 87, 53, 49, 97, 96, 60, 71, 8, 41, 49, 63, 79, 43, 12, 6 }; int main() { HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); //COORD coordScreen = {0, 0}; DWORD cCharsWritten; CONSOLE_SCREEN_BUFFER_INFO csbi; GetConsoleScreenBufferInfo(hConsole, &csbi); DWORD dwConSize; //struct ConsoleApp game = {0, hConsole, &csbi, &cCharsWritten}; //ConsoleApp *pGame = &game; //consoleInit(pGame); Entity entities[10]; //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}}; // INIT Clock targeting const int targetFPS = 60; // Target frames per second const int frameDelay = 1000 / targetFPS; // Frame duration in milliseconds // Main Loop bool run = true; while (run) { //GetConsoleScreenBufferInfo(hConsole, &csbi); // printList(&hConsole, // &cCharsWritten, // entities); getUserInput(&entities[0],&csbi.srWindow); for (int counter = 0; counter < 5 ;counter++) { WriteConsoleOutputCharacter(hConsole, &entities[counter].avatar, 1, entities[counter].position, &cCharsWritten); } clock_t startTime = clock(); // Calculate the elapsed time and delay if necessary clock_t elapsedTime = clock() - startTime; int delayTime = frameDelay - (elapsedTime * 1000 / CLOCKS_PER_SEC); // Ensure the frame time does not exceed the target FPS if (delayTime > 0) { Sleep(delayTime); } if (GetAsyncKeyState(VK_ESCAPE)) { run = false; } clearConsole(); } return 0; } #pragma clang diagnostic pop