mirror of
https://github.com/zoriya/Twac.git
synced 2026-06-03 02:41:44 +00:00
Creating a scene
This commit is contained in:
@@ -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
@@ -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);
|
||||
+1
-1
Submodule lib/gamacon updated: 675699dc5e...7964f4ead3
@@ -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);
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "runner.h"
|
||||
#include "my.h"
|
||||
|
||||
int usage()
|
||||
int usage(void)
|
||||
{
|
||||
return (ERROR);
|
||||
}
|
||||
|
||||
+7
-2
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user