The code now properly updates and writes to the console.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,116 +0,0 @@
|
||||
{
|
||||
"inputs" :
|
||||
[
|
||||
{
|
||||
"path" : "CMakeLists.txt"
|
||||
},
|
||||
{
|
||||
"isGenerated" : true,
|
||||
"path" : "cmake-build-debug/CMakeFiles/3.25.2/CMakeSystem.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "C:/Users/tony/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.25/Modules/CMakeSystemSpecificInitialize.cmake"
|
||||
},
|
||||
{
|
||||
"isGenerated" : true,
|
||||
"path" : "cmake-build-debug/CMakeFiles/3.25.2/CMakeCCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "C:/Users/tony/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.25/Modules/CMakeSystemSpecificInformation.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "C:/Users/tony/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.25/Modules/CMakeGenericSystem.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "C:/Users/tony/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.25/Modules/CMakeInitializeConfigs.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "C:/Users/tony/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.25/Modules/Platform/Windows.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "C:/Users/tony/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.25/Modules/Platform/WindowsPaths.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "C:/Users/tony/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.25/Modules/CMakeCInformation.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "C:/Users/tony/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.25/Modules/CMakeLanguageInformation.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "C:/Users/tony/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.25/Modules/Compiler/GNU-C.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "C:/Users/tony/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.25/Modules/Compiler/GNU.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "C:/Users/tony/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.25/Modules/Compiler/CMakeCommonCompilerMacros.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "C:/Users/tony/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.25/Modules/Platform/Windows-GNU-C.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "C:/Users/tony/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.25/Modules/Platform/Windows-GNU.cmake"
|
||||
},
|
||||
{
|
||||
"isGenerated" : true,
|
||||
"path" : "cmake-build-debug/CMakeFiles/3.25.2/CMakeRCCompiler.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "C:/Users/tony/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.25/Modules/CMakeRCInformation.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "C:/Users/tony/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.25/Modules/Platform/Windows-windres.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "C:/Users/tony/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.25/Modules/Platform/Windows-GNU-C-ABI.cmake"
|
||||
},
|
||||
{
|
||||
"isCMake" : true,
|
||||
"isExternal" : true,
|
||||
"path" : "C:/Users/tony/AppData/Local/Programs/CLion/bin/cmake/win/x64/share/cmake-3.25/Modules/CMakeCommonLanguageInclude.cmake"
|
||||
}
|
||||
],
|
||||
"kind" : "cmakeFiles",
|
||||
"paths" :
|
||||
{
|
||||
"build" : "C:/Users/tony/CLionProjects/ConsoleMenu/cmake-build-debug",
|
||||
"source" : "C:/Users/tony/CLionProjects/ConsoleMenu"
|
||||
},
|
||||
"version" :
|
||||
{
|
||||
"major" : 1,
|
||||
"minor" : 0
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -6,3 +6,72 @@
|
||||
4 792 7625703535624470 CMakeFiles/ConsoleMenu.dir/console_functions.c.obj c674d5c87e9aa975
|
||||
3 860 7625711257855012 CMakeFiles/ConsoleMenu.dir/entities.c.obj 78b9bb0960cc62cc
|
||||
4 834 7625710297853826 CMakeFiles/ConsoleMenu.dir/game.c.obj 1a9d5bebd0f3c854
|
||||
5 162 7645413198923448 ConsoleMenu.exe 2ef535f549c67042
|
||||
5 1408 7645419558677171 CMakeFiles/ConsoleMenu.dir/main.c.obj ab8c74299a2b00ff
|
||||
4 418 7645419737599471 ConsoleMenu.exe 2ef535f549c67042
|
||||
4 1203 7645424577250045 CMakeFiles/ConsoleMenu.dir/main.c.obj ab8c74299a2b00ff
|
||||
5 1087 7645425052079821 CMakeFiles/ConsoleMenu.dir/game.c.obj 1a9d5bebd0f3c854
|
||||
1088 1233 7645425053479246 ConsoleMenu.exe 2ef535f549c67042
|
||||
10 1423 7645445709624114 CMakeFiles/ConsoleMenu.dir/main.c.obj ab8c74299a2b00ff
|
||||
15 1474 7645445710183732 CMakeFiles/ConsoleMenu.dir/game.c.obj 1a9d5bebd0f3c854
|
||||
4 1480 7645445710244964 CMakeFiles/ConsoleMenu.dir/console_functions.c.obj c674d5c87e9aa975
|
||||
1480 2178 7645445717010738 ConsoleMenu.exe 2ef535f549c67042
|
||||
4 1284 7645447554282685 CMakeFiles/ConsoleMenu.dir/main.c.obj ab8c74299a2b00ff
|
||||
10 1298 7645447554425076 CMakeFiles/ConsoleMenu.dir/game.c.obj 1a9d5bebd0f3c854
|
||||
1299 1444 7645447555847265 ConsoleMenu.exe 2ef535f549c67042
|
||||
4 1145 7645459685170949 CMakeFiles/ConsoleMenu.dir/console_functions.c.obj c674d5c87e9aa975
|
||||
1146 1317 7645459686849620 ConsoleMenu.exe 2ef535f549c67042
|
||||
5 1245 7645460011642079 CMakeFiles/ConsoleMenu.dir/game.c.obj 1a9d5bebd0f3c854
|
||||
1245 1687 7645460015916005 ConsoleMenu.exe 2ef535f549c67042
|
||||
5 1321 7645465383731351 CMakeFiles/ConsoleMenu.dir/console_functions.c.obj c674d5c87e9aa975
|
||||
1322 1463 7645465385085236 ConsoleMenu.exe 2ef535f549c67042
|
||||
5 1278 7645465990374029 CMakeFiles/ConsoleMenu.dir/console_functions.c.obj c674d5c87e9aa975
|
||||
1279 1433 7645465991864651 ConsoleMenu.exe 2ef535f549c67042
|
||||
5 1108 7645466229923873 CMakeFiles/ConsoleMenu.dir/console_functions.c.obj c674d5c87e9aa975
|
||||
1109 1257 7645466231378992 ConsoleMenu.exe 2ef535f549c67042
|
||||
4 1032 7645470822849306 CMakeFiles/ConsoleMenu.dir/console_functions.c.obj c674d5c87e9aa975
|
||||
1033 1142 7645470823897172 ConsoleMenu.exe 2ef535f549c67042
|
||||
3 828 7645471331618470 CMakeFiles/ConsoleMenu.dir/game.c.obj 1a9d5bebd0f3c854
|
||||
829 932 7645471332648107 ConsoleMenu.exe 2ef535f549c67042
|
||||
3 845 7645475383162038 CMakeFiles/ConsoleMenu.dir/game.c.obj 1a9d5bebd0f3c854
|
||||
845 954 7645475384358262 ConsoleMenu.exe 2ef535f549c67042
|
||||
8 1095 7645479346271740 CMakeFiles/ConsoleMenu.dir/game.c.obj 1a9d5bebd0f3c854
|
||||
3 1111 7645479346443807 CMakeFiles/ConsoleMenu.dir/console_functions.c.obj c674d5c87e9aa975
|
||||
1112 1221 7645479347497116 ConsoleMenu.exe 2ef535f549c67042
|
||||
3 816 7645480212199491 CMakeFiles/ConsoleMenu.dir/console_functions.c.obj c674d5c87e9aa975
|
||||
816 920 7645480213194607 ConsoleMenu.exe 2ef535f549c67042
|
||||
3 835 7645480905529445 CMakeFiles/ConsoleMenu.dir/console_functions.c.obj c674d5c87e9aa975
|
||||
836 947 7645480906596385 ConsoleMenu.exe 2ef535f549c67042
|
||||
4 812 7645481278901744 CMakeFiles/ConsoleMenu.dir/console_functions.c.obj c674d5c87e9aa975
|
||||
812 928 7645481279999306 ConsoleMenu.exe 2ef535f549c67042
|
||||
4 944 7645488504822898 CMakeFiles/ConsoleMenu.dir/main.c.obj ab8c74299a2b00ff
|
||||
8 964 7645488505016099 CMakeFiles/ConsoleMenu.dir/game.c.obj 1a9d5bebd0f3c854
|
||||
964 1076 7645488506076272 ConsoleMenu.exe 2ef535f549c67042
|
||||
3 865 7645512443051273 CMakeFiles/ConsoleMenu.dir/main.c.obj ab8c74299a2b00ff
|
||||
866 979 7645512444134750 ConsoleMenu.exe 2ef535f549c67042
|
||||
3 814 7645513636976167 CMakeFiles/ConsoleMenu.dir/console_functions.c.obj c674d5c87e9aa975
|
||||
815 924 7645513638034281 ConsoleMenu.exe 2ef535f549c67042
|
||||
3 994 7645627797349886 CMakeFiles/ConsoleMenu.dir/main.c.obj ab8c74299a2b00ff
|
||||
8 997 7645627797369831 CMakeFiles/ConsoleMenu.dir/game.c.obj 1a9d5bebd0f3c854
|
||||
997 1153 7645627798898135 ConsoleMenu.exe 2ef535f549c67042
|
||||
3 818 7645627982698648 CMakeFiles/ConsoleMenu.dir/game.c.obj 1a9d5bebd0f3c854
|
||||
819 926 7645627983727012 ConsoleMenu.exe 2ef535f549c67042
|
||||
2 815 7645628886753851 CMakeFiles/ConsoleMenu.dir/main.c.obj ab8c74299a2b00ff
|
||||
815 927 7645628887845902 ConsoleMenu.exe 2ef535f549c67042
|
||||
4 800 7645630881080351 CMakeFiles/ConsoleMenu.dir/main.c.obj ab8c74299a2b00ff
|
||||
801 909 7645630882140797 ConsoleMenu.exe 2ef535f549c67042
|
||||
3 1289 7645631706369138 CMakeFiles/ConsoleMenu.dir/main.c.obj ab8c74299a2b00ff
|
||||
7 1330 7645631706762994 CMakeFiles/ConsoleMenu.dir/console_functions.c.obj c674d5c87e9aa975
|
||||
1330 1436 7645631707813025 ConsoleMenu.exe 2ef535f549c67042
|
||||
3 801 7645632393660413 CMakeFiles/ConsoleMenu.dir/main.c.obj ab8c74299a2b00ff
|
||||
801 910 7645632394701062 ConsoleMenu.exe 2ef535f549c67042
|
||||
3 945 7645638235374293 CMakeFiles/ConsoleMenu.dir/main.c.obj ab8c74299a2b00ff
|
||||
946 1056 7645638236434535 ConsoleMenu.exe 2ef535f549c67042
|
||||
3 806 7645638520031763 CMakeFiles/ConsoleMenu.dir/main.c.obj ab8c74299a2b00ff
|
||||
806 915 7645638521102466 ConsoleMenu.exe 2ef535f549c67042
|
||||
3 828 7645638830580025 CMakeFiles/ConsoleMenu.dir/main.c.obj ab8c74299a2b00ff
|
||||
828 931 7645638831608021 ConsoleMenu.exe 2ef535f549c67042
|
||||
3 873 7645641087483204 CMakeFiles/ConsoleMenu.dir/main.c.obj ab8c74299a2b00ff
|
||||
874 990 7645641088596195 ConsoleMenu.exe 2ef535f549c67042
|
||||
3 852 7645641546138714 CMakeFiles/ConsoleMenu.dir/main.c.obj ab8c74299a2b00ff
|
||||
853 965 7645641547224906 ConsoleMenu.exe 2ef535f549c67042
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,10 @@
|
||||
C:\Users\tony\AppData\Local\Programs\CLion\bin\cmake\win\x64\bin\cmake.exe -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=C:/Users/tony/AppData/Local/Programs/CLion/bin/ninja/win/x64/ninja.exe -G Ninja -S C:\Users\tony\CLionProjects\ConsoleMenu -B C:\Users\tony\CLionProjects\ConsoleMenu\cmake-build-debug
|
||||
-- Configuring done
|
||||
-- Generating done
|
||||
"C:\Program Files\CMake\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=C:/Users/tony/AppData/Local/Programs/CLion/bin/ninja/win/x64/ninja.exe -G Ninja -S C:\Users\tony\CLionProjects\ConsoleMenu -B C:\Users\tony\CLionProjects\ConsoleMenu\cmake-build-debug
|
||||
-- The C compiler identification is GNU 11.2.0
|
||||
-- Detecting C compiler ABI info
|
||||
-- Detecting C compiler ABI info - done
|
||||
-- Check for working C compiler: C:/Users/tony/AppData/Local/Programs/CLion/bin/mingw/bin/gcc.exe - skipped
|
||||
-- Detecting C compile features
|
||||
-- Detecting C compile features - done
|
||||
-- Configuring done (1.9s)
|
||||
-- Generating done (0.1s)
|
||||
-- Build files have been written to: C:/Users/tony/CLionProjects/ConsoleMenu/cmake-build-debug
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Ninja" Generator, CMake Version 3.25
|
||||
# Generated by "Ninja" Generator, CMake Version 4.0
|
||||
|
||||
# This file contains all the rules used to get the outputs files
|
||||
# built from the input files.
|
||||
@@ -14,10 +14,10 @@
|
||||
#############################################
|
||||
# Rule for compiling C files.
|
||||
|
||||
rule C_COMPILER__ConsoleMenu_Debug
|
||||
rule C_COMPILER__ConsoleMenu_unscanned_Debug
|
||||
depfile = $DEP_FILE
|
||||
deps = gcc
|
||||
command = C:\Users\tony\AppData\Local\Programs\CLion\bin\mingw\bin\gcc.exe $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in
|
||||
command = ${LAUNCHER}${CODE_CHECK}C:\Users\tony\AppData\Local\Programs\CLion\bin\mingw\bin\gcc.exe $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in
|
||||
description = Building C object $out
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ rule C_COMPILER__ConsoleMenu_Debug
|
||||
# Rule for linking C executable.
|
||||
|
||||
rule C_EXECUTABLE_LINKER__ConsoleMenu_Debug
|
||||
command = cmd.exe /C "$PRE_LINK && C:\Users\tony\AppData\Local\Programs\CLion\bin\mingw\bin\gcc.exe $FLAGS $LINK_FLAGS $in -o $TARGET_FILE -Wl,--out-implib,$TARGET_IMPLIB -Wl,--major-image-version,0,--minor-image-version,0 $LINK_PATH $LINK_LIBRARIES && $POST_BUILD"
|
||||
command = C:\WINDOWS\system32\cmd.exe /C "$PRE_LINK && C:\Users\tony\AppData\Local\Programs\CLion\bin\mingw\bin\gcc.exe $FLAGS $LINK_FLAGS $in -o $TARGET_FILE -Wl,--out-implib,$TARGET_IMPLIB -Wl,--major-image-version,0,--minor-image-version,0 $LINK_PATH $LINK_LIBRARIES && $POST_BUILD"
|
||||
description = Linking C executable $TARGET_FILE
|
||||
restat = $RESTAT
|
||||
|
||||
@@ -42,7 +42,7 @@ rule CUSTOM_COMMAND
|
||||
# Rule for re-running cmake.
|
||||
|
||||
rule RERUN_CMAKE
|
||||
command = C:\Users\tony\AppData\Local\Programs\CLion\bin\cmake\win\x64\bin\cmake.exe --regenerate-during-build -SC:\Users\tony\CLionProjects\ConsoleMenu -BC:\Users\tony\CLionProjects\ConsoleMenu\cmake-build-debug
|
||||
command = "C:\Program Files\CMake\bin\cmake.exe" --regenerate-during-build -SC:\Users\tony\CLionProjects\ConsoleMenu -BC:\Users\tony\CLionProjects\ConsoleMenu\cmake-build-debug
|
||||
description = Re-running CMake...
|
||||
generator = 1
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Start testing: Mar 24 09:01 Central Daylight Time
|
||||
Start testing: Mar 24 19:02 Central Daylight Time
|
||||
----------------------------------------------------------
|
||||
End testing: Mar 24 09:01 Central Daylight Time
|
||||
End testing: Mar 24 19:02 Central Daylight Time
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -32,18 +32,30 @@ if(NOT DEFINED CMAKE_CROSSCOMPILING)
|
||||
set(CMAKE_CROSSCOMPILING "FALSE")
|
||||
endif()
|
||||
|
||||
# Set default install directory permissions.
|
||||
# Set path to fallback-tool for dependency-resolution.
|
||||
if(NOT DEFINED CMAKE_OBJDUMP)
|
||||
set(CMAKE_OBJDUMP "C:/Users/tony/AppData/Local/Programs/CLion/bin/mingw/bin/objdump.exe")
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
|
||||
"${CMAKE_INSTALL_MANIFEST_FILES}")
|
||||
if(CMAKE_INSTALL_LOCAL_ONLY)
|
||||
file(WRITE "C:/Users/tony/CLionProjects/ConsoleMenu/cmake-build-debug/install_local_manifest.txt"
|
||||
"${CMAKE_INSTALL_MANIFEST_CONTENT}")
|
||||
endif()
|
||||
if(CMAKE_INSTALL_COMPONENT)
|
||||
if(CMAKE_INSTALL_COMPONENT MATCHES "^[a-zA-Z0-9_.+-]+$")
|
||||
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
|
||||
else()
|
||||
string(MD5 CMAKE_INST_COMP_HASH "${CMAKE_INSTALL_COMPONENT}")
|
||||
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INST_COMP_HASH}.txt")
|
||||
unset(CMAKE_INST_COMP_HASH)
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
|
||||
"${CMAKE_INSTALL_MANIFEST_FILES}")
|
||||
file(WRITE "C:/Users/tony/CLionProjects/ConsoleMenu/cmake-build-debug/${CMAKE_INSTALL_MANIFEST}"
|
||||
if(NOT CMAKE_INSTALL_LOCAL_ONLY)
|
||||
file(WRITE "C:/Users/tony/CLionProjects/ConsoleMenu/cmake-build-debug/${CMAKE_INSTALL_MANIFEST}"
|
||||
"${CMAKE_INSTALL_MANIFEST_CONTENT}")
|
||||
endif()
|
||||
|
||||
@@ -73,21 +73,29 @@ void getBufferInfo(HANDLE *hHandle, CONSOLE_SCREEN_BUFFER_INFO *pCSBI)
|
||||
}
|
||||
|
||||
void printList(HANDLE *pHConsole, DWORD *pCharsWritten, Entity *pE)
|
||||
{
|
||||
{
|
||||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
//COORD coordScreen = {0, 0};
|
||||
DWORD cCharsWritten;
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
GetConsoleScreenBufferInfo(hConsole, &csbi);
|
||||
HANDLE *bhConsole;
|
||||
bhConsole = &pHConsole;
|
||||
DWORD *bCharsWritten;
|
||||
bCharsWritten = &pCharsWritten;
|
||||
for (int counter = 0; counter < 10 ;counter++)
|
||||
for (int counter = 0; counter < 5 ;counter++)
|
||||
{
|
||||
Entity bE = pE[counter];
|
||||
if (!WriteConsoleOutputCharacter(bhConsole,
|
||||
WriteConsoleOutputCharacter(pHConsole,
|
||||
(LPCSTR) pE[counter].avatar,
|
||||
1,
|
||||
pE[counter].position,
|
||||
pCharsWritten);
|
||||
/*if (!WriteConsoleOutputCharacter(pHConsole,
|
||||
&bE.avatar,
|
||||
1,
|
||||
bE.position,
|
||||
pCharsWritten)) {
|
||||
// printf("Error: Unable to write to console. Error code: %ld\n", GetLastError());
|
||||
}
|
||||
// // printf("Error: Unable to write to console. Error code: %ld\n", GetLastError());
|
||||
}*/
|
||||
// printf("Avatar :%s",&e->avatar);
|
||||
//e = (Entity *) e->next;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
10
game.h
10
game.h
@@ -12,14 +12,14 @@
|
||||
#include "console_function.h"
|
||||
#include "player_functions.c"
|
||||
|
||||
typedef struct Game
|
||||
typedef struct ConsoleApp
|
||||
{
|
||||
int id;
|
||||
HANDLE hConsole;
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
HANDLE *hConsole;
|
||||
CONSOLE_SCREEN_BUFFER_INFO *csbi;
|
||||
DWORD *charsWritten;
|
||||
} Game;
|
||||
} ConsoleApp;
|
||||
|
||||
void gameINIT(Game *pGame);
|
||||
void consoleInit(ConsoleApp *pGame);
|
||||
|
||||
#endif //CONSOLEMENU_GAME_H
|
||||
|
||||
64
main.c
64
main.c
@@ -13,13 +13,69 @@ int randomSeed[78] = {
|
||||
int main()
|
||||
{
|
||||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
COORD coordScreen = {0, 0};
|
||||
//COORD coordScreen = {0, 0};
|
||||
DWORD cCharsWritten;
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
GetConsoleScreenBufferInfo(hConsole, &csbi);
|
||||
DWORD dwConSize;
|
||||
struct Game game = {0, GetStdHandle(STD_OUTPUT_HANDLE), csbi, &cCharsWritten};
|
||||
Game *pGame = &game;
|
||||
gameINIT(pGame);
|
||||
//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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user