// // GameAdaptor.cxx // danmaku // // Created by Sam Jaffe on 5/22/19. // Copyright © 2019 Sam Jaffe. All rights reserved. // #include "GameAdaptor.h" //#include "game/graphics/renderer.hpp" #include "game/util/time.hpp" #include "game/util/env.hpp" #include "game/math/math_fwd.hpp" #include "vector/vector.hpp" //#include "Engine/Utilities/Logger.hpp" //#include "Game/TheGame.hpp" #include "GameAdaptor.h" void init_gl() { // Renderer::GetInstance().Clear(); } void draw_screen() { static engine::timestamp lastTime = engine::clock::now(); engine::timestamp now = engine::clock::now(); std::chrono::duration delta(now - lastTime); // Logger::Instance().debugf("RTick: %f", now - lastTime); // TheGame::GetInstance().Render(); lastTime = now; } namespace env { namespace detail { extern void resize_screen(math::vec2i const&); } } void screen_resize(int width, int height) { env::detail::resize_screen(make_vector(width, height)); } // flags: // alnum: 0x00000100 // arrow: 0x00a00000 // ?ANY: 0x00000100 // CTRL: 0x00040001 // LSHIFT:0x00020002 // RSHIFT:0x00020004 // LCMD: 0x00100008 // RCMD: 0x00100010 // LALT: 0x00080020 // RALT: 0x00080040 // FN: 0x00800000 void key_down(unsigned short key) { // TheGame::GetInstance().KeyPressEvent(key); } void key_up(unsigned short key) { // TheGame::GetInstance().KeyReleaseEvent(key); } void game_deactivate() { // Env::StopClock(); } void game_activate() { // Env::StartClock(); } void run_game() { static engine::timestamp lastTime = engine::clock::now(); engine::timestamp now = engine::clock::now(); std::chrono::duration delta(now - lastTime); // Logger::Instance().debugf("UTick: %f", now - lastTime); // TheGame::GetInstance().Update(now - lastTime); lastTime = now; }