#include "GameEngine.h" #include "MenuScene.h" #include "UITestScene.h" #include "ActionCode.h" #include "McRFPy_API.h" #include "PythonScene.h" GameEngine::GameEngine() { font.loadFromFile("./assets/JetbrainsMono.ttf"); window.create(sf::VideoMode(1024, 768), "McRogueFace Engine by John McCardle"); visible = window.getDefaultView(); window.setFramerateLimit(30); scene = "py"; //std::cout << "Constructing MenuScene" << std::endl; scenes["menu"] = new MenuScene(this); //std::cout << "Constructed MenuScene" <update(); sUserInput(); if (!paused) { } currentScene()->sRender(); currentFrame++; } } void GameEngine::sUserInput() { sf::Event event; while (window.pollEvent(event)) { std::string actionType; int actionCode = 0; if (event.type == sf::Event::Closed) { running = false; continue; } else if (event.type == sf::Event::Resized) { sf::FloatRect area(0.f, 0.f, event.size.width, event.size.height); visible = sf::View(area); window.setView(visible); std::cout << "Visible area set to (0, 0, " << event.size.width << ", " << event.size.height <<")"< " << (actionCode && ActionCode::WHEEL_NEG) << "; actionCode && WHEEL_DEL -> " << (actionCode && ActionCode::WHEEL_DEL) << ";" << std::endl; */ } // float d = event.MouseWheelScrollEvent.delta; // actionCode = ActionCode::keycode(0, d); } else continue; //std::cout << "Event produced action code " << actionCode << ": " << actionType << std::endl; if (currentScene()->hasAction(actionCode)) { std::string name = currentScene()->action(actionCode); currentScene()->doAction(name, actionType); } else { std::cout << "[GameEngine] Action not registered for input: " << actionCode << ": " << actionType << std::endl; } } }