1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- /*
- * 2D Physic Engine
- * app.cpp: basic application handling.
- * Based on pikuma.com Learn Game Physics Engine Programming course.
- * Copyright (c) 2022 986-Studio. All rights reserved.
- *
- * Created by Manoël Trapier on 07/06/2022.
- */
- #include <app.h>
- #include <graphics.h>
- #include <imgui.h>
- #include <imgui_sdl.h>
- #include <imgui_impl_sdl.h>
- void application::parseParameters(int argc, char *argv[])
- {
- // Nothing to do for now
- }
- void application::setup()
- {
- running = graphics::openWindow();
- }
- void application::input()
- {
- SDL_Event event;
- while(SDL_PollEvent(&event))
- {
- //ImGui_ImplSDL2_ProcessEvent(&event);
- //ImGuiIO &io = ImGui::GetIO();
- switch(event.type)
- {
- case SDL_QUIT:
- running = false;
- break;
- case SDL_KEYDOWN:
- if (event.key.keysym.sym == SDLK_ESCAPE)
- {
- running = false;
- }
- break;
- }
- }
- }
- void application::update()
- {
- // Nothing for now.
- }
- void application::render()
- {
- graphics::clearScreen(0xFF056263);
- graphics::draw::fillCircle(200, 200, 40, 0xFFFFFFFF);
- graphics::draw::text(10, 10, graphics::makeColour(255, 12, 98), "Hello world!");
- graphics::renderFrame();
- }
- void application::destroy()
- {
- // Nothing for now.
- graphics::closeWindow();
- }
|