Commit 14a2bd13 authored by Michael Chen's avatar Michael Chen
Browse files

Sorted the assets into folders and created Makefile.

parent bc9f0a7a
all:
gcc -Wall -IC:\SDL2\x32\include *.c -LC:\SDL2\x32\lib -lmingw32 -lSDL2main -lSDL2 -lopengl32 -lSDL2_image -lSDL2_ttf -o Asteroids.exe
......@@ -62,9 +62,9 @@ void BULLET_Initialize(SDL_Renderer * renderer, int width, int height){
}; // Default or null bullet
BULLET_BoxWidth = width;
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");
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");
printf("Bullet initialized!\n");
}
......@@ -159,7 +159,7 @@ void ASTEROID_Initialize(SDL_Renderer * renderer, int width, int height){
printf("Initializing Asteroid...\n");
ASTEROID_BoxWidth = width;
ASTEROID_BoxHeight = height;
ASTEROID_Texture = IMG_LoadTexture(renderer, "asteroid.png");
ASTEROID_Texture = IMG_LoadTexture(renderer, "assets/images/asteroid.png");
ASTEROIDULLET = (Asteroid) {
.Rotation = 0.0f,
.Size = 0.0f,
......@@ -291,7 +291,7 @@ void ENEMY_Initialize(SDL_Renderer * renderer, int width, int height){
BULLET_Initialize(renderer, width, height);
ENEMY_BoxWidth = width;
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");
ENEMY_MaxBulletCount = ((BULLET_DecayTime_Ally / ENEMY_ShootIntevale) + 10);
printf("Enemy initialized!\n");
......@@ -380,11 +380,11 @@ void SHIP_Initialize(SDL_Renderer * renderer, int width, int height){
BULLET_Initialize(renderer, width, height);
SHIP_BoxWidth = width;
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");
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");
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");
SHIP_SourceRect_Explosion = calloc(5, sizeof(SDL_Rect));
if (!SHIP_SourceRect_Explosion) printf("Memory for SDL_Rect (SHIP) cannot be allocated!\n");
......
......@@ -116,7 +116,7 @@ void INITIALIZE() {
else printf("IMG was successfully initialized!\n");
TTF_Init();
Sans = TTF_OpenFont("bulky.ttf", 12);
Sans = TTF_OpenFont("assets/fonts/bulky.ttf", 12);
if (!Sans) printf("Font cannot be initialized!\n");
else printf("Font was successfully initialized!\n");
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");
STARFIELD_BoxWidth = width;
STARFIELD_BoxHeight = height;
STAR_Texture = IMG_LoadTexture(renderer, "star.png");
STAR_Texture = IMG_LoadTexture(renderer, "assets/images/star.png");
if (!STAR_Texture)
printf("Star texture cannot be loaded!\n");
STAR_SourceRects = malloc(3 * sizeof(SDL_Rect));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment