got rid of the stupid Func_ in the function names

This commit is contained in:
Return0ne 2021-11-22 18:33:11 -05:00
parent d766ed5fce
commit 02bc8500aa
10 changed files with 37 additions and 33 deletions

View File

@ -8,9 +8,9 @@ OBJS = src/Main.c src/Controls.c src/Debug.c src/Copying.c
CC = cc 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 #libs we linkin bro

View File

@ -1,7 +1,7 @@
# Tux Vs X ENGINE # Tux Vs X ENGINE
A remake of the first game I made. 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>Sprites made by Jelly_poi.</p>
<p>Programming and design by M-C-O-B.</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 * More clean code
* Build Guide * Build Guide
* Hitboxes working in .h files
* Screen Boundaries * Screen Boundaries
* Projectiles * Projectiles
* Portable Binaries of the game * Portable Binaries of the game
# BRANCHES # BRANCHES
<p>To see new code use</p> Use
```sh
git checkout unstable git checkout unstable
```
to see the unstable branch

View File

@ -4,7 +4,7 @@
#include "Controls.h" #include "Controls.h"
// Controls // Controls
void Func_Controls() void Controls()
{ {
if (IsKeyDown(KEY_LEFT)) TuxPos_x -= GetFrameTime() * 800.0f; if (IsKeyDown(KEY_LEFT)) TuxPos_x -= GetFrameTime() * 800.0f;
if (IsKeyDown(KEY_RIGHT)) TuxPos_x += GetFrameTime() * 800.0f; if (IsKeyDown(KEY_RIGHT)) TuxPos_x += GetFrameTime() * 800.0f;

View File

@ -1,3 +1,3 @@
#pragma once #pragma once
void Func_Controls(); void Controls();

View File

@ -1,7 +1,7 @@
#include <stdio.h> #include <stdio.h>
void Func_License() void License()
{ {
// Outputs Copying info in the command line // Outputs Copying info in the command line
printf printf

View File

@ -1,3 +1,3 @@
#pragma once #pragma once
void Func_License(); void License();

View File

@ -1,9 +1,11 @@
#include <stdio.h> #include <stdio.h>
#include <stdbool.h>
#include "raylib.h"
#include "Main.h" #include "Main.h"
#include "Debug.h" #include "Debug.h"
void Func_ShowPos() void ShowPos()
{ {
// Ouput Position Infomation in the command line // Ouput Position Infomation in the command line
printf printf
@ -12,3 +14,8 @@ void Func_ShowPos()
TuxPos_x, TuxPos_y, EnemyPos_x, EnemyPos_y TuxPos_x, TuxPos_y, EnemyPos_x, EnemyPos_y
); );
} }
void CheckHitboxToggle()
{
if (IsKeyPressed(KEY_H)) ShowHitbox = !ShowHitbox;
}

View File

@ -1,3 +1,4 @@
#pragma once #pragma once
void Func_ShowPos(); void ShowPos();
void CheckHitboxToggle();

View File

@ -1,3 +1,4 @@
#include <stdbool.h>
#include "raylib.h" #include "raylib.h"
#include "Controls.h" #include "Controls.h"
@ -5,7 +6,7 @@
#include "Copying.h" #include "Copying.h"
// Functions // Functions
void Func_CheckHitboxToggle();
// Globles // Globles
@ -15,10 +16,10 @@ float TuxPos_x = 32.0f, TuxPos_y = 62.0f;
// Toggle bools // Toggle bools
bool ShowHitbox = false; bool ShowHitbox = false;
bool ShowPos = false; bool ToggleShowPos = false;
// Setup Code // Setup Code
void Func_Setup() void Setup()
{ {
const int screenWidth = 800; const int screenWidth = 800;
const int screenHeight = 450; const int screenHeight = 450;
@ -29,7 +30,7 @@ void Func_Setup()
} }
// GameLoop Code // GameLoop Code
void Func_MainGameLoop() void MainGameLoop()
{ {
// Load Textures // Load Textures
Texture2D tux = LoadTexture("assets/tux.png"); 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 TuxHitbox = { GetScreenWidth()/2.0f - 30, GetScreenHeight()/2.0f - 30, 90, 40};
Rectangle boxCollision = { 0 };
bool collision = false; bool collision = false;
// GameLoop // GameLoop
while (!WindowShouldClose()) { while (!WindowShouldClose()) {
// Checks and calls the Pos show function // Checks and calls the Pos show function
if (IsKeyPressed(KEY_P)) ShowPos = !ShowPos; if (IsKeyPressed(KEY_P)) ToggleShowPos = !ToggleShowPos;
if (ShowPos==true) Func_ShowPos(); if (ToggleShowPos==true) ShowPos();
Func_Controls(); Controls();
TuxHitbox.x = TuxPos_x+50; TuxHitbox.x = TuxPos_x+50;
TuxHitbox.y = TuxPos_y+50; TuxHitbox.y = TuxPos_y+50;
@ -59,7 +59,6 @@ void Func_MainGameLoop()
EnemyHitbox.y = EnemyPos_y; EnemyHitbox.y = EnemyPos_y;
collision = CheckCollisionRecs(EnemyHitbox, TuxHitbox); collision = CheckCollisionRecs(EnemyHitbox, TuxHitbox);
if (collision) boxCollision = GetCollisionRec(EnemyHitbox, TuxHitbox);
BeginDrawing(); BeginDrawing();
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
@ -69,7 +68,7 @@ void Func_MainGameLoop()
DrawTexture(tux, TuxPos_x, TuxPos_y, RAYWHITE); DrawTexture(tux, TuxPos_x, TuxPos_y, RAYWHITE);
DrawTexture(enemy, EnemyPos_x, EnemyPos_y, RAYWHITE); DrawTexture(enemy, EnemyPos_x, EnemyPos_y, RAYWHITE);
Func_CheckHitboxToggle(); CheckHitboxToggle();
if (ShowHitbox==true) { if (ShowHitbox==true) {
DrawRectangleRec(EnemyHitbox, RED); DrawRectangleRec(EnemyHitbox, RED);
@ -93,20 +92,12 @@ void Func_MainGameLoop()
UnloadTexture(arctic); UnloadTexture(arctic);
} }
void Func_CheckHitboxToggle()
{
if (IsKeyPressed(KEY_H)) ShowHitbox = !ShowHitbox;
}
int main() int main()
{ {
Func_Setup(); Setup();
Func_MainGameLoop(); MainGameLoop();
CloseWindow(); CloseWindow();
License();
Func_License();
return 0; return 0;
} }

View File

@ -1,3 +1,4 @@
#include <stdbool.h>
#pragma once #pragma once
// makes the Varaibles globle across c files // makes the Varaibles globle across c files
@ -5,3 +6,6 @@ extern float TuxPos_x;
extern float TuxPos_y; extern float TuxPos_y;
extern float EnemyPos_x; extern float EnemyPos_x;
extern float EnemyPos_y; extern float EnemyPos_y;
extern bool ShowHitbox;
extern bool ToggleShowPos;