mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-16 17:58:27 +00:00
Update for SDL3 coding style (#6717)
I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base. In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted. The script I ran for the src directory is added as build-scripts/clang-format-src.sh This fixes: #6592 #6593 #6594
This commit is contained in:
parent
14b902faca
commit
5750bcb174
781 changed files with 51659 additions and 55763 deletions
|
@ -21,7 +21,12 @@
|
|||
|
||||
#include <SDL3/SDL_test_common.h>
|
||||
|
||||
#define SWAP(typ,a,b) do{typ t=a;a=b;b=t;}while (0)
|
||||
#define SWAP(typ, a, b) \
|
||||
do { \
|
||||
typ t = a; \
|
||||
a = b; \
|
||||
b = t; \
|
||||
} while (0)
|
||||
#define NUM_OBJECTS 100
|
||||
|
||||
static SDLTest_CommonState *state;
|
||||
|
@ -36,8 +41,7 @@ static SDL_BlendMode blendMode = SDL_BLENDMODE_NONE;
|
|||
int mouse_begin_x = -1, mouse_begin_y = -1;
|
||||
int done;
|
||||
|
||||
void
|
||||
DrawPoints(SDL_Renderer * renderer)
|
||||
void DrawPoints(SDL_Renderer *renderer)
|
||||
{
|
||||
int i;
|
||||
int x, y;
|
||||
|
@ -70,8 +74,8 @@ DrawPoints(SDL_Renderer * renderer)
|
|||
cycle_direction = -cycle_direction;
|
||||
}
|
||||
}
|
||||
SDL_SetRenderDrawColor(renderer, 255, (Uint8) current_color,
|
||||
(Uint8) current_color, (Uint8) current_alpha);
|
||||
SDL_SetRenderDrawColor(renderer, 255, (Uint8)current_color,
|
||||
(Uint8)current_color, (Uint8)current_alpha);
|
||||
|
||||
x = rand() % viewport.w;
|
||||
y = rand() % viewport.h;
|
||||
|
@ -101,9 +105,7 @@ add_line(int x1, int y1, int x2, int y2)
|
|||
return ++num_lines;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DrawLines(SDL_Renderer * renderer)
|
||||
void DrawLines(SDL_Renderer *renderer)
|
||||
{
|
||||
int i;
|
||||
SDL_Rect viewport;
|
||||
|
@ -146,7 +148,7 @@ add_rect(int x1, int y1, int x2, int y2)
|
|||
}
|
||||
|
||||
SDL_Log("adding rect (%d, %d), (%d, %d) [%dx%d]\n", x1, y1, x2, y2,
|
||||
x2 - x1, y2 - y1);
|
||||
x2 - x1, y2 - y1);
|
||||
|
||||
rects[num_rects].x = x1;
|
||||
rects[num_rects].y = y1;
|
||||
|
@ -157,14 +159,14 @@ add_rect(int x1, int y1, int x2, int y2)
|
|||
}
|
||||
|
||||
static void
|
||||
DrawRects(SDL_Renderer * renderer)
|
||||
DrawRects(SDL_Renderer *renderer)
|
||||
{
|
||||
SDL_SetRenderDrawColor(renderer, 255, 127, 0, 255);
|
||||
SDL_RenderFillRects(renderer, rects, num_rects);
|
||||
}
|
||||
|
||||
static void
|
||||
DrawRectLineIntersections(SDL_Renderer * renderer)
|
||||
DrawRectLineIntersections(SDL_Renderer *renderer)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
@ -188,7 +190,7 @@ DrawRectLineIntersections(SDL_Renderer * renderer)
|
|||
}
|
||||
|
||||
static void
|
||||
DrawRectRectIntersections(SDL_Renderer * renderer)
|
||||
DrawRectRectIntersections(SDL_Renderer *renderer)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
@ -203,8 +205,7 @@ DrawRectRectIntersections(SDL_Renderer * renderer)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
loop()
|
||||
void loop()
|
||||
{
|
||||
int i;
|
||||
SDL_Event event;
|
||||
|
@ -270,8 +271,7 @@ loop()
|
|||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
Uint32 then, now, frames;
|
||||
|
@ -360,7 +360,7 @@ main(int argc, char *argv[])
|
|||
/* Print out some timing information */
|
||||
now = SDL_GetTicks();
|
||||
if (now > then) {
|
||||
double fps = ((double) frames * 1000) / (now - then);
|
||||
double fps = ((double)frames * 1000) / (now - then);
|
||||
SDL_Log("%2.2f frames per second\n", fps);
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue