aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kdx.42@42l.fr>2023-03-26 05:06:54 +0000
committerkdx <kdx.42@42l.fr>2023-03-26 05:06:54 +0000
commit1aa8753f12e8f76eaa9d77e9ca84547abd00fef2 (patch)
tree6dc48a808cc75f911915aab31706eca7a7d50de7
parentd26cd43dc5e64749d9e8f570ac7f9b1cd0bb6ede (diff)
downloadtzr-1aa8753f12e8f76eaa9d77e9ca84547abd00fef2.tar.gz
formatting tweak
-rw-r--r--main.c3
-rw-r--r--sources/TZR_CycleEvents.c3
-rw-r--r--sources/TZR_DestroyResource.c3
-rw-r--r--sources/TZR_DirectResourceLoad.c3
-rw-r--r--sources/TZR_DrawBegin.c3
-rw-r--r--sources/TZR_DrawClear.c3
-rw-r--r--sources/TZR_DrawEnd.c3
-rw-r--r--sources/TZR_DrawImage.c3
-rw-r--r--sources/TZR_DrawLine.c3
-rw-r--r--sources/TZR_DrawPoint.c3
-rw-r--r--sources/TZR_DrawRectangle.c3
-rw-r--r--sources/TZR_DrawSetColor.c3
-rw-r--r--sources/TZR_GetImageHeight.c3
-rw-r--r--sources/TZR_GetImageWidth.c3
-rw-r--r--sources/TZR_GetKeyState.c3
-rw-r--r--sources/TZR_GetRawResource.c3
-rw-r--r--sources/TZR_GetResourcePath.c3
-rw-r--r--sources/TZR_GetResourcePointer.c3
-rw-r--r--sources/TZR_GetResourceType.c3
-rw-r--r--sources/TZR_GetTick.c3
-rw-r--r--sources/TZR_Init.c6
-rw-r--r--sources/TZR_IsKeyDown.c3
-rw-r--r--sources/TZR_IsKeyPressed.c3
-rw-r--r--sources/TZR_IsKeyReleased.c3
-rw-r--r--sources/TZR_IsKeyUp.c3
-rw-r--r--sources/TZR_LoadResource.c6
-rw-r--r--sources/TZR_LoadResourceFromMemory.c6
-rw-r--r--sources/TZR_LoadResourceTyped.c3
-rw-r--r--sources/TZR_PollEvent.c3
-rw-r--r--sources/TZR_Quit.c3
-rw-r--r--sources/TZR_ReloadResource.c3
-rw-r--r--sources/TZR_ResourcesWatch.c3
-rw-r--r--sources/TZR_ShouldQuit.c3
33 files changed, 72 insertions, 36 deletions
diff --git a/main.c b/main.c
index 75c54cf..85027cf 100644
--- a/main.c
+++ b/main.c
@@ -2,7 +2,8 @@
#include "TZR.h"
-int main(int argc, char **argv)
+int
+main(int argc, char **argv)
{
(void)argc, (void)argv;
diff --git a/sources/TZR_CycleEvents.c b/sources/TZR_CycleEvents.c
index 892c45a..44e7ca5 100644
--- a/sources/TZR_CycleEvents.c
+++ b/sources/TZR_CycleEvents.c
@@ -3,7 +3,8 @@
#include "TZR_globals.h"
#include <SDL2/SDL_scancode.h>
-void TZR_CycleEvents(void)
+void
+TZR_CycleEvents(void)
{
TZR_ResourcesWatch();
for (int i = 0; i < SDL_NUM_SCANCODES; i++) {
diff --git a/sources/TZR_DestroyResource.c b/sources/TZR_DestroyResource.c
index 0e73690..adee831 100644
--- a/sources/TZR_DestroyResource.c
+++ b/sources/TZR_DestroyResource.c
@@ -1,6 +1,7 @@
#include "TZR_resource.h"
-void TZR_DestroyResource(TZR_Resource *res, int free_path)
+void
+TZR_DestroyResource(TZR_Resource *res, int free_path)
{
if (res->path != NULL && free_path)
free(res->path);
diff --git a/sources/TZR_DirectResourceLoad.c b/sources/TZR_DirectResourceLoad.c
index 35157a3..a070c7e 100644
--- a/sources/TZR_DirectResourceLoad.c
+++ b/sources/TZR_DirectResourceLoad.c
@@ -5,7 +5,8 @@
#include <SDL2/SDL_image.h>
#include <string.h>
-int TZR_DirectResourceLoad(TZR_Resource *res, const void *data, int size)
+int
+TZR_DirectResourceLoad(TZR_Resource *res, const void *data, int size)
{
switch (res->type) {
case TZR_RES_RAW:
diff --git a/sources/TZR_DrawBegin.c b/sources/TZR_DrawBegin.c
index e927b7a..6d8b8c8 100644
--- a/sources/TZR_DrawBegin.c
+++ b/sources/TZR_DrawBegin.c
@@ -3,7 +3,8 @@
#include "sdl_error.h"
#include <SDL2/SDL_render.h>
-int TZR_DrawBegin(void)
+int
+TZR_DrawBegin(void)
{
if (SDL_SetRenderTarget(___tzr_renderer, ___tzr_target) < 0)
return sdl_error(-1);
diff --git a/sources/TZR_DrawClear.c b/sources/TZR_DrawClear.c
index 5350601..50639aa 100644
--- a/sources/TZR_DrawClear.c
+++ b/sources/TZR_DrawClear.c
@@ -3,7 +3,8 @@
#include "sdl_error.h"
#include <SDL2/SDL_render.h>
-int TZR_DrawClear(void)
+int
+TZR_DrawClear(void)
{
if (SDL_RenderClear(___tzr_renderer) < 0)
return sdl_error(-1);
diff --git a/sources/TZR_DrawEnd.c b/sources/TZR_DrawEnd.c
index 0cf72ef..ba379be 100644
--- a/sources/TZR_DrawEnd.c
+++ b/sources/TZR_DrawEnd.c
@@ -5,7 +5,8 @@
#include <SDL2/SDL_render.h>
#include <SDL2/SDL_timer.h>
-int TZR_DrawEnd(void)
+int
+TZR_DrawEnd(void)
{
if (SDL_SetRenderTarget(___tzr_renderer, NULL) < 0)
return sdl_error(-1);
diff --git a/sources/TZR_DrawImage.c b/sources/TZR_DrawImage.c
index 1a4da3a..862d94c 100644
--- a/sources/TZR_DrawImage.c
+++ b/sources/TZR_DrawImage.c
@@ -6,7 +6,8 @@
#include <SDL2/SDL_render.h>
#include <math.h>
-int _TZR_DrawImage(const TZR_DrawImageArgs *args)
+int
+_TZR_DrawImage(const TZR_DrawImageArgs *args)
{
if (TZR_GetResourceType(args->id) != TZR_RES_IMAGE) {
fprintf(stderr, "%u isn't an image\n", args->id);
diff --git a/sources/TZR_DrawLine.c b/sources/TZR_DrawLine.c
index b71daac..274bcbc 100644
--- a/sources/TZR_DrawLine.c
+++ b/sources/TZR_DrawLine.c
@@ -3,7 +3,8 @@
#include "sdl_error.h"
#include <SDL2/SDL_render.h>
-int TZR_DrawLine(int x0, int y0, int x1, int y1)
+int
+TZR_DrawLine(int x0, int y0, int x1, int y1)
{
if (SDL_RenderDrawLine(___tzr_renderer, x0, y0, x1, y1) < 0)
return sdl_error(-1);
diff --git a/sources/TZR_DrawPoint.c b/sources/TZR_DrawPoint.c
index d8f0d40..0d44c96 100644
--- a/sources/TZR_DrawPoint.c
+++ b/sources/TZR_DrawPoint.c
@@ -3,7 +3,8 @@
#include "sdl_error.h"
#include <SDL2/SDL_render.h>
-int TZR_DrawPoint(int x, int y)
+int
+TZR_DrawPoint(int x, int y)
{
if (SDL_RenderDrawPoint(___tzr_renderer, x, y) < 0)
return sdl_error(-1);
diff --git a/sources/TZR_DrawRectangle.c b/sources/TZR_DrawRectangle.c
index 3626fed..879eaba 100644
--- a/sources/TZR_DrawRectangle.c
+++ b/sources/TZR_DrawRectangle.c
@@ -3,7 +3,8 @@
#include "sdl_error.h"
#include <SDL2/SDL_render.h>
-int TZR_DrawRectangle(bool fill, int x, int y, int w, int h)
+int
+TZR_DrawRectangle(bool fill, int x, int y, int w, int h)
{
const SDL_Rect rect = { x, y, w, h };
if (fill) {
diff --git a/sources/TZR_DrawSetColor.c b/sources/TZR_DrawSetColor.c
index a5371ef..ad8f329 100644
--- a/sources/TZR_DrawSetColor.c
+++ b/sources/TZR_DrawSetColor.c
@@ -3,7 +3,8 @@
#include "sdl_error.h"
#include <SDL2/SDL_render.h>
-int _TZR_DrawSetColor(const TZR_Color *color)
+int
+_TZR_DrawSetColor(const TZR_Color *color)
{
___tzr_color.r = (color->r < 0.0f) ? ___tzr_color.r : color->r;
___tzr_color.g = (color->g < 0.0f) ? ___tzr_color.g : color->g;
diff --git a/sources/TZR_GetImageHeight.c b/sources/TZR_GetImageHeight.c
index 3527809..1f4f8dc 100644
--- a/sources/TZR_GetImageHeight.c
+++ b/sources/TZR_GetImageHeight.c
@@ -1,6 +1,7 @@
#include "TZR_resource.h"
-int TZR_GetImageHeight(TZR_Uint id)
+int
+TZR_GetImageHeight(TZR_Uint id)
{
return TZR_GetResourcePointer(id)->image.height;
}
diff --git a/sources/TZR_GetImageWidth.c b/sources/TZR_GetImageWidth.c
index c215cf2..8172e01 100644
--- a/sources/TZR_GetImageWidth.c
+++ b/sources/TZR_GetImageWidth.c
@@ -1,6 +1,7 @@
#include "TZR_resource.h"
-int TZR_GetImageWidth(TZR_Uint id)
+int
+TZR_GetImageWidth(TZR_Uint id)
{
return TZR_GetResourcePointer(id)->image.width;
}
diff --git a/sources/TZR_GetKeyState.c b/sources/TZR_GetKeyState.c
index 0aa8305..845c359 100644
--- a/sources/TZR_GetKeyState.c
+++ b/sources/TZR_GetKeyState.c
@@ -1,7 +1,8 @@
#include "TZR_keystate.h"
#include "TZR_globals.h"
-TZR_KeyState TZR_GetKeyState(int scancode)
+TZR_KeyState
+TZR_GetKeyState(int scancode)
{
return ___tzr_keystates[scancode];
}
diff --git a/sources/TZR_GetRawResource.c b/sources/TZR_GetRawResource.c
index 7e6b77b..a34f1fc 100644
--- a/sources/TZR_GetRawResource.c
+++ b/sources/TZR_GetRawResource.c
@@ -1,6 +1,7 @@
#include "TZR_resource.h"
-TZR_Raw *TZR_GetRawResource(TZR_Uint id)
+TZR_Raw *
+TZR_GetRawResource(TZR_Uint id)
{
return &TZR_GetResourcePointer(id)->raw;
}
diff --git a/sources/TZR_GetResourcePath.c b/sources/TZR_GetResourcePath.c
index 92505f5..2a8ef01 100644
--- a/sources/TZR_GetResourcePath.c
+++ b/sources/TZR_GetResourcePath.c
@@ -1,6 +1,7 @@
#include "TZR_resource.h"
-const char *TZR_GetResourcePath(TZR_Uint id)
+const char *
+TZR_GetResourcePath(TZR_Uint id)
{
return TZR_GetResourcePointer(id)->path;
}
diff --git a/sources/TZR_GetResourcePointer.c b/sources/TZR_GetResourcePointer.c
index 4ff2cec..3ca9f04 100644
--- a/sources/TZR_GetResourcePointer.c
+++ b/sources/TZR_GetResourcePointer.c
@@ -1,7 +1,8 @@
#include "TZR_resource.h"
#include "TZR_globals.h"
-TZR_Resource *TZR_GetResourcePointer(TZR_Uint id)
+TZR_Resource *
+TZR_GetResourcePointer(TZR_Uint id)
{
return &___tzr_resources[id - 1];
}
diff --git a/sources/TZR_GetResourceType.c b/sources/TZR_GetResourceType.c
index 4d40b95..f931574 100644
--- a/sources/TZR_GetResourceType.c
+++ b/sources/TZR_GetResourceType.c
@@ -1,7 +1,8 @@
#include "TZR_resource.h"
#include "TZR_globals.h"
-TZR_ResourceType TZR_GetResourceType(TZR_Uint id)
+TZR_ResourceType
+TZR_GetResourceType(TZR_Uint id)
{
return TZR_GetResourcePointer(id)->type;
}
diff --git a/sources/TZR_GetTick.c b/sources/TZR_GetTick.c
index ca93a76..439431e 100644
--- a/sources/TZR_GetTick.c
+++ b/sources/TZR_GetTick.c
@@ -1,7 +1,8 @@
#include "TZR.h"
#include "TZR_globals.h"
-unsigned long TZR_GetTick(void)
+unsigned long
+TZR_GetTick(void)
{
return ___tzr_tick;
}
diff --git a/sources/TZR_Init.c b/sources/TZR_Init.c
index c0e88be..ce09a3c 100644
--- a/sources/TZR_Init.c
+++ b/sources/TZR_Init.c
@@ -5,14 +5,16 @@
#include <SDL2/SDL_image.h>
#include <unistd.h>
-static int _sdl_error(void)
+static int
+_sdl_error(void)
{
sdl_error(-1);
TZR_Quit();
return -1;
}
-int _TZR_Init(const TZR_Config *config)
+int
+_TZR_Init(const TZR_Config *config)
{
if (SDL_Init(SDL_INIT_VIDEO) < 0)
return _sdl_error();
diff --git a/sources/TZR_IsKeyDown.c b/sources/TZR_IsKeyDown.c
index 767e7ed..3706242 100644
--- a/sources/TZR_IsKeyDown.c
+++ b/sources/TZR_IsKeyDown.c
@@ -1,6 +1,7 @@
#include "TZR_keystate.h"
-bool TZR_IsKeyDown(int scancode)
+bool
+TZR_IsKeyDown(int scancode)
{
const TZR_KeyState state = TZR_GetKeyState(scancode);
return (state == TZR_KEYSTATE_DOWN || state == TZR_KEYSTATE_PRESS);
diff --git a/sources/TZR_IsKeyPressed.c b/sources/TZR_IsKeyPressed.c
index 4b3a4be..48e2e22 100644
--- a/sources/TZR_IsKeyPressed.c
+++ b/sources/TZR_IsKeyPressed.c
@@ -1,6 +1,7 @@
#include "TZR_keystate.h"
-bool TZR_IsKeyPressed(int scancode)
+bool
+TZR_IsKeyPressed(int scancode)
{
return (TZR_GetKeyState(scancode) == TZR_KEYSTATE_PRESS);
}
diff --git a/sources/TZR_IsKeyReleased.c b/sources/TZR_IsKeyReleased.c
index b453245..435b789 100644
--- a/sources/TZR_IsKeyReleased.c
+++ b/sources/TZR_IsKeyReleased.c
@@ -1,6 +1,7 @@
#include "TZR_keystate.h"
-bool TZR_IsKeyReleased(int scancode)
+bool
+TZR_IsKeyReleased(int scancode)
{
if (TZR_GetKeyState(scancode) == TZR_KEYSTATE_RELEASE)
return true;
diff --git a/sources/TZR_IsKeyUp.c b/sources/TZR_IsKeyUp.c
index a7471a7..7c74445 100644
--- a/sources/TZR_IsKeyUp.c
+++ b/sources/TZR_IsKeyUp.c
@@ -1,6 +1,7 @@
#include "TZR_keystate.h"
-bool TZR_IsKeyUp(int scancode)
+bool
+TZR_IsKeyUp(int scancode)
{
const TZR_KeyState state = TZR_GetKeyState(scancode);
return (state == TZR_KEYSTATE_UP || state == TZR_KEYSTATE_RELEASE);
diff --git a/sources/TZR_LoadResource.c b/sources/TZR_LoadResource.c
index 8c78de9..924ecd3 100644
--- a/sources/TZR_LoadResource.c
+++ b/sources/TZR_LoadResource.c
@@ -2,7 +2,8 @@
#include "TZR_types.h"
#include <strings.h>
-static TZR_ResourceType deduce_type(const char *path)
+static TZR_ResourceType
+deduce_type(const char *path)
{
const char *const path_extension = strrchr(path, '.');
if (path_extension == NULL)
@@ -13,7 +14,8 @@ static TZR_ResourceType deduce_type(const char *path)
return TZR_RES_RAW;
}
-TZR_Uint TZR_LoadResource(const char *path)
+TZR_Uint
+TZR_LoadResource(const char *path)
{
return TZR_LoadResourceTyped(deduce_type(path), path);
}
diff --git a/sources/TZR_LoadResourceFromMemory.c b/sources/TZR_LoadResourceFromMemory.c
index 9c1e953..1df0824 100644
--- a/sources/TZR_LoadResourceFromMemory.c
+++ b/sources/TZR_LoadResourceFromMemory.c
@@ -5,7 +5,8 @@
#include <stdio.h>
#include <stdlib.h>
-static int reserve_ressources(size_t size)
+static int
+reserve_ressources(size_t size)
{
if (size <= ___tzr_resources_capacity)
return 0;
@@ -25,7 +26,8 @@ static int reserve_ressources(size_t size)
return 0;
}
-TZR_Uint TZR_LoadResourceFromMemory(TZR_ResourceType type, const void *data, int size)
+TZR_Uint
+TZR_LoadResourceFromMemory(TZR_ResourceType type, const void *data, int size)
{
if (reserve_ressources(___tzr_resources_size + 1)) {
fprintf(stderr, "failed to reserve for new ressource\n");
diff --git a/sources/TZR_LoadResourceTyped.c b/sources/TZR_LoadResourceTyped.c
index 8baea41..3c38ee2 100644
--- a/sources/TZR_LoadResourceTyped.c
+++ b/sources/TZR_LoadResourceTyped.c
@@ -4,7 +4,8 @@
#include <string.h>
#include <sys/stat.h>
-TZR_Uint TZR_LoadResourceTyped(TZR_ResourceType type, const char *path)
+TZR_Uint
+TZR_LoadResourceTyped(TZR_ResourceType type, const char *path)
{
for (TZR_Uint i = 0; i < ___tzr_resources_size; i++)
if (___tzr_resources[i].type == type &&
diff --git a/sources/TZR_PollEvent.c b/sources/TZR_PollEvent.c
index 1bfec01..2b31fa3 100644
--- a/sources/TZR_PollEvent.c
+++ b/sources/TZR_PollEvent.c
@@ -2,7 +2,8 @@
#include "TZR_globals.h"
#include <SDL2/SDL_events.h>
-int TZR_PollEvent(TZR_Event *e)
+int
+TZR_PollEvent(TZR_Event *e)
{
TZR_Event discard;
if (e == NULL)
diff --git a/sources/TZR_Quit.c b/sources/TZR_Quit.c
index 971f03f..0556c09 100644
--- a/sources/TZR_Quit.c
+++ b/sources/TZR_Quit.c
@@ -4,7 +4,8 @@
#include <SDL2/SDL_render.h>
#include <SDL2/SDL_image.h>
-void TZR_Quit(void)
+void
+TZR_Quit(void)
{
for (size_t i = 0; i < ___tzr_resources_size; i++)
TZR_DestroyResource(&___tzr_resources[i], 1);
diff --git a/sources/TZR_ReloadResource.c b/sources/TZR_ReloadResource.c
index f87ee76..1b7ac33 100644
--- a/sources/TZR_ReloadResource.c
+++ b/sources/TZR_ReloadResource.c
@@ -2,7 +2,8 @@
#include "drain.h"
#include <sys/stat.h>
-int TZR_ReloadResource(TZR_Uint id)
+int
+TZR_ReloadResource(TZR_Uint id)
{
TZR_Resource *const res = TZR_GetResourcePointer(id);
if (res->path == NULL) {
diff --git a/sources/TZR_ResourcesWatch.c b/sources/TZR_ResourcesWatch.c
index 80612f1..e5d2503 100644
--- a/sources/TZR_ResourcesWatch.c
+++ b/sources/TZR_ResourcesWatch.c
@@ -2,7 +2,8 @@
#include "TZR_globals.h"
#include <sys/stat.h>
-void TZR_ResourcesWatch(void)
+void
+TZR_ResourcesWatch(void)
{
for (TZR_Uint i = 0; i < ___tzr_resources_size; i++) {
TZR_Resource *const res = TZR_GetResourcePointer(i + 1);
diff --git a/sources/TZR_ShouldQuit.c b/sources/TZR_ShouldQuit.c
index b3c62ea..24165af 100644
--- a/sources/TZR_ShouldQuit.c
+++ b/sources/TZR_ShouldQuit.c
@@ -1,7 +1,8 @@
#include "TZR.h"
#include "TZR_globals.h"
-int TZR_ShouldQuit(void)
+int
+TZR_ShouldQuit(void)
{
return ___tzr_should_quit;
}