add GUI_PANEL render branch
parent
46b82d5645
commit
071d73dbe2
|
@ -1,16 +1,16 @@
|
|||
#include "v4k.h"
|
||||
|
||||
int main() {
|
||||
window_create(75.0, 0); // 75% size, no extra flags
|
||||
window_create(65.0, 0 );
|
||||
|
||||
font_face(FONT_FACE2, "lilita_one_regular.ttf", 32.0f, FONT_EU | FONT_2048);
|
||||
|
||||
gui_pushskin(gui_skinned("golden.ase", 1.0f));
|
||||
gui_pushskin(gui_skinned("golden.ase", 4.0));
|
||||
atlas_t *atlas = &C_CAST(skinned_t*, gui_userdata())->atlas;
|
||||
|
||||
vec4 pos = vec4(100,100,350,300);
|
||||
vec4 pos = vec4(100,100,850,750);
|
||||
|
||||
while( window_swap() && !input(KEY_ESC) ) { // game loop
|
||||
vec4 panel_pos = vec4(0, 0, window_width(), window_height());
|
||||
|
||||
if (ui_panel("Atlas", 0)) {
|
||||
ui_atlas(atlas);
|
||||
ui_panel_end();
|
||||
|
@ -26,12 +26,11 @@ int main() {
|
|||
}
|
||||
|
||||
//
|
||||
if (gui_button(pos, "button")) {
|
||||
|
||||
gui_panel(panel_pos, 0);
|
||||
if (gui_button(pos, 0)) {
|
||||
printf("%s\n", "Button pressed!");
|
||||
}
|
||||
|
||||
font_color(FONT_COLOR9, WHITE);
|
||||
font_print(va(FONT_MIDDLE FONT_CENTER FONT_FACE2 FONT_COLOR9 "%s", "Hello"));
|
||||
}
|
||||
|
||||
gui_popskin();
|
||||
|
|
Binary file not shown.
|
@ -359125,6 +359125,12 @@ void skinned_draw_rect(void* userdata, gui_state_t state, const char *skin, vec4
|
|||
if (!f) skinned_draw_missing_rect(r);
|
||||
else skinned_draw_sprite(a->scale, &a->atlas, f, r);
|
||||
} break;
|
||||
|
||||
case GUI_PANEL: {
|
||||
atlas_slice_frame_t *f = skinned_getsliceframe(&a->atlas, skin?skin:a->panel, "");
|
||||
if (!f) skinned_draw_missing_rect(r);
|
||||
else skinned_draw_sprite(a->scale, &a->atlas, f, r);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -371195,10 +371201,6 @@ atlas_t atlas_create(const char *inifile, unsigned flags) {
|
|||
f->bounds.y += padding+border;
|
||||
f->bounds.z += padding+border;
|
||||
f->bounds.w += padding+border;
|
||||
// f->core.x += f->bounds.x;
|
||||
// f->core.y += f->bounds.y;
|
||||
// f->core.z += f->bounds.x;
|
||||
// f->core.w += f->bounds.y;
|
||||
}
|
||||
#if 0
|
||||
// post-process: specify an anchor for each anim based on 1st frame dims
|
||||
|
|
|
@ -275,6 +275,12 @@ void skinned_draw_rect(void* userdata, gui_state_t state, const char *skin, vec4
|
|||
if (!f) skinned_draw_missing_rect(r);
|
||||
else skinned_draw_sprite(a->scale, &a->atlas, f, r);
|
||||
} break;
|
||||
|
||||
case GUI_PANEL: {
|
||||
atlas_slice_frame_t *f = skinned_getsliceframe(&a->atlas, skin?skin:a->panel, "");
|
||||
if (!f) skinned_draw_missing_rect(r);
|
||||
else skinned_draw_sprite(a->scale, &a->atlas, f, r);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1371,10 +1371,6 @@ atlas_t atlas_create(const char *inifile, unsigned flags) {
|
|||
f->bounds.y += padding+border;
|
||||
f->bounds.z += padding+border;
|
||||
f->bounds.w += padding+border;
|
||||
// f->core.x += f->bounds.x;
|
||||
// f->core.y += f->bounds.y;
|
||||
// f->core.z += f->bounds.x;
|
||||
// f->core.w += f->bounds.y;
|
||||
}
|
||||
#if 0
|
||||
// post-process: specify an anchor for each anim based on 1st frame dims
|
||||
|
|
10
engine/v4k.c
10
engine/v4k.c
|
@ -11281,6 +11281,12 @@ void skinned_draw_rect(void* userdata, gui_state_t state, const char *skin, vec4
|
|||
if (!f) skinned_draw_missing_rect(r);
|
||||
else skinned_draw_sprite(a->scale, &a->atlas, f, r);
|
||||
} break;
|
||||
|
||||
case GUI_PANEL: {
|
||||
atlas_slice_frame_t *f = skinned_getsliceframe(&a->atlas, skin?skin:a->panel, "");
|
||||
if (!f) skinned_draw_missing_rect(r);
|
||||
else skinned_draw_sprite(a->scale, &a->atlas, f, r);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23351,10 +23357,6 @@ atlas_t atlas_create(const char *inifile, unsigned flags) {
|
|||
f->bounds.y += padding+border;
|
||||
f->bounds.z += padding+border;
|
||||
f->bounds.w += padding+border;
|
||||
// f->core.x += f->bounds.x;
|
||||
// f->core.y += f->bounds.y;
|
||||
// f->core.z += f->bounds.x;
|
||||
// f->core.w += f->bounds.y;
|
||||
}
|
||||
#if 0
|
||||
// post-process: specify an anchor for each anim based on 1st frame dims
|
||||
|
|
Loading…
Reference in New Issue