v4k-git-backup/demos/99-gui.c

38 lines
854 B
C
Raw Normal View History

2023-11-26 15:27:33 +00:00
#include "v4k.h"
int main() {
2023-11-26 16:07:33 +00:00
window_create(65.0, 0 );
2023-11-26 15:27:33 +00:00
2023-11-26 16:07:33 +00:00
gui_pushskin(gui_skinned("golden.ase", 4.0));
2023-11-26 15:27:33 +00:00
atlas_t *atlas = &C_CAST(skinned_t*, gui_userdata())->atlas;
2023-11-26 16:07:33 +00:00
vec4 pos = vec4(100,100,850,750);
2023-11-26 15:27:33 +00:00
while( window_swap() && !input(KEY_ESC) ) { // game loop
2023-11-26 16:07:33 +00:00
vec4 panel_pos = vec4(0, 0, window_width(), window_height());
2023-11-26 15:27:33 +00:00
if (ui_panel("Atlas", 0)) {
ui_atlas(atlas);
ui_panel_end();
}
if (input_down(MOUSE_R)) {
pos.x = input(MOUSE_X);
pos.y = input(MOUSE_Y);
}
if (input(MOUSE_R)) {
pos.z = input(MOUSE_X);
pos.w = input(MOUSE_Y);
}
//
2023-11-26 16:07:33 +00:00
gui_panel(panel_pos, 0);
if (gui_button(pos, 0)) {
2023-11-26 15:27:33 +00:00
printf("%s\n", "Button pressed!");
}
}
gui_popskin();
}