Creating a scene

This commit is contained in:
Tristan Roux
2019-12-02 17:18:17 +01:00
parent 2279787b30
commit 7b91d94757
12 changed files with 37 additions and 44 deletions
+2 -1
View File
@@ -6,7 +6,8 @@
##
SRC = main.c \
src/game_loader.c
src/game_loader.c \
src/scenes/game_scene.c
OBJ = $(SRC:%.c=%.o)
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

+6 -2
View File
@@ -5,6 +5,10 @@
** runner
*/
#define ERROR 84
#pragma once
int start_game();
#define ERROR 84
#include "scene.h"
int start_game(void);
gc_scene *create_game_scene(void);
Submodule lib/gamacon updated: 675699dc5e...7964f4ead3
-21
View File
@@ -1,21 +0,0 @@
/*
** EPITECH PROJECT, 2019
** Str dup replicate
** File description:
** MALLOC YES
*/
#include <stdlib.h>
int my_strlen(const char *src);
char *my_strdup(const char *src)
{
int length = my_strlen(src);
char *ret = malloc(sizeof(char) * (length + 1));
for (int i = 0; i < length; i++)
ret[i] = src[i];
ret[length] = '\0';
return (ret);
}
-16
View File
@@ -1,16 +0,0 @@
/*
** EPITECH PROJECT, 2019
** CPool_Day04_2019
** File description:
** Strlen
*/
int my_strlen(const char *str)
{
if (str == 0)
return (0);
for (int i = 0; 1; i++) {
if (*(str + i) == '\0')
return i;
}
}
+1 -1
View File
@@ -8,7 +8,7 @@
#include "runner.h"
#include "my.h"
int usage()
int usage(void)
{
return (ERROR);
}
+7 -2
View File
@@ -6,11 +6,16 @@
*/
#include "engine.h"
#include "runner.h"
int start_game()
int start_game(void)
{
gcEngine *engine = create_engine("Runner");
gc_engine *engine = engine_create("Runner");
gc_scene *scene = create_game_scene();
if (!engine || !scene)
return (ERROR);
engine->change_scene(engine, scene);
while (engine->is_open(engine)) {
engine->game_loop(engine);
}
+20
View File
@@ -0,0 +1,20 @@
/*
** EPITECH PROJECT, 2019
** MUL_my_runner_2019
** File description:
** game_scene
*/
#include "scene.h"
#include <stddef.h>
static const char *textures[] = {"assets/sprites/bck_layer1.png", \
"assets/sprites/bck_layer2.png", "assets/sprites/bck_layer3.png", \
"assets/sprites/bck_layer4.png", NULL};
gc_scene *create_game_scene(void)
{
gc_scene *scene = scene_create(textures);
return (scene);
}