Compare commits
	
		
			No commits in common. "5fe59448f6f8cc401d1c0384c874c97caa9a5a48" and "4a52d509c98a4e6fce8b1cdde385d60a7a1c5d88" have entirely different histories.
		
	
	
		
			5fe59448f6
			...
			4a52d509c9
		
	
		
							
								
								
									
										2
									
								
								01_text_adventure/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								01_text_adventure/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1,4 +1,2 @@ | ||||
| fatal_text_adventure_linux | ||||
| fatal_text_adventure_windows.exe | ||||
| fatal_text_adventure_linux.zip | ||||
| fatal_text_adventure_windows.zip | ||||
| @ -40,14 +40,6 @@ clean: | ||||
| 	rm -f ./$(GAME)_windows.exe | ||||
| 	rm -f ./data/*.c | ||||
| 
 | ||||
| $(GAME)_linux.zip: $(GAME)_linux | ||||
| 	rm -f ./$(GAME)_linux.zip | ||||
| 	zip -r $(GAME)_linux.zip $(GAME)_linux img/*.png | ||||
| 
 | ||||
| $(GAME)_windows.zip: $(GAME)_windows.exe | ||||
| 	rm -f ./$(GAME)_windows.zip | ||||
| 	zip -r $(GAME)_windows.zip $(GAME)_windows.exe img/*.png | ||||
| 
 | ||||
| butler_upload: $(GAME)_linux.zip $(GAME)_windows.zip | ||||
| 	$(BUTLER) push ./$(GAME)_linux.zip bassguitarbill/fatal-distractions:$(ITCH_CHANNEL_LINUX) | ||||
| 	$(BUTLER) push ./$(GAME)_windows.zip bassguitarbill/fatal-distractions:$(ITCH_CHANNEL_WINDOWS) | ||||
| butler_upload: $(GAME)_linux $(GAME)_windows | ||||
| 	$(BUTLER) push ./$(GAME)_linux bassguitarbill/fatal-distractions:$(ITCH_CHANNEL_LINUX) | ||||
| 	$(BUTLER) push ./$(GAME)_windows.exe bassguitarbill/fatal-distractions:$(ITCH_CHANNEL_WINDOWS) | ||||
|  | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 7.1 KiB | 
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 6.6 KiB | 
| @ -1,54 +0,0 @@ | ||||
| #include <stdlib.h> | ||||
| #include "intro.h" | ||||
| 
 | ||||
| #define FONT_SIZE 36 | ||||
| 
 | ||||
| void display_loading(void) { | ||||
|   int window_width = GetRenderWidth();  | ||||
|   int window_height = GetRenderHeight();  | ||||
|   int loading_width = MeasureText("Loading...", FONT_SIZE); | ||||
|   BeginDrawing(); | ||||
|   DrawText("Loading...", window_width - loading_width, window_height - FONT_SIZE, FONT_SIZE, RAYWHITE); | ||||
|   EndDrawing(); | ||||
| } | ||||
| 
 | ||||
| Intro *load_intro(void) { | ||||
|   Intro *i = malloc(sizeof(Intro)); | ||||
|   i->textures = malloc(sizeof(Texture) * 2); | ||||
| 
 | ||||
|   Image bgb = LoadImage("img/made_by_bgb.png"); | ||||
|   i->textures[0] = LoadTextureFromImage(bgb); | ||||
|   UnloadImage(bgb); | ||||
| 
 | ||||
|   Image ray = LoadImage("img/made_w_raylib.png"); | ||||
|   i->textures[1] = LoadTextureFromImage(ray); | ||||
|   UnloadImage(ray); | ||||
| 
 | ||||
|   i->texture_count = 2; | ||||
|   i->timer = 0.; | ||||
|   return i; | ||||
| } | ||||
| 
 | ||||
| #define SLIDE_TIME 2.0 | ||||
| #define FADE_IN_TIME 0.5 | ||||
| #define FADE_OUT_TIME 0.5 | ||||
| void intro_display(Intro *intro) { | ||||
|   float frame_time, elapsed_time, alpha; | ||||
|   for (int i = 0; i < intro->texture_count; i++) { | ||||
|     intro->timer = GetTime() + SLIDE_TIME; | ||||
|     while((frame_time = GetTime()) < intro->timer) { | ||||
|       elapsed_time = SLIDE_TIME - (intro->timer - frame_time); | ||||
|       if (elapsed_time < FADE_IN_TIME) | ||||
| 	alpha = ((FADE_IN_TIME - elapsed_time) / FADE_IN_TIME) * 255.; | ||||
|       else if (elapsed_time > SLIDE_TIME - FADE_OUT_TIME) | ||||
| 	alpha = ((elapsed_time - (SLIDE_TIME - FADE_OUT_TIME)) / FADE_OUT_TIME) * 255.; | ||||
|       else | ||||
| 	alpha = 0; | ||||
| 
 | ||||
|       BeginDrawing(); | ||||
|       DrawTexture(intro->textures[i], 0, 0, WHITE); | ||||
|       DrawRectangle(0, 0, 800, 450, (Color) { 0, 0, 0, alpha }); | ||||
|       EndDrawing(); | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @ -1,18 +0,0 @@ | ||||
| #ifndef _FD_INTRO_ | ||||
| #define _FD_INTRO_ | ||||
| 
 | ||||
| typedef struct Intro Intro; | ||||
| 
 | ||||
| #include <raylib.h> | ||||
| 
 | ||||
| struct Intro { | ||||
|   Texture *textures; | ||||
|   int texture_count; | ||||
|   double timer; | ||||
| }; | ||||
| 
 | ||||
| void display_loading(void); | ||||
| Intro *load_intro(void); | ||||
| void intro_display(Intro *i); | ||||
| 
 | ||||
| #endif | ||||
| @ -4,17 +4,12 @@ | ||||
| 
 | ||||
| #include <raylib.h> | ||||
| 
 | ||||
| #include "intro.h" | ||||
| #include "game.h" | ||||
| 
 | ||||
| int main(int argc, char** argv) { | ||||
| int main(void) { | ||||
|     InitWindow(800, 450, "Text Adventure"); | ||||
|     SetTargetFPS(60); | ||||
| 
 | ||||
|     display_loading(); | ||||
|     Intro *i = load_intro(); | ||||
|     intro_display(i); | ||||
| 
 | ||||
|     Game *g = game_create(); | ||||
| 
 | ||||
|     game_run_until_close(g); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user