aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/pugl_cairo_demo.c6
-rw-r--r--examples/pugl_clipboard_demo.c4
-rw-r--r--examples/pugl_cursor_demo.c4
-rw-r--r--examples/pugl_embed_demo.c8
-rw-r--r--examples/pugl_management_demo.c14
-rw-r--r--examples/pugl_window_demo.c8
6 files changed, 23 insertions, 21 deletions
diff --git a/examples/pugl_cairo_demo.c b/examples/pugl_cairo_demo.c
index d973d69..143f49e 100644
--- a/examples/pugl_cairo_demo.c
+++ b/examples/pugl_cairo_demo.c
@@ -100,8 +100,8 @@ buttonDraw(PuglTestApp* app, cairo_t* cr, const Button* but, const double time)
cairo_set_font_size(cr, 32.0);
cairo_text_extents(cr, but->label, &extents);
cairo_move_to(cr,
- (but->w / 2.0) - extents.width / 2,
- (but->h / 2.0) + extents.height / 2);
+ (but->w / 2.0) - (extents.width / 2),
+ (but->h / 2.0) + (extents.height / 2));
cairo_set_source_rgba(cr, 0, 0, 0, 1);
cairo_show_text(cr, but->label);
@@ -114,7 +114,7 @@ postButtonRedisplay(PuglView* view)
const ViewScale scale = getScale(view);
for (const Button* b = buttons; b->label; ++b) {
- const double span = sqrt(b->w * b->w + b->h * b->h);
+ const double span = sqrt((b->w * b->w) + (b->h * b->h));
puglObscureRegion(view,
(int)((b->x - span) * scale.x),
(int)((b->y - span) * scale.y),
diff --git a/examples/pugl_clipboard_demo.c b/examples/pugl_clipboard_demo.c
index 78ea4e8..706d32a 100644
--- a/examples/pugl_clipboard_demo.c
+++ b/examples/pugl_clipboard_demo.c
@@ -44,8 +44,8 @@ onDisplay(PuglView* view)
if (app->continuous) {
const double dTime = thisTime - cube->lastDrawTime;
- cube->xAngle = fmod(cube->xAngle + dTime * 100.0, 360.0);
- cube->yAngle = fmod(cube->yAngle + dTime * 100.0, 360.0);
+ cube->xAngle = fmod(cube->xAngle + (dTime * 100.0), 360.0);
+ cube->yAngle = fmod(cube->yAngle + (dTime * 100.0), 360.0);
}
displayCube(
diff --git a/examples/pugl_cursor_demo.c b/examples/pugl_cursor_demo.c
index bc219f0..8ae7631 100644
--- a/examples/pugl_cursor_demo.c
+++ b/examples/pugl_cursor_demo.c
@@ -40,7 +40,7 @@ onExpose(void)
glColor3f(0.6f, 0.6f, 0.6f);
for (int row = 1; row < N_ROWS; ++row) {
- const float y = (float)row * (2.0f / (float)N_ROWS) - 1.0f;
+ const float y = ((float)row * (2.0f / (float)N_ROWS)) - 1.0f;
glBegin(GL_LINES);
glVertex2f(-1.0f, y);
glVertex2f(1.0f, y);
@@ -48,7 +48,7 @@ onExpose(void)
}
for (int col = 1; col < N_COLS; ++col) {
- const float x = (float)col * (2.0f / (float)N_COLS) - 1.0f;
+ const float x = ((float)col * (2.0f / (float)N_COLS)) - 1.0f;
glBegin(GL_LINES);
glVertex2f(x, -1.0f);
glVertex2f(x, 1.0f);
diff --git a/examples/pugl_embed_demo.c b/examples/pugl_embed_demo.c
index c14afde..417e690 100644
--- a/examples/pugl_embed_demo.c
+++ b/examples/pugl_embed_demo.c
@@ -56,8 +56,8 @@ getChildFrame(const PuglRect parentFrame)
const PuglRect childFrame = {
borderWidth,
borderWidth,
- (PuglSpan)(parentFrame.width - 2 * borderWidth),
- (PuglSpan)(parentFrame.height - 2 * borderWidth)};
+ (PuglSpan)(parentFrame.width - (2 * borderWidth)),
+ (PuglSpan)(parentFrame.height - (2 * borderWidth))};
return childFrame;
}
@@ -72,8 +72,8 @@ onDisplay(PuglView* view)
const double dTime =
(thisTime - app->lastDrawTime) * (app->reversing ? -1.0 : 1.0);
- app->xAngle = fmod(app->xAngle + dTime * 100.0, 360.0);
- app->yAngle = fmod(app->yAngle + dTime * 100.0, 360.0);
+ app->xAngle = fmod(app->xAngle + (dTime * 100.0), 360.0);
+ app->yAngle = fmod(app->yAngle + (dTime * 100.0), 360.0);
}
displayCube(
diff --git a/examples/pugl_management_demo.c b/examples/pugl_management_demo.c
index 51d2f43..163e063 100644
--- a/examples/pugl_management_demo.c
+++ b/examples/pugl_management_demo.c
@@ -64,26 +64,28 @@ onExpose(PuglView* const view, const PuglExposeEvent* const event)
snprintf(buf, sizeof(buf), "Position: %5d, %5d", frame.x, frame.y);
cairo_text_extents(cr, buf, &extents);
cairo_move_to(
- cr, cx - extents.width / 2.0, cy + extents.height / 2.0 - 192.0);
+ cr, cx - (extents.width / 2.0), cy + (extents.height / 2.0) - 192.0);
cairo_show_text(cr, buf);
// Draw size label
snprintf(buf, sizeof(buf), "Size: %5u, %5u", frame.width, frame.height);
cairo_text_extents(cr, buf, &extents);
cairo_move_to(
- cr, cx - extents.width / 2.0, cy + extents.height / 2.0 - 144.0);
+ cr, cx - (extents.width / 2.0), cy + (extents.height / 2.0) - 144.0);
cairo_show_text(cr, buf);
// Draw scale label
snprintf(buf, sizeof(buf), "Scale: %g", puglGetScaleFactor(view));
cairo_text_extents(cr, buf, &extents);
- cairo_move_to(cr, cx - extents.width / 2.0, cy + extents.height / 2.0 - 96.0);
+ cairo_move_to(
+ cr, cx - (extents.width / 2.0), cy + (extents.height / 2.0) - 96.0);
cairo_show_text(cr, buf);
// Draw time label
snprintf(buf, sizeof(buf), "Draw time: %g", puglGetTime(world));
cairo_text_extents(cr, buf, &extents);
- cairo_move_to(cr, cx - extents.width / 2.0, cy + extents.height / 2.0 - 48.0);
+ cairo_move_to(
+ cr, cx - (extents.width / 2.0), cy + (extents.height / 2.0) - 48.0);
cairo_show_text(cr, buf);
// Draw style label
@@ -100,7 +102,7 @@ onExpose(PuglView* const view, const PuglExposeEvent* const event)
style & PUGL_VIEW_STYLE_DEMANDING ? " demanding" : "",
style & PUGL_VIEW_STYLE_RESIZING ? " resizing" : "");
cairo_text_extents(cr, buf, &extents);
- cairo_move_to(cr, cx - extents.width / 2.0, cy + extents.height / 2.0);
+ cairo_move_to(cr, cx - (extents.width / 2.0), cy + (extents.height / 2.0));
cairo_show_text(cr, buf);
if (view == app->mainView.view) {
@@ -108,7 +110,7 @@ onExpose(PuglView* const view, const PuglExposeEvent* const event)
snprintf(buf, sizeof(buf), "Keys: Space T W H M F A B D Q");
cairo_text_extents(cr, buf, &extents);
cairo_move_to(
- cr, cx - extents.width / 2.0, cy + extents.height / 2.0 + 48.0);
+ cr, cx - (extents.width / 2.0), cy + (extents.height / 2.0) + 48.0);
cairo_show_text(cr, buf);
}
diff --git a/examples/pugl_window_demo.c b/examples/pugl_window_demo.c
index cd4fd67..6ae6f8b 100644
--- a/examples/pugl_window_demo.c
+++ b/examples/pugl_window_demo.c
@@ -49,8 +49,8 @@ onDisplay(PuglView* view)
if (app->continuous) {
const double dTime = thisTime - cube->lastDrawTime;
- cube->xAngle = fmod(cube->xAngle + dTime * 100.0, 360.0);
- cube->yAngle = fmod(cube->yAngle + dTime * 100.0, 360.0);
+ cube->xAngle = fmod(cube->xAngle + (dTime * 100.0), 360.0);
+ cube->yAngle = fmod(cube->yAngle + (dTime * 100.0), 360.0);
}
displayCube(
@@ -187,8 +187,8 @@ main(int argc, char** argv)
puglSetViewString(view, PUGL_WINDOW_TITLE, "Pugl Window Demo");
puglSetPosition(view,
- (PuglCoord)(pad + (128U + pad) * i),
- (PuglCoord)(pad + (128U + pad) * i));
+ (PuglCoord)(pad + ((128U + pad) * i)),
+ (PuglCoord)(pad + ((128U + pad) * i)));
puglSetSizeHint(view, PUGL_DEFAULT_SIZE, 512, 512);
puglSetSizeHint(view, PUGL_MIN_SIZE, 128, 128);