From 0bc68c92087c887ee49a063a6ad6aaa33bdd4712 Mon Sep 17 00:00:00 2001 From: wahyu-mayar <81440697+wahyu-mayar-seno@users.noreply.github.com> Date: Tue, 28 Oct 2025 04:53:28 +0700 Subject: [PATCH] Destroyed raylib coding conventions (markdown) --- raylib-coding-conventions.md | 65 ------------------------------------ 1 file changed, 65 deletions(-) delete mode 100644 raylib-coding-conventions.md diff --git a/raylib-coding-conventions.md b/raylib-coding-conventions.md deleted file mode 100644 index f4806d0..0000000 --- a/raylib-coding-conventions.md +++ /dev/null @@ -1,65 +0,0 @@ -This page list some coding conventions rules I try to follow on raylib C code: - -Code element | Convention | Example ---- | :---: | --- -Macros | ALL_CAPS | `#define MIN(a,b) (((a)<(b))?(a):(b))` -Defines | ALL_CAPS | `#define PLATFORM_DESKTOP` -Constants | lowerCase | `const int maxValue = 8` -Struct | TitleCase | `struct Texture2D` -Struct members |lowerCase | `texture.id` -Enum | TitleCase | `TextureFormat` -Enum members | ALL_CAPS | `PIXELFORMAT_UNCOMPRESSED_R8G8B8` -Functions | TitleCase or prefixTitleCase | `InitWindow()`/`rlLoadTexture()` -Variables | lowerCase | `screenWidth` -Local variables | lowerCase | `playerPosition` -Global variables | lowerCase | `fullscreen` -Operators | value1*value2 | `int product = value*6;` -Operators | value1/value2 | `int division = value/4;` -Operators | value1 + value2 | `int sum = value + 10;` -Operators | value1 - value2 | `int res = value - 5;` -Pointers | MyType *pointer | `Texture2D *array;` -float values | always x.xf | `float value = 10.0f` -Ternary Operator | (condition)? result1 : result2 | `printf("Value is 0: %s", (value == 0)? "yes" : "no");` - -Some other conventions to follow: - - - raylib code does not use TABS, use 4 spaces instead. - - - Control flow statements are always followed by a space: -```c -if (condition) value = 0; - -while (!WindowShouldClose()) -{ - -} - -for (int i = 0; i < NUM_VALUES; i++) printf("%i", i); - -switch (value) -{ - case 0: - { - - } break; - case 2: break; - default: break; -} -``` - - All condition checks are always enclosed in parentheses, with the exception of simple boolean values: -```c -if ( (value > 1) && (value < 50) && valueActive ) -{ - -} -``` - - - When dealing with curly braces, open-close them in aligned mode, it's more visual for students: -```c -void SomeFunction() -{ - // TODO: Do something here! -} -``` - -**When proposing new functions, please try to use a clear naming for function-name and function-parameters. In case of doubt, open an issue for discussion.**