mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-09-30 02:48:14 +03:00
Merge pull request #187 from kichikuou/vmDrawGauge
Add guard against division by zero in vmDrawGauge.Draw()
This commit is contained in:
@@ -103,8 +103,10 @@ static void vmDrawGauge_Draw(int handle, int now, int max)
|
||||
return;
|
||||
|
||||
gfx_fill_with_alpha(&sf->texture, 0, 0, sf->texture.w, sf->texture.h, 255, 0, 255, 0);
|
||||
int w = sf->texture.w * now / max;
|
||||
gfx_copy_with_alpha_map(&sf->texture, 0, 0, &dg->tex, 0, 0, w, sf->texture.h);
|
||||
if (max > 0) {
|
||||
int w = sf->texture.w * now / max;
|
||||
gfx_copy_with_alpha_map(&sf->texture, 0, 0, &dg->tex, 0, 0, w, sf->texture.h);
|
||||
}
|
||||
}
|
||||
|
||||
HLL_LIBRARY(vmDrawGauge,
|
||||
|
||||
Reference in New Issue
Block a user