2023-11-26 15:27:33 +00:00
|
|
|
#include "v4k.h"
|
|
|
|
|
|
|
|
int main() {
|
2023-12-10 16:08:22 +00:00
|
|
|
window_create(75.0, 0 );
|
2023-11-26 15:27:33 +00:00
|
|
|
|
2023-12-10 16:08:22 +00:00
|
|
|
gui_pushskin(gui_skinned("golden.ase", 3.0f)); // x3 scale
|
|
|
|
skinned_t *skinned = (skinned_t*)gui_userdata();
|
2023-11-26 15:27:33 +00:00
|
|
|
|
2023-11-26 19:03:38 +00:00
|
|
|
vec4 pos = vec4(400,400,100, 30);
|
2023-11-26 15:27:33 +00:00
|
|
|
|
2023-11-28 13:31:56 +00:00
|
|
|
float testval=7.5f;
|
|
|
|
float testval2=7.5f;
|
|
|
|
|
2023-11-26 15:27:33 +00:00
|
|
|
while( window_swap() && !input(KEY_ESC) ) { // game loop
|
2023-12-10 16:08:22 +00:00
|
|
|
|
2023-11-26 15:27:33 +00:00
|
|
|
if (ui_panel("Atlas", 0)) {
|
2023-11-26 19:03:38 +00:00
|
|
|
ui_atlas(&skinned->atlas);
|
|
|
|
ui_panel_end();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ui_panel("GUI", 0)) {
|
|
|
|
ui_float("Scale", &skinned->scale);
|
|
|
|
|
2023-11-26 15:27:33 +00:00
|
|
|
ui_panel_end();
|
|
|
|
}
|
|
|
|
|
2023-12-10 16:08:22 +00:00
|
|
|
if (ui_panel("Fonts", 0)) {
|
|
|
|
ui_font();
|
|
|
|
|
|
|
|
ui_panel_end();
|
|
|
|
}
|
|
|
|
|
2023-11-26 15:27:33 +00:00
|
|
|
if (input_down(MOUSE_R)) {
|
|
|
|
pos.x = input(MOUSE_X);
|
|
|
|
pos.y = input(MOUSE_Y);
|
|
|
|
}
|
|
|
|
if (input(MOUSE_R)) {
|
2023-11-26 19:03:38 +00:00
|
|
|
pos.z = input(MOUSE_X)-pos.x;
|
|
|
|
pos.w = input(MOUSE_Y)-pos.y;
|
2023-11-26 15:27:33 +00:00
|
|
|
}
|
|
|
|
|
2023-12-10 16:08:22 +00:00
|
|
|
// font
|
|
|
|
do_once font_face(FONT_FACE2, "lilita_one_regular.ttf", 48.0f, FONT_EU | FONT_2048);
|
|
|
|
do_once font_color(FONT_COLOR9, WHITE);
|
|
|
|
font_print(va(FONT_MIDDLE FONT_CENTER FONT_FACE2 FONT_COLOR9 "%s", "Hello"));
|
|
|
|
|
|
|
|
// background
|
|
|
|
vec4 panel_pos = vec4(0, 0, window_width(), window_height());
|
2023-11-28 13:31:56 +00:00
|
|
|
gui_panel(panel_pos, "panel");
|
2023-12-10 16:08:22 +00:00
|
|
|
|
|
|
|
// button
|
|
|
|
if (gui_button_label(FONT_FACE2 "PRESS", pos, 0)) {
|
2023-11-28 13:31:56 +00:00
|
|
|
printf("%s\n", "Button pressed!");
|
|
|
|
}
|
|
|
|
|
2023-12-10 16:08:22 +00:00
|
|
|
// vials
|
2023-11-28 13:31:56 +00:00
|
|
|
gui_rect(vec4(40,140, 320, 20*skinned->scale), "vial");
|
|
|
|
gui_rect(vec4(40,140, 200, 14*skinned->scale), "hp");
|
|
|
|
gui_rect(vec4(40,240, 240, 20*skinned->scale), "vial");
|
|
|
|
gui_rect(vec4(40,240, 160, 14*skinned->scale), "mp");
|
|
|
|
|
2023-12-10 16:08:22 +00:00
|
|
|
// buttons
|
|
|
|
vec2 badge_size = gui_getskinsize("badge", NULL);
|
2023-11-28 13:31:56 +00:00
|
|
|
badge_size.x += 2; // padding
|
|
|
|
gui_rect(vec4(60+badge_size.x*0,320, 1, 1), "badge");
|
|
|
|
gui_rect(vec4(60+badge_size.x*1,320, 1, 1), "badge");
|
|
|
|
gui_rect(vec4(60+badge_size.x*2,320, 1, 1), "badge_empty");
|
|
|
|
|
2023-12-10 16:08:22 +00:00
|
|
|
// sliders
|
|
|
|
vec2 slider_size = gui_getskinsize("slider", NULL);
|
|
|
|
gui_slider(vec4(60, 420, 80*skinned->scale, 1), 0, 0.0f, 15.0f, 1.0f, &testval);
|
|
|
|
gui_slider_label(va(FONT_FACE2 "%.02f", testval2), vec4(60, 420+slider_size.y+10, 120*skinned->scale, 1), 0, -5.0f, 20.0f, 0.0f, &testval2);
|
2023-11-28 13:31:56 +00:00
|
|
|
gui_panel_end();
|
2023-11-26 15:27:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gui_popskin();
|
|
|
|
}
|