Sorted the assets into folders and created Makefile.
This commit is contained in:
parent
bc9f0a7aa2
commit
14a2bd131f
2
Makefile
Normal file
2
Makefile
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
all:
|
||||||
|
gcc -Wall -IC:\SDL2\x32\include *.c -LC:\SDL2\x32\lib -lmingw32 -lSDL2main -lSDL2 -lopengl32 -lSDL2_image -lSDL2_ttf -o Asteroids.exe
|
14
asteroids.c
14
asteroids.c
@ -62,9 +62,9 @@ void BULLET_Initialize(SDL_Renderer * renderer, int width, int height){
|
|||||||
}; // Default or null bullet
|
}; // Default or null bullet
|
||||||
BULLET_BoxWidth = width;
|
BULLET_BoxWidth = width;
|
||||||
BULLET_BoxHeight = height;
|
BULLET_BoxHeight = height;
|
||||||
BULLET_Texture_Ally = IMG_LoadTexture(renderer, "bullet.png");
|
BULLET_Texture_Ally = IMG_LoadTexture(renderer, "assets/images/bullet.png");
|
||||||
if (!BULLET_Texture_Ally) printf("Ally bullet texture cannot be loaded!\n");
|
if (!BULLET_Texture_Ally) printf("Ally bullet texture cannot be loaded!\n");
|
||||||
BULLET_Texture_Enemy = IMG_LoadTexture(renderer, "enemyBullet.png");
|
BULLET_Texture_Enemy = IMG_LoadTexture(renderer, "assets/images/enemyBullet.png");
|
||||||
if (!BULLET_Texture_Enemy) printf("Enemy bullet texture cannot be loaded!\n");
|
if (!BULLET_Texture_Enemy) printf("Enemy bullet texture cannot be loaded!\n");
|
||||||
printf("Bullet initialized!\n");
|
printf("Bullet initialized!\n");
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ void ASTEROID_Initialize(SDL_Renderer * renderer, int width, int height){
|
|||||||
printf("Initializing Asteroid...\n");
|
printf("Initializing Asteroid...\n");
|
||||||
ASTEROID_BoxWidth = width;
|
ASTEROID_BoxWidth = width;
|
||||||
ASTEROID_BoxHeight = height;
|
ASTEROID_BoxHeight = height;
|
||||||
ASTEROID_Texture = IMG_LoadTexture(renderer, "asteroid.png");
|
ASTEROID_Texture = IMG_LoadTexture(renderer, "assets/images/asteroid.png");
|
||||||
ASTEROIDULLET = (Asteroid) {
|
ASTEROIDULLET = (Asteroid) {
|
||||||
.Rotation = 0.0f,
|
.Rotation = 0.0f,
|
||||||
.Size = 0.0f,
|
.Size = 0.0f,
|
||||||
@ -291,7 +291,7 @@ void ENEMY_Initialize(SDL_Renderer * renderer, int width, int height){
|
|||||||
BULLET_Initialize(renderer, width, height);
|
BULLET_Initialize(renderer, width, height);
|
||||||
ENEMY_BoxWidth = width;
|
ENEMY_BoxWidth = width;
|
||||||
ENEMY_BoxHeight = height;
|
ENEMY_BoxHeight = height;
|
||||||
ENEMY_Texture = IMG_LoadTexture(renderer, "enemy.png");
|
ENEMY_Texture = IMG_LoadTexture(renderer, "assets/images/enemy.png");
|
||||||
if (!ENEMY_Texture) printf("Enemy texture cannot be loaded!\n");
|
if (!ENEMY_Texture) printf("Enemy texture cannot be loaded!\n");
|
||||||
ENEMY_MaxBulletCount = ((BULLET_DecayTime_Ally / ENEMY_ShootIntevale) + 10);
|
ENEMY_MaxBulletCount = ((BULLET_DecayTime_Ally / ENEMY_ShootIntevale) + 10);
|
||||||
printf("Enemy initialized!\n");
|
printf("Enemy initialized!\n");
|
||||||
@ -380,11 +380,11 @@ void SHIP_Initialize(SDL_Renderer * renderer, int width, int height){
|
|||||||
BULLET_Initialize(renderer, width, height);
|
BULLET_Initialize(renderer, width, height);
|
||||||
SHIP_BoxWidth = width;
|
SHIP_BoxWidth = width;
|
||||||
SHIP_BoxHeight = height;
|
SHIP_BoxHeight = height;
|
||||||
SHIP_Texture_Gliding = IMG_LoadTexture(renderer, "ship.png");
|
SHIP_Texture_Gliding = IMG_LoadTexture(renderer, "assets/images/ship.png");
|
||||||
if (!SHIP_Texture_Gliding) printf("Ship texture 1 cannot be loaded!\n");
|
if (!SHIP_Texture_Gliding) printf("Ship texture 1 cannot be loaded!\n");
|
||||||
SHIP_Texture_Accelerating = IMG_LoadTexture(renderer, "shipAcc.png");
|
SHIP_Texture_Accelerating = IMG_LoadTexture(renderer, "assets/images/shipAcc.png");
|
||||||
if (!SHIP_Texture_Accelerating) printf("Ship texture 2 cannot be loaded!\n");
|
if (!SHIP_Texture_Accelerating) printf("Ship texture 2 cannot be loaded!\n");
|
||||||
SHIP_Texture_Explosion = IMG_LoadTexture(renderer, "shipExpl.png");
|
SHIP_Texture_Explosion = IMG_LoadTexture(renderer, "assets/images/shipExpl.png");
|
||||||
if (!SHIP_Texture_Explosion) printf("Ship texture explosion cannot be loaded!\n");
|
if (!SHIP_Texture_Explosion) printf("Ship texture explosion cannot be loaded!\n");
|
||||||
SHIP_SourceRect_Explosion = calloc(5, sizeof(SDL_Rect));
|
SHIP_SourceRect_Explosion = calloc(5, sizeof(SDL_Rect));
|
||||||
if (!SHIP_SourceRect_Explosion) printf("Memory for SDL_Rect (SHIP) cannot be allocated!\n");
|
if (!SHIP_SourceRect_Explosion) printf("Memory for SDL_Rect (SHIP) cannot be allocated!\n");
|
||||||
|
2
main.c
2
main.c
@ -116,7 +116,7 @@ void INITIALIZE() {
|
|||||||
else printf("IMG was successfully initialized!\n");
|
else printf("IMG was successfully initialized!\n");
|
||||||
TTF_Init();
|
TTF_Init();
|
||||||
|
|
||||||
Sans = TTF_OpenFont("bulky.ttf", 12);
|
Sans = TTF_OpenFont("assets/fonts/bulky.ttf", 12);
|
||||||
if (!Sans) printf("Font cannot be initialized!\n");
|
if (!Sans) printf("Font cannot be initialized!\n");
|
||||||
else printf("Font was successfully initialized!\n");
|
else printf("Font was successfully initialized!\n");
|
||||||
messageColor = (SDL_Color) {.r = 125,.g=255,.b = 125,.a = 255};
|
messageColor = (SDL_Color) {.r = 125,.g=255,.b = 125,.a = 255};
|
||||||
|
@ -22,7 +22,7 @@ void STARFIELD_Initialize(SDL_Renderer * renderer, int width, int height){
|
|||||||
printf("Initializing starfield...\n");
|
printf("Initializing starfield...\n");
|
||||||
STARFIELD_BoxWidth = width;
|
STARFIELD_BoxWidth = width;
|
||||||
STARFIELD_BoxHeight = height;
|
STARFIELD_BoxHeight = height;
|
||||||
STAR_Texture = IMG_LoadTexture(renderer, "star.png");
|
STAR_Texture = IMG_LoadTexture(renderer, "assets/images/star.png");
|
||||||
if (!STAR_Texture)
|
if (!STAR_Texture)
|
||||||
printf("Star texture cannot be loaded!\n");
|
printf("Star texture cannot be loaded!\n");
|
||||||
STAR_SourceRects = malloc(3 * sizeof(SDL_Rect));
|
STAR_SourceRects = malloc(3 * sizeof(SDL_Rect));
|
||||||
|
Loading…
Reference in New Issue
Block a user