summaryrefslogtreecommitdiff
path: root/test/animated.cxx
diff options
context:
space:
mode:
authorfire-eggs <lifeattickville@gmail.com>2021-08-30 10:51:29 -0400
committerAlbrecht Schlosser <albrechts.fltk@online.de>2021-08-30 22:13:32 +0200
commit753631a0b57ba417701167d1e4dd24df0b923254 (patch)
tree8374ef1a68228c91d78118f587ad7072341d542a /test/animated.cxx
parent975d34de4313e0cd29fc652b051c1afc1d8bf607 (diff)
Fix MSVC compiler warnings (PR #267)
Diffstat (limited to 'test/animated.cxx')
-rw-r--r--test/animated.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/animated.cxx b/test/animated.cxx
index 1d7680c92..71479977a 100644
--- a/test/animated.cxx
+++ b/test/animated.cxx
@@ -53,9 +53,9 @@ static void make_images() {
// A fading sphere
uchar alpha = 255;
if (i < FRAMES / 2)
- alpha = 255 * (i / ((float) FRAMES / 2));
+ alpha = uchar(255 * (i / ((float) FRAMES / 2)));
else
- alpha = 255 * (((FRAMES / 2) - (i - FRAMES / 2)) / ((float) FRAMES / 2));
+ alpha = uchar(255 * (((FRAMES / 2) - (i - FRAMES / 2)) / ((float) FRAMES / 2)));
const int spherew = 60;
const int spherex = (DIM - spherew) / 2;
@@ -71,11 +71,11 @@ static void make_images() {
continue;
const float fill = dist / maxdist;
- const uchar grey = fill * 255;
+ const uchar grey = uchar(fill * 255);
uchar myalpha = alpha;
if (fill > 0.9)
- myalpha *= (1.0f - fill) * 10;
+ myalpha *= uchar((1.0f - fill) * 10);
data[y * DIM * 4 + x * 4 + 0] = grey;
data[y * DIM * 4 + x * 4 + 1] = grey;
@@ -85,9 +85,9 @@ static void make_images() {
}
// A moving blob
- const float pos = (i / (float) FRAMES) * 2 - 0.5;
+ const float pos = (i / (float) FRAMES) * 2 - 0.5f;
- const int xoffset = pos * DIM;
+ const int xoffset = int(pos * DIM);
const int yoffset = 2 * DIM / 3;
const int w = DIM / 4;