got rid of the stupid Func_ in the function names
This commit is contained in:
		
							parent
							
								
									d766ed5fce
								
							
						
					
					
						commit
						02bc8500aa
					
				
					 10 changed files with 37 additions and 33 deletions
				
			
		
							
								
								
									
										4
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								Makefile
									
										
									
									
									
								
							|  | @ -8,9 +8,9 @@ OBJS = src/Main.c src/Controls.c src/Debug.c src/Copying.c | |||
| 
 | ||||
| CC = cc | ||||
| 
 | ||||
| #gimmie dem warnings yo
 | ||||
| #gimmie ALL dem 1999 era warnings yo
 | ||||
| 
 | ||||
| COMPILER_FLAGS = -Wall | ||||
| COMPILER_FLAGS = -std=c99 -Wall | ||||
| 
 | ||||
| #libs we linkin bro
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| # Tux Vs X ENGINE | ||||
| 
 | ||||
| A remake of the first game I made. | ||||
| <p>This time made with C and raylib.</p> | ||||
| <p>This time made with C99 and raylib.</p> | ||||
| 
 | ||||
| <p>Sprites made by Jelly_poi.</p> | ||||
| <p>Programming and design by M-C-O-B.</p> | ||||
|  | @ -13,13 +13,14 @@ Make sure to read the LICENSE file | |||
| 
 | ||||
| * More clean code | ||||
| * Build Guide | ||||
| * Hitboxes working in .h files | ||||
| * Screen Boundaries | ||||
| * Projectiles | ||||
| * Portable Binaries of the game | ||||
| 
 | ||||
| # BRANCHES | ||||
| 
 | ||||
| <p>To see new code use</p> | ||||
| 
 | ||||
| Use | ||||
| ```sh | ||||
| git checkout unstable | ||||
| ``` | ||||
| to see the unstable branch | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
| #include "Controls.h" | ||||
| 
 | ||||
| // Controls
 | ||||
| void Func_Controls() | ||||
| void Controls() | ||||
| { | ||||
|   if (IsKeyDown(KEY_LEFT)) TuxPos_x -= GetFrameTime() * 800.0f; | ||||
|   if (IsKeyDown(KEY_RIGHT)) TuxPos_x += GetFrameTime() * 800.0f; | ||||
|  |  | |||
|  | @ -1,3 +1,3 @@ | |||
| #pragma once | ||||
| 
 | ||||
| void Func_Controls(); | ||||
| void Controls(); | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| #include <stdio.h> | ||||
| 
 | ||||
| 
 | ||||
| void Func_License() | ||||
| void License() | ||||
| { | ||||
|   // Outputs Copying info in the command line
 | ||||
|   printf | ||||
|  |  | |||
|  | @ -1,3 +1,3 @@ | |||
| #pragma once | ||||
| 
 | ||||
| void Func_License(); | ||||
| void License(); | ||||
|  |  | |||
|  | @ -1,9 +1,11 @@ | |||
| #include <stdio.h> | ||||
| #include <stdbool.h> | ||||
| #include "raylib.h" | ||||
| 
 | ||||
| #include "Main.h" | ||||
| #include "Debug.h" | ||||
| 
 | ||||
| void Func_ShowPos() | ||||
| void ShowPos() | ||||
| { | ||||
|   // Ouput Position Infomation in the command line
 | ||||
|   printf | ||||
|  | @ -12,3 +14,8 @@ void Func_ShowPos() | |||
|      TuxPos_x, TuxPos_y, EnemyPos_x, EnemyPos_y | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| void CheckHitboxToggle() | ||||
| { | ||||
|   if (IsKeyPressed(KEY_H)) ShowHitbox = !ShowHitbox; | ||||
| } | ||||
|  |  | |||
|  | @ -1,3 +1,4 @@ | |||
| #pragma once | ||||
| 
 | ||||
| void Func_ShowPos(); | ||||
| void ShowPos(); | ||||
| void CheckHitboxToggle(); | ||||
|  |  | |||
							
								
								
									
										33
									
								
								src/Main.c
									
										
									
									
									
								
							
							
						
						
									
										33
									
								
								src/Main.c
									
										
									
									
									
								
							|  | @ -1,3 +1,4 @@ | |||
| #include <stdbool.h> | ||||
| #include "raylib.h" | ||||
| 
 | ||||
| #include "Controls.h" | ||||
|  | @ -5,7 +6,7 @@ | |||
| #include "Copying.h" | ||||
| 
 | ||||
| // Functions
 | ||||
| void Func_CheckHitboxToggle(); | ||||
| 
 | ||||
| 
 | ||||
| // Globles
 | ||||
| 
 | ||||
|  | @ -15,10 +16,10 @@ float TuxPos_x = 32.0f, TuxPos_y = 62.0f; | |||
| 
 | ||||
| // Toggle bools
 | ||||
| bool ShowHitbox = false; | ||||
| bool ShowPos = false; | ||||
| bool ToggleShowPos = false; | ||||
| 
 | ||||
| // Setup Code
 | ||||
| void Func_Setup() | ||||
| void Setup() | ||||
| { | ||||
|   const int screenWidth = 800; | ||||
|   const int screenHeight = 450; | ||||
|  | @ -29,7 +30,7 @@ void Func_Setup() | |||
| } | ||||
| 
 | ||||
| // GameLoop Code
 | ||||
| void Func_MainGameLoop() | ||||
| void MainGameLoop() | ||||
| { | ||||
|   // Load Textures
 | ||||
|   Texture2D tux = LoadTexture("assets/tux.png"); | ||||
|  | @ -41,17 +42,16 @@ void Func_MainGameLoop() | |||
|   Rectangle TuxHitbox = { GetScreenWidth()/2.0f - 30, GetScreenHeight()/2.0f - 30, 90, 40}; | ||||
| 
 | ||||
| 
 | ||||
|   Rectangle boxCollision = { 0 }; | ||||
|   bool collision = false; | ||||
| 
 | ||||
|     // GameLoop
 | ||||
|     while (!WindowShouldClose()) { | ||||
| 
 | ||||
|           // Checks and calls the Pos show function
 | ||||
|           if (IsKeyPressed(KEY_P)) ShowPos = !ShowPos; | ||||
|           if (ShowPos==true) Func_ShowPos(); | ||||
|           if (IsKeyPressed(KEY_P)) ToggleShowPos = !ToggleShowPos; | ||||
|           if (ToggleShowPos==true) ShowPos(); | ||||
| 
 | ||||
|           Func_Controls(); | ||||
|           Controls(); | ||||
| 
 | ||||
|           TuxHitbox.x = TuxPos_x+50; | ||||
|           TuxHitbox.y = TuxPos_y+50; | ||||
|  | @ -59,7 +59,6 @@ void Func_MainGameLoop() | |||
|           EnemyHitbox.y = EnemyPos_y; | ||||
| 
 | ||||
|           collision = CheckCollisionRecs(EnemyHitbox, TuxHitbox); | ||||
|           if (collision) boxCollision = GetCollisionRec(EnemyHitbox, TuxHitbox); | ||||
| 
 | ||||
|       BeginDrawing(); | ||||
|         ClearBackground(RAYWHITE); | ||||
|  | @ -69,7 +68,7 @@ void Func_MainGameLoop() | |||
|         DrawTexture(tux, TuxPos_x, TuxPos_y, RAYWHITE); | ||||
|         DrawTexture(enemy, EnemyPos_x, EnemyPos_y, RAYWHITE); | ||||
| 
 | ||||
|         Func_CheckHitboxToggle(); | ||||
|         CheckHitboxToggle(); | ||||
| 
 | ||||
|         if (ShowHitbox==true) { | ||||
|           DrawRectangleRec(EnemyHitbox, RED); | ||||
|  | @ -93,20 +92,12 @@ void Func_MainGameLoop() | |||
|   UnloadTexture(arctic); | ||||
| } | ||||
| 
 | ||||
| void Func_CheckHitboxToggle() | ||||
| { | ||||
|   if (IsKeyPressed(KEY_H)) ShowHitbox = !ShowHitbox; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| int main() | ||||
| { | ||||
|   Func_Setup(); | ||||
|   Func_MainGameLoop(); | ||||
| 
 | ||||
|   Setup(); | ||||
|   MainGameLoop(); | ||||
|   CloseWindow(); | ||||
| 
 | ||||
|   Func_License(); | ||||
|   License(); | ||||
| 
 | ||||
|   return 0; | ||||
| } | ||||
|  |  | |||
|  | @ -1,3 +1,4 @@ | |||
| #include <stdbool.h> | ||||
| #pragma once | ||||
| 
 | ||||
| // makes the Varaibles globle across c files
 | ||||
|  | @ -5,3 +6,6 @@ extern float TuxPos_x; | |||
| extern float TuxPos_y; | ||||
| extern float EnemyPos_x; | ||||
| extern float EnemyPos_y; | ||||
| 
 | ||||
| extern bool ShowHitbox; | ||||
| extern bool ToggleShowPos; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue