QOL improvement to the showpos function
This commit is contained in:
		
							parent
							
								
									6749eeb679
								
							
						
					
					
						commit
						d748b0479f
					
				
					 4 changed files with 21 additions and 9 deletions
				
			
		
							
								
								
									
										5
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										5
									
								
								Makefile
									
										
									
									
									
								
							|  | @ -6,8 +6,11 @@ OBJS = src/Main.c src/Controls.c src/Debug.c src/Copying.c | |||
| 
 | ||||
| #compiler to use
 | ||||
| 
 | ||||
| CC = gcc | ||||
| CC = cc | ||||
| 
 | ||||
| #gimmie dem warnings yo
 | ||||
| 
 | ||||
| COMPILER_FLAGS = -Wall | ||||
| 
 | ||||
| #libs we linkin bro
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -6,8 +6,8 @@ | |||
| // Controls
 | ||||
| void Func_Controls() | ||||
| { | ||||
|   if (IsKeyDown(KEY_LEFT)) {TuxPos_x -= GetFrameTime() * 800.0f;} | ||||
|   if (IsKeyDown(KEY_RIGHT)) {TuxPos_x += GetFrameTime() * 800.0f;} | ||||
|   if (IsKeyDown(KEY_UP)) {TuxPos_y -= GetFrameTime() * 800.0f;} | ||||
|   if (IsKeyDown(KEY_DOWN)) {TuxPos_y += GetFrameTime() * 800.0f;} | ||||
|   if (IsKeyDown(KEY_LEFT)) TuxPos_x -= GetFrameTime() * 800.0f; | ||||
|   if (IsKeyDown(KEY_RIGHT)) TuxPos_x += GetFrameTime() * 800.0f; | ||||
|   if (IsKeyDown(KEY_UP)) TuxPos_y -= GetFrameTime() * 800.0f; | ||||
|   if (IsKeyDown(KEY_DOWN)) TuxPos_y += GetFrameTime() * 800.0f; | ||||
| } | ||||
|  |  | |||
|  | @ -10,5 +10,6 @@ void Func_License() | |||
|     "This program comes with ABSOLUTELY NO WARRANTY; \n" | ||||
|     "This is free software, and you are welcome to redistribute it\n" | ||||
|     "under certain conditions; for details read the LICENSE.\n" | ||||
|     "For the source code go to https://gitdab.com/Canneddonuts/Tux_Vs_X_ENGINE.git\n" | ||||
|   ); | ||||
| } | ||||
|  |  | |||
							
								
								
									
										16
									
								
								src/Main.c
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								src/Main.c
									
										
									
									
									
								
							|  | @ -4,6 +4,9 @@ | |||
| #include "Debug.h" | ||||
| #include "Copying.h" | ||||
| 
 | ||||
| // Functions
 | ||||
| void Func_CheckHitboxToggle(); | ||||
| 
 | ||||
| // Globles
 | ||||
| 
 | ||||
| // Position Varaibles
 | ||||
|  | @ -12,6 +15,7 @@ float TuxPos_x = 32.0f, TuxPos_y = 62.0f; | |||
| 
 | ||||
| // Toggle bools
 | ||||
| bool ShowHitbox = false; | ||||
| bool ShowPos = false; | ||||
| 
 | ||||
| // Setup Code
 | ||||
| void Func_Setup() | ||||
|  | @ -40,10 +44,13 @@ void Func_MainGameLoop() | |||
|   Rectangle boxCollision = { 0 }; | ||||
|   bool collision = false; | ||||
| 
 | ||||
|       // GameLoop
 | ||||
|     // GameLoop
 | ||||
|     while (!WindowShouldClose()) { | ||||
| 
 | ||||
|           Func_ShowPos(); | ||||
|           // Checks and calls the Pos show function
 | ||||
|           if (IsKeyPressed(KEY_P)) ShowPos = !ShowPos; | ||||
|           if (ShowPos==true) Func_ShowPos(); | ||||
| 
 | ||||
|           Func_Controls(); | ||||
| 
 | ||||
|           TuxHitbox.x = TuxPos_x+50; | ||||
|  | @ -70,12 +77,13 @@ void Func_MainGameLoop() | |||
|         } | ||||
| 
 | ||||
|         if (collision) { | ||||
|           DrawText("FINALY BASIC AWFUL COLLISION", 50, 18, 20, BLACK); | ||||
|           DrawText("FINALY BASIC AWFUL COLLISION", 50, 18, 20, MAROON); | ||||
|         } else { | ||||
|           DrawText("Tux Vs X ENGINE PROTOTYPE please read the LINCENSE", 50, 18, 20, BLACK); | ||||
|         } | ||||
| 
 | ||||
|         DrawText("Press 'H' to toggle hitboxes", 50, 72, 20, BLACK); | ||||
|         DrawText("Press 'H' to toggle hitboxes", 50, 72, 20, DARKGREEN); | ||||
|         DrawText("Press 'P' to toggle printing of the positions", 50, 95, 20, DARKGREEN); | ||||
| 
 | ||||
|       EndDrawing(); | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue