Removed SDL_bool in favor of plain bool
We require stdbool.h in the build environment, so we might as well use the plain bool type. If your environment doesn't have stdbool.h, this simple replacement will suffice: typedef signed char bool;
This commit is contained in:
@@ -43,21 +43,21 @@ typedef struct _Object
|
||||
float x1, y1, x2, y2;
|
||||
Uint8 r, g, b;
|
||||
|
||||
SDL_bool isRect;
|
||||
bool isRect;
|
||||
} Object;
|
||||
|
||||
static Object *active = NULL;
|
||||
static Object *objects = NULL;
|
||||
static int buttons = 0;
|
||||
static SDL_bool isRect = SDL_FALSE;
|
||||
static bool isRect = false;
|
||||
|
||||
static SDL_bool wheel_x_active = SDL_FALSE;
|
||||
static SDL_bool wheel_y_active = SDL_FALSE;
|
||||
static bool wheel_x_active = false;
|
||||
static bool wheel_y_active = false;
|
||||
static float wheel_x = SCREEN_WIDTH * 0.5f;
|
||||
static float wheel_y = SCREEN_HEIGHT * 0.5f;
|
||||
|
||||
struct mouse_loop_data {
|
||||
SDL_bool done;
|
||||
bool done;
|
||||
SDL_Renderer *renderer;
|
||||
};
|
||||
|
||||
@@ -127,12 +127,12 @@ static void loop(void *arg)
|
||||
event.wheel.y *= -1;
|
||||
}
|
||||
if (event.wheel.x != 0.0f) {
|
||||
wheel_x_active = SDL_TRUE;
|
||||
wheel_x_active = true;
|
||||
/* "positive to the right and negative to the left" */
|
||||
wheel_x += event.wheel.x * 10.0f;
|
||||
}
|
||||
if (event.wheel.y != 0.0f) {
|
||||
wheel_y_active = SDL_TRUE;
|
||||
wheel_y_active = true;
|
||||
/* "positive away from the user and negative towards the user" */
|
||||
wheel_y -= event.wheel.y * 10.0f;
|
||||
}
|
||||
@@ -239,7 +239,7 @@ static void loop(void *arg)
|
||||
break;
|
||||
|
||||
case SDL_EVENT_QUIT:
|
||||
loop_data->done = SDL_TRUE;
|
||||
loop_data->done = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -317,7 +317,7 @@ int main(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
loop_data.done = SDL_FALSE;
|
||||
loop_data.done = false;
|
||||
|
||||
loop_data.renderer = SDL_CreateRenderer(window, NULL);
|
||||
if (!loop_data.renderer) {
|
||||
@@ -330,7 +330,7 @@ int main(int argc, char *argv[])
|
||||
#ifdef SDL_PLATFORM_EMSCRIPTEN
|
||||
emscripten_set_main_loop_arg(loop, &loop_data, 0, 1);
|
||||
#else
|
||||
while (loop_data.done == SDL_FALSE) {
|
||||
while (loop_data.done == false) {
|
||||
loop(&loop_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user