Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allegro5: take image region into account for NK_COMMAND_IMAGE #690

Merged
merged 3 commits into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion demo/allegro5/nuklear_allegro5.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,17 @@ nk_allegro5_render()
} break;
case NK_COMMAND_IMAGE: {
const struct nk_command_image *i = (const struct nk_command_image *)cmd;
al_draw_bitmap_region(i->img.handle.ptr, 0, 0, i->w, i->h, i->x, i->y, 0);
nk_ushort
x = i->img.region[0],
y = i->img.region[1],
w = i->img.region[2],
h = i->img.region[3];
if(w == 0 && h == 0)
{
x = i->x; y = i->y; w = i->w; h = i->h;
}
al_draw_scaled_bitmap(i->img.handle.ptr,
x, y, w, h, i->x, i->y, i->w, i->h, 0);
} break;
case NK_COMMAND_RECT_MULTI_COLOR:
default: break;
Expand Down