Skip to content

Commit

Permalink
d3d11: fix drawing menu background if its smaller than 640x480
Browse files Browse the repository at this point in the history
Fixes #262
  • Loading branch information
rafalh committed Sep 3, 2024
1 parent 7e0a76a commit d932d68
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions game_patch/graphics/d3d11/gr_d3d11_dynamic_geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,13 @@ namespace df::gr::d3d11
int bm_w, bm_h;
bm::get_dimensions(bm_handle, &bm_w, &bm_h);

// For some reason original implementation do not allow UVs > 1
sw = std::min(sw, bm_w - sx);
sh = std::min(sh, bm_h - sy);
if (sw <= 0.0f || sh <= 0.0f) {
return;
}

float sx_left = x / gr::screen.clip_width * 2.0f - 1.0f;
float sx_right = (x + w) / gr::screen.clip_width * 2.0f - 1.0f;
float sy_top = y / gr::screen.clip_height * -2.0f + 1.0f;
Expand Down

0 comments on commit d932d68

Please sign in to comment.