diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/main.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/tests/main.c b/tests/main.c index 3ec5738..e3d199c 100644 --- a/tests/main.c +++ b/tests/main.c @@ -40,7 +40,7 @@ static void draw(mgl_window *window, void *userdata) { mgl_sprite sprite; mgl_sprite_init(&sprite, u->texture); - mgl_sprite_set_position(&sprite, (mgl_vec2f){ 100.0f - 10.0f + u->texture->width * 0.5f * 2.0f, u->texture->height * 0.5f * 2.0f }); + mgl_sprite_set_position(&sprite, (mgl_vec2f){ 500.0f - 10.0f + u->texture->width * 0.5f * 2.0f, 500.0f + u->texture->height * 0.5f * 2.0f }); mgl_sprite_set_color(&sprite, (mgl_color){255, 255, 255, 128}); mgl_sprite_set_rotation(&sprite, rot); mgl_sprite_set_origin(&sprite, (mgl_vec2f){ u->texture->width * 0.5f, u->texture->height * 0.5f }); @@ -62,7 +62,15 @@ static void draw(mgl_window *window, void *userdata) { mgl_text text; mgl_text_init(&text, u->font, str, strlen(str)); mgl_text_set_max_width(&text, 200.0f); - mgl_text_set_max_rows(&text, 5); + //mgl_text_set_max_rows(&text, 5); + { + mgl_rectangle text_bg = { + .position = text.position, + .size = mgl_text_get_bounds(&text), + .color = { 255, 0, 0, 255 }, + }; + mgl_rectangle_draw(context, &text_bg); + } mgl_text_draw(context, &text); mgl_text_deinit(&text); @@ -226,7 +234,7 @@ int main(void) { test_hash_map(); test_utf8(); - if(mgl_init() != 0) + if(mgl_init(MGL_WINDOW_SYSTEM_X11) != 0) return 1; mgl_texture texture; @@ -254,7 +262,7 @@ int main(void) { if(mgl_texture_init(&texture) != 0) return 1; - if(mgl_texture_load_from_file(&texture, "tests/X11.jpg", &(mgl_texture_load_options){ .compressed = false, .pixel_coordinates = false, .mipmap = false }) != 0) + if(mgl_texture_load_from_file(&texture, "tests/X11.jpg", &(mgl_texture_load_options){ .compressed = false, .pixel_coordinates = false, .scale_type = MGL_TEXTURE_SCALE_LINEAR }) != 0) return 1; if(mgl_mapped_file_load("/usr/share/fonts/TTF/Hack-Regular.ttf", &font_file, &(mgl_memory_mapped_file_load_options){ .readable = true, .writable = false }) != 0) @@ -313,6 +321,18 @@ int main(void) { fprintf(stderr, "key release event, code: %u\n", event.key.code); break; } + case MGL_EVENT_MONITOR_PROPERTY_CHANGED: { + fprintf(stderr, "monitor property changed\n"); + break; + } + case MGL_EVENT_MONITOR_CONNECTED: { + fprintf(stderr, "monitor connected\n"); + break; + } + case MGL_EVENT_MONITOR_DISCONNECTED: { + fprintf(stderr, "monitor disconnected\n"); + break; + } } } |