aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/main.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/main.cpp b/tests/main.cpp
index 25ef012..f3ad539 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -11,12 +11,13 @@
#include <mglpp/graphics/Vertex.hpp>
#include <mglpp/graphics/Shader.hpp>
#include <mglpp/system/Clock.hpp>
+#include <mglpp/system/MemoryMappedFile.hpp>
struct Delegate {
Delegate() {}
void draw() {
- mgl::Rectangle rect(window->get_cursor_position().to_vec2f(), { 100.0f, 500.0f });
+ mgl::Rectangle rect(window->get_mouse_position().to_vec2f(), { 100.0f, 500.0f });
rect.set_color({255, 0, 0, 255});
window->draw(rect);
@@ -29,7 +30,7 @@ struct Delegate {
mgl::Text text("hello world!\nelapsed time: " + std::to_string(clock.get_elapsed_time_seconds()), { 0.0f, 0.0f }, *font);
window->draw(text);
- vertex_buffer->set_position({ window->get_cursor_position().x + 100, window->get_cursor_position().y });
+ vertex_buffer->set_position({ (float)window->get_mouse_position().x + 100, (float)window->get_mouse_position().y });
window->draw(*vertex_buffer);
}
@@ -44,16 +45,22 @@ struct Delegate {
int main(int argc, char **argv) {
mgl::Init init;
+ mgl::Window::CreateParams window_create_params;
+ window_create_params.size = { 1280, 720 };
mgl::Window window;
- if(!window.create("mglpp", 1920, 1080))
+ if(!window.create("mglpp", window_create_params))
return 1;
mgl::Texture texture;
if(!texture.load_from_file("depends/mgl/tests/X11.jpg"))
return 1;
+ mgl::MemoryMappedFile font_file;
+ if(!font_file.load("/usr/share/fonts/noto/NotoSans-Regular.ttf", mgl::MemoryMappedFile::LoadOptions{true, false}))
+ return 1;
+
mgl::Font font;
- if(!font.load_from_file("/usr/share/fonts/noto/NotoSans-Regular.ttf", 32))
+ if(!font.load_from_file(font_file, 32))
return 1;
mgl::Shader shader;