From cb79147e5013925102511d03fed1d98ecc81bbed Mon Sep 17 00:00:00 2001 From: snakert12345 Date: Fri, 4 Apr 2025 13:41:09 -0400 Subject: [PATCH] Delete YuppleMayham/src/gameplay/' --- YuppleMayham/src/gameplay/' | 134 ------------------------------------ 1 file changed, 134 deletions(-) delete mode 100644 YuppleMayham/src/gameplay/' diff --git a/YuppleMayham/src/gameplay/' b/YuppleMayham/src/gameplay/' deleted file mode 100644 index 3fc7ecd..0000000 --- a/YuppleMayham/src/gameplay/' +++ /dev/null @@ -1,134 +0,0 @@ -#include "gameplay/game.h" -#include "gameplay/input.h" -#include "gameplay/scene.h" -/*due for possible removal!*/ -#include "gameplay/gameactor.h" -#include "gameplay/weapons/weapon.h" -/*-------------------------*/ - -#include "utility/command.h" -#include "utility/resourcemanager.h" -#include "utility/ftfont.h" -#include "utility/logger.h" - -#include "graphics/glwindow.h" - -#include "sound/engine.h" - -#include -#include -#include - -bool Game::init() -{ - window = std::make_shared("Yupple Mayham", 800, 600); - - if (!window->Init()) - ERROR_LOG("Failed to init GLWindow: {}", SDL_GetError()); - - if (!gladLoadGLLoader((GLADloadproc)SDL_GL_GetProcAddress)) - ERROR_LOG("Failed to load GLLoader", NULL); - -#if _DEBUG - LOG_LEVEL(DEBUG); -#else - LOG_LEVEL(INFO); -#endif - - SDL_GL_SetSwapInterval(1); - glViewport(0, 0, window->width(), window->height()); - glDisable(GL_DEPTH_TEST); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - // For now we'll init default bindings, but as we move forward controls will be set by the player and saved in controls.xml - inputHandler = std::make_shared(); - inputHandler->bindKeyCommand(SDLK_w, 0, new MoveUpCommand()); - inputHandler->bindKeyCommand(SDLK_a, 0, new MoveLeftCommand()); - inputHandler->bindKeyCommand(SDLK_s, 0, new MoveDownCommand()); - inputHandler->bindKeyCommand(SDLK_d, 0, new MoveRightCommand()); - - inputHandler->bindMouseCommand(MOUSE_BUTTON_LEFT, 100, new ShootCommand()); - inputHandler->bindMouseMotion(new FollowMouseCommand()); - inputHandler->bindMouseScroll(new CycleCommand()); - - game_state |= GAME_RUNNING; - globalEventManager = std::make_shared(); - resourceManager = std::make_shared(); - renderer = std::make_shared(resourceManager); - audioEngine = std::make_shared(resourceManager); - audioEngine->hookEventManager(globalEventManager); - /* Testing */ - audioEngine->pushMusic("music/short_song.ogg"); - audioEngine->pushMusic("music/bright.ogg"); - audioEngine->pushMusic("music/main_song.ogg"); - audioEngine->playMusic(); - /* */ - renderer->hookEventManager(globalEventManager); - textHandler = std::make_shared(); - if (!textHandler->loadFonts("fonts")) - return false; - return true; -} - -const unsigned Game::getWindowWidth() const { return window->width(); } -const unsigned Game::getWindowHeight() const { return window->height(); } - -bool Game::loadDebugScene() -{ - currentScene = std::make_shared(SCENE_SHOOTER, resourceManager, globalEventManager); - currentScene->init(); - audioEngine->hookSceneManager(currentScene->getEventManager()); - if (currentScene->getPlayer() == nullptr) - return false; - inputHandler->setActor(currentScene->getPlayer().get()); - return true; -} - -void Game::captureInput(SDL_Event& e) -{ - inputHandler->captureInput(e); -} - -void Game::executeInputs() -{ - inputHandler->handleInput(); - inputHandler->executeCommands(); -} - -void Game::update(double deltaTime) -{ - if (currentScene) - currentScene->update(deltaTime); - audioEngine->poll(); -} - -void Game::render() -{ - glClearColor(0.05f, 0.25f, 0.05f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - - if (currentScene) - { - currentScene->render(renderer); - /*Debug ammo indicator*/ - textHandler->DrawText("comic.ttf", std::to_string(currentScene->getPlayer()->getHeldWeapon()->getMagazine()), glm::vec2(10, 10), 0.5f); - textHandler->DrawText("comic.ttf", "/", glm::vec2(50, 10), 0.5f); - textHandler->DrawText("comic.ttf", std::to_string(currentScene->getPlayer()->getHeldWeapon()->getAmmo()), glm::vec2(90, 10), 0.5f); - } - - window->swap(); -} - -void Game::quit() -{ - game_state = GAME_QUITTING; -} - -Game::~Game() -{ - if (audioEngine) { - audioEngine->killMusic(); - } - resourceManager->clearResources(); -}