From 8635d4b8536e0d8f161e7781ae3329f55877e06f Mon Sep 17 00:00:00 2001 From: zulianc Date: Sun, 23 Mar 2025 00:16:59 +0100 Subject: [PATCH] abandon --- src/GraphicalUI/AppMenus/InGameAppMenu.cpp | 1 + src/GraphicalUI/GraphApp.cpp | 1 + src/GraphicalUI/Keybinds.cpp | 8 ++++++-- src/GraphicalUI/Settings.cpp | 20 ++++++++++++-------- src/GraphicalUI/main.cpp | 2 +- src/TextUI/TextApp.cpp | 2 +- 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/GraphicalUI/AppMenus/InGameAppMenu.cpp b/src/GraphicalUI/AppMenus/InGameAppMenu.cpp index fc14b08..0c4057e 100644 --- a/src/GraphicalUI/AppMenus/InGameAppMenu.cpp +++ b/src/GraphicalUI/AppMenus/InGameAppMenu.cpp @@ -12,6 +12,7 @@ InGameAppMenu::InGameAppMenu(std::shared_ptr menuStack, std::shared_p game(this->settings->getMenu().startGame(this->settings->getGamemode())) { + this->game.start(); this->paused = false; } diff --git a/src/GraphicalUI/GraphApp.cpp b/src/GraphicalUI/GraphApp.cpp index d134026..fbfde52 100644 --- a/src/GraphicalUI/GraphApp.cpp +++ b/src/GraphicalUI/GraphApp.cpp @@ -19,6 +19,7 @@ GraphApp::GraphApp() { void GraphApp::run() { changeVideoMode(*this->renderWindow, this->settings->getVideoMode()); + std::cout << renderWindow->getSize().x << " " << renderWindow->getSize().y << std::endl; this->menuStack->push(std::make_shared(this->menuStack, this->settings, this->renderWindow)); bool quit = false; diff --git a/src/GraphicalUI/Keybinds.cpp b/src/GraphicalUI/Keybinds.cpp index 9b6ac5c..f9e9f2a 100644 --- a/src/GraphicalUI/Keybinds.cpp +++ b/src/GraphicalUI/Keybinds.cpp @@ -26,11 +26,15 @@ void Keybinds::loadKeybindsFromFile() { } char byte; - while (layoutFile.get(&byte, 1)) { + while (layoutFile.get(byte)) { + if (layoutFile.eof()) break; + Action action = Action(byte); do { - layoutFile.get(&byte, 1); + layoutFile.get(byte); + if (layoutFile.eof()) break; + if (byte != 0xFF) { this->keybinds.at(action).insert(sfKey(byte)); } diff --git a/src/GraphicalUI/Settings.cpp b/src/GraphicalUI/Settings.cpp index 7b1f9c7..ccbe65e 100644 --- a/src/GraphicalUI/Settings.cpp +++ b/src/GraphicalUI/Settings.cpp @@ -29,35 +29,39 @@ void Settings::loadSettingsFromFile() { char byte; // keybind layout - settingsFile.get(&byte, 1); + settingsFile.get(byte); this->chosenKeybinds = byte; // window size mode - settingsFile.get(&byte, 1); + settingsFile.get(byte); + std::cout << (int) byte; this->windowSizeMode = byte; // gamemode - settingsFile.get(&byte, 1); + settingsFile.get(byte); this->gamemode = Gamemode(byte); // board width - settingsFile.get(&byte, 1); + settingsFile.get(byte); + std::cout << (int) byte; this->menu.setBoardWidth(byte); // board height - settingsFile.get(&byte, 1); + settingsFile.get(byte); this->menu.setBoardHeight(byte); // piece distribution - settingsFile.get(&byte, 1); + settingsFile.get(byte); //TODO // selected pieces char pieceType; char pieceValue; this->selectedPieces.clear(); - while (settingsFile.get(&pieceType, 1)) { - settingsFile.get(&pieceValue, 1); + while (settingsFile.get(pieceType)) { + if (settingsFile.eof()) break; + + settingsFile.get(pieceValue); this->selectedPieces.push_back({PiecesType(pieceType), pieceValue}); } } diff --git a/src/GraphicalUI/main.cpp b/src/GraphicalUI/main.cpp index f238f6f..0f7b8e0 100644 --- a/src/GraphicalUI/main.cpp +++ b/src/GraphicalUI/main.cpp @@ -30,7 +30,7 @@ int main() { } // before compiling release version - //resetConfigFiles(); + resetConfigFiles(); GraphApp UI; UI.run(); diff --git a/src/TextUI/TextApp.cpp b/src/TextUI/TextApp.cpp index 80ce0d8..542a887 100644 --- a/src/TextUI/TextApp.cpp +++ b/src/TextUI/TextApp.cpp @@ -58,7 +58,7 @@ void TextApp::run() { default : std::cout << "Invalid answer!" << std::endl; } } - std::cout << "===| SEE YA NEXT TIME! |==="; + std::cout << "===| SEE YA NEXT TIME! |===" << std::endl; } void TextApp::choosePieces() {