jak-project/game/graphics/gfx.h
ManDude 9430b4772a
Implement runtime display (test) (#318)
* Implement runtime display (test)

* Update runtime.cpp

* [game display] add "-nodisplay" argument

* style fixes

* Update gfx.cpp

* [deci2server] fix deadlock when killing a Deci2Server

* add libxrandr to linux github test

* correct package name to libxrandr-dev

* set g_main_thread_id in exec_runtime

* add libxinerama to linux test packages

* correct the name

* add libxcursor1 package

* Update linux-workflow.yaml

* add libxi-dev

* fix constructor for g_main_thread_id

* fix submodules + use -nodisplay during tests

* move the gfx loop to its own function and use a lambda for exit conditions

* fix include

* fix include

* fix includes (for real this time)
2021-03-09 23:51:28 -05:00

48 lines
904 B
C++

#pragma once
/*!
* @file gfx.h
* Graphics component for the runtime. Handles some low-level routines.
*/
#ifndef RUNTIME_GFX_H
#define RUNTIME_GFX_H
#include "common/common_types.h"
#include "display.h"
#include "game/kernel/kboot.h"
namespace Gfx {
u32 Init();
u32 Exit();
template <typename T>
void Loop(T f) {
while (f()) {
// run display-specific things
if (Display::display) {
// lg::debug("run display");
glfwMakeContextCurrent(Display::display);
// render graphics
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(Display::display);
// poll events TODO integrate input with cpad
glfwPollEvents();
// exit if display window was closed
if (glfwWindowShouldClose(Display::display)) {
// Display::KillDisplay(Display::display);
MasterExit = 1;
}
}
}
}
} // namespace Gfx
#endif // RUNTIME_GFX_H