git.ucc.asn.au
/
ipdf
/
code.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Animation of precision_vs_zoom
[ipdf/code.git]
/
src
/
screen.cpp
diff --git
a/src/screen.cpp
b/src/screen.cpp
index
f075684
..
7054fc7
100644
(file)
--- a/
src/screen.cpp
+++ b/
src/screen.cpp
@@
-24,12
+24,16
@@
static void opengl_debug_callback(GLenum source, GLenum type, GLuint id, GLenum
}
}
-Screen::Screen()
+Screen::Screen(
bool visible
)
{
SDL_Init(SDL_INIT_VIDEO);
{
SDL_Init(SDL_INIT_VIDEO);
+ uint32_t flags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE;
+ if (!visible)
+ flags |= SDL_WINDOW_HIDDEN;
+
m_window = SDL_CreateWindow("IPDF", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
m_window = SDL_CreateWindow("IPDF", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
- 800, 600,
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE
);
+ 800, 600,
flags
);
if (!m_window)
{
if (!m_window)
{
@@
-92,10
+96,13
@@
Screen::Screen()
m_viewport_ubo.SetType(GraphicsBuffer::BufferTypeUniform);
m_debug_font_atlas = 0;
m_viewport_ubo.SetType(GraphicsBuffer::BufferTypeUniform);
m_debug_font_atlas = 0;
-
+ m_no_quit_requested = true;
+ m_show_debug_font = true;
m_view = NULL;
ResizeViewport(800, 600);
m_view = NULL;
ResizeViewport(800, 600);
-
+
+
+
Clear();
Present();
Clear();
Present();
@@
-128,13
+135,13
@@
void Screen::ResizeViewport(int width, int height)
bool Screen::PumpEvents()
{
SDL_Event evt;
bool Screen::PumpEvents()
{
SDL_Event evt;
- bool no_quit_requested = true;
+
while (SDL_PollEvent(&evt))
{
switch (evt.type)
{
case SDL_QUIT:
while (SDL_PollEvent(&evt))
{
switch (evt.type)
{
case SDL_QUIT:
- no_quit_requested = false;
+
m_
no_quit_requested = false;
break;
case SDL_WINDOWEVENT:
switch (evt.window.event)
break;
case SDL_WINDOWEVENT:
switch (evt.window.event)
@@
-183,7
+190,7
@@
bool Screen::PumpEvents()
break;
}
}
break;
}
}
- return no_quit_requested;
+ return
m_
no_quit_requested;
}
void Screen::SetMouseCursor(Screen::MouseCursors cursor)
}
void Screen::SetMouseCursor(Screen::MouseCursors cursor)
@@
-454,7
+461,7
@@
struct fontvertex
void Screen::DebugFontPrint(const char* str)
{
void Screen::DebugFontPrint(const char* str)
{
- if (!m_debug_font_atlas) return;
+ if (!m_debug_font_atlas
|| !m_show_debug_font
) return;
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 41, -1, "Screen::DebugFontPrint()");
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 41, -1, "Screen::DebugFontPrint()");
UCC
git Repository :: git.ucc.asn.au