add F5 hotkey to reload tile assets

This commit is contained in:
Sven Balzer 2025-09-28 07:03:41 +02:00
parent a5c0db824b
commit c3c0f8adf7

View File

@ -1941,6 +1941,23 @@ int main(int argc, char **argv) {
SDL_free(map_path); SDL_free(map_path);
} }
if (event.key.key == SDLK_F5) {
recreate_tile_textures();
WGPUBindGroupEntry world_bind_group_entries[] = {
{ .binding = 0, .textureView = tile_textures_array_view },
{ .binding = 1, .sampler = pixel_sampler },
{ .binding = 2, .buffer = tint_color_buffer, .offset = 0, .size = WGPU_WHOLE_SIZE },
};
WGPUBindGroupDescriptor world_bind_group_descriptor = {
.label = { .data = "world_bind_group", .length = WGPU_STRLEN },
.layout = wgpuRenderPipelineGetBindGroupLayout(world_render_pipeline, 1),
.entryCount = SDL_arraysize(world_bind_group_entries),
.entries = world_bind_group_entries,
};
world_bind_group = wgpuDeviceCreateBindGroup(device, &world_bind_group_descriptor);
}
if (event.key.key == SDLK_R) { if (event.key.key == SDLK_R) {
if (selected_tile != -1 && selected_rotation != -1) { if (selected_tile != -1 && selected_rotation != -1) {
if (modifiers & SDL_KMOD_SHIFT) { if (modifiers & SDL_KMOD_SHIFT) {