Files
jak-project/game/graphics/display.h
T
ManDude 9ff71412e5 [runtime] pckernel implementation (#1032)
* toggle for ripping level models

* Create pckernel.gc

* builds and works

* fix defs

* resolution info works

* native letterboxing

* menu

* Fullscreen buttons

* Update glfw

* fix fullscreen taking over everything for some reason

* fix screenshots and add more menu options

* Cleanup DMA mess in load boundary render code (first try!!)

* Update default-menu.gc

* clang

* fix accidental macros in pairs

* refs

* fix null reference bugs

* add lavatube

* custom aspect ratios work (3D only)

* custom aspect ratios work (3D only)

* fix aspect ratio and non-4x3 debug text

* change `sceOpen`

* deadzone setting

* merge fixes

* check out `debug-pad-display`

* update readme imgs

* settings save works

* oops

* settings read/load (incomplete)

* add `:stop` to debugger and fix detach on Windows

* settings load works

* fullscreen and aspect ratio setting fixes

* swap menu options for convenience

* settings loads automatically properly

* fix panic and font hack edge case

* add rolling, ogre, snow, swamp, sunken b, jungle b

* Fixed borderless on windows please work

* Update fake_iso.txt

* remove error from opengl debug filter

* update refs

* minor tfrag tod palette lookup change

* accidentally nuked all opengl errors
2021-12-30 18:48:37 -05:00

92 lines
2.7 KiB
C++

#pragma once
/*!
* @file display.h
* Display for graphics. This is the game window, distinct from the runtime console.
*/
#include "pipelines/opengl.h"
#include "gfx.h"
#include <vector>
#include <memory>
// a GfxDisplay class is equivalent to a window that displays stuff. This holds an actual internal
// window pointer used by whichever renderer. It also contains functions for setting and
// retrieving certain window parameters.
class GfxDisplay {
const char* m_title;
const GfxRendererModule* m_renderer = nullptr;
// NOT actual size! just backups
int m_width;
int m_height;
// same here
int m_xpos;
int m_ypos;
bool m_update_fullscreen = false;
int m_fullscreen_mode = 0;
int m_fullscreen_screen;
int m_fullscreen_target_mode;
int m_fullscreen_target_screen;
public:
GfxDisplay(GLFWwindow* a_window); // OpenGL window constructor
~GfxDisplay(); // destructor - this calls the renderer's function for getting rid of a window,
// and we can then get rid of the GfxDisplay itself
// all kinds of windows for the display
union {
void* window_generic_ptr = nullptr;
GLFWwindow* window_glfw;
};
bool is_active() const { return window_generic_ptr != nullptr; }
void set_renderer(GfxPipeline pipeline);
void set_window(GLFWwindow* window);
void set_title(const char* title);
void set_size(int w, int h);
void get_scale(float* w, float* h);
const char* title() const { return m_title; }
bool fullscreen_pending() { return m_update_fullscreen; }
void fullscreen_flush() {
m_renderer->set_fullscreen(this, m_fullscreen_target_mode, m_fullscreen_target_screen);
m_fullscreen_mode = m_fullscreen_target_mode;
m_fullscreen_screen = m_fullscreen_target_screen;
m_update_fullscreen = false;
}
void set_fullscreen(int mode, int screen) {
m_fullscreen_target_mode = mode;
m_fullscreen_target_screen = screen;
m_update_fullscreen = true;
}
int fullscreen_mode() { return m_fullscreen_mode; }
int fullscreen_screen() { return m_fullscreen_screen; }
void backup_params();
int width_backup() { return m_width; }
int height_backup() { return m_height; }
int xpos_backup() { return m_xpos; }
int ypos_backup() { return m_ypos; }
int width();
int height();
void render_graphics();
};
namespace Display {
// a list of displays. the first one is the "main" display, all others are spectator-like extra
// views.
extern std::vector<std::shared_ptr<GfxDisplay>> g_displays;
int InitMainDisplay(int width, int height, const char* title, GfxSettings& settings);
void KillDisplay(std::shared_ptr<GfxDisplay> display);
void KillMainDisplay();
std::shared_ptr<GfxDisplay> GetMainDisplay();
} // namespace Display