Functions for App
This commit is contained in:
		
							
								
								
									
										32
									
								
								App.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								App.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
 | 
			
		||||
#include "App.h"
 | 
			
		||||
#include "Input.h"
 | 
			
		||||
#include "Physics_Component.h"
 | 
			
		||||
#include "Player_Component.h"
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
App *app_NewApp() {
 | 
			
		||||
	App *app = malloc(sizeof(App));
 | 
			
		||||
 | 
			
		||||
	app->input   = input_NewSystem(app);
 | 
			
		||||
	app->physics = physics_NewSystem(app);
 | 
			
		||||
	app->player  = player_NewSystem(app);
 | 
			
		||||
 | 
			
		||||
	return app;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void app_DeleteApp(App *app) {
 | 
			
		||||
	input_DeleteSystem(app->input);
 | 
			
		||||
	physics_DeleteSystem(app->physics);
 | 
			
		||||
	player_DeleteSystem(app->player);
 | 
			
		||||
 | 
			
		||||
	free(app);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void app_Advance(App *app, Duration deltaTime) {
 | 
			
		||||
	input_Advance(app->input);
 | 
			
		||||
	player_Advance(app->player, deltaTime);
 | 
			
		||||
	physics_Advance(app->physics, deltaTime);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7
									
								
								App.h
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								App.h
									
									
									
									
									
								
							@@ -4,6 +4,7 @@
 | 
			
		||||
#include "Physics_Component.h"
 | 
			
		||||
#include "Player_Component.h"
 | 
			
		||||
#include "Input.h"
 | 
			
		||||
#include "Types.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typedef struct _App {
 | 
			
		||||
@@ -11,3 +12,9 @@ typedef struct _App {
 | 
			
		||||
	System_Player  *player;
 | 
			
		||||
	System_Input   *input;
 | 
			
		||||
} App;
 | 
			
		||||
 | 
			
		||||
App *app_NewApp();
 | 
			
		||||
void app_DeleteApp(App *app);
 | 
			
		||||
 | 
			
		||||
void app_Advance(App *app, Duration deltaTime);
 | 
			
		||||
void app_Render();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user