Skip to content

Commit

Permalink
code cleanup in imgui-images-sapp and nuklear-images-sapp
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed Jul 25, 2023
1 parent 08a6405 commit 9395769
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
9 changes: 4 additions & 5 deletions sapp/imgui-images-sapp.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,17 +179,16 @@ static void frame(void) {
});
igSetNextWindowPos((ImVec2){20, 20}, ImGuiCond_Once, (ImVec2){0, 0});
igSetNextWindowSize((ImVec2){540, 560}, ImGuiCond_Once);
if (igBegin("Dear ImGui with sokol-gfx images and samplers", 0, 0)) {
if (igBegin("Sokol + Dear ImGui Image Test", 0, 0)) {
const ImVec4 white = { 1, 1, 1, 1 };
const ImVec2 size = { 256, 256 };
const ImVec2 uv0 = { 0, 0 };
const ImVec2 uv1 = { 1, 1 };
const ImVec2 uv2 = { -1.5f, -1.5f };
const ImVec2 uv3 = { +2.5f, +2.5f, };
const ImVec2 uv2 = { 4, 4 };
igImage(simgui_imtextureid(state.ui.img_nearest_clamp), size, uv0, uv1, white, white); igSameLine(0, 4);
igImage(simgui_imtextureid(state.ui.img_linear_clamp), size, uv0, uv1, white, white);
igImage(simgui_imtextureid(state.ui.img_nearest_repeat), size, uv2, uv3, white, white); igSameLine(0, 4);
igImage(simgui_imtextureid(state.ui.img_linear_mirror), size, uv2, uv3, white, white);
igImage(simgui_imtextureid(state.ui.img_nearest_repeat), size, uv0, uv2, white, white); igSameLine(0, 4);
igImage(simgui_imtextureid(state.ui.img_linear_mirror), size, uv0, uv2, white, white);
}
igEnd();

Expand Down
8 changes: 4 additions & 4 deletions sapp/nuklear-images-sapp.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ static void frame(void) {
// specific the Nuklear UI (this also just records draw commands which
// are then rendered later in the frame in the sokol-gfx default pass)
struct nk_context* ctx = snk_new_frame();
if (nk_begin(ctx, "Sokol+Nuklear Image Test", nk_rect(10, 10, 540, 570), NK_WINDOW_BORDER|NK_WINDOW_SCALABLE|NK_WINDOW_MOVABLE|NK_WINDOW_MINIMIZABLE)) {
if (nk_begin(ctx, "Sokol + Nuklear Image Test", nk_rect(10, 10, 540, 570), NK_WINDOW_BORDER|NK_WINDOW_SCALABLE|NK_WINDOW_MOVABLE|NK_WINDOW_MINIMIZABLE)) {
nk_layout_row_static(ctx, 256, 256, 2);
const struct nk_rect region = { 0, 0, 1024, 1024 };
const struct nk_rect region = { 0, 0, 4, 4 };
nk_image(ctx, nk_image_handle(snk_nkhandle(state.ui.img_nearest_clamp)));
nk_image(ctx, nk_image_handle(snk_nkhandle(state.ui.img_linear_clamp)));
nk_image(ctx, nk_subimage_handle(snk_nkhandle(state.ui.img_nearest_repeat), 256, 256, region));
nk_image(ctx, nk_subimage_handle(snk_nkhandle(state.ui.img_linear_mirror), 256, 256, region));
nk_image(ctx, nk_subimage_handle(snk_nkhandle(state.ui.img_nearest_repeat), 1, 1, region));
nk_image(ctx, nk_subimage_handle(snk_nkhandle(state.ui.img_linear_mirror), 1, 1, region));
}
nk_end(ctx);

Expand Down

0 comments on commit 9395769

Please sign in to comment.