Début de la saeé
This commit is contained in:
+50
@@ -0,0 +1,50 @@
|
||||
#include "game.h"
|
||||
|
||||
|
||||
void game_init(struct GameState* state, int rows, int cols)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
void game_move(struct GameState* state, int tile)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
int game_can_move(const struct GameState* state, int tile)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int game_is_solved(const struct GameState* state)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void game_shuffle(struct GameState* state)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
#include "game.h"
|
||||
|
||||
#include "game_view.h"
|
||||
|
||||
#include "menu_view.h"
|
||||
|
||||
#include "input.h"
|
||||
|
||||
|
||||
int main(void)
|
||||
|
||||
{
|
||||
|
||||
/* TODO : initialiser la bibliothèque graphique */
|
||||
|
||||
/* TODO : boucle principale */
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#ifndef GAME_H
|
||||
|
||||
#define GAME_H
|
||||
|
||||
|
||||
struct GameState {
|
||||
|
||||
int rows;
|
||||
|
||||
int cols;
|
||||
|
||||
int empty_index;
|
||||
|
||||
int moves;
|
||||
|
||||
int is_over;
|
||||
|
||||
int *permutation;
|
||||
|
||||
};
|
||||
|
||||
|
||||
void game_init(struct GameState* state, int rows, int cols);
|
||||
|
||||
void game_move(struct GameState* state, int tile);
|
||||
|
||||
int game_can_move(const struct GameState* state, int tile);
|
||||
|
||||
int game_is_solved(const struct GameState* state);
|
||||
|
||||
void game_shuffle(struct GameState* state);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "game_view.h"
|
||||
|
||||
|
||||
void render_game(const struct GameState* state)
|
||||
|
||||
{
|
||||
|
||||
/* TODO : dessiner les tuiles */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
Baptiste LECOINTRE <baptou.lecointre@gmail.com>
|
||||
|
||||
12:59 (il y a 0 minute)
|
||||
|
||||
|
||||
À moi
|
||||
|
||||
#ifndef GAME_H
|
||||
|
||||
#define GAME_H
|
||||
|
||||
|
||||
struct GameState {
|
||||
|
||||
int rows;
|
||||
|
||||
int cols;
|
||||
|
||||
int empty_index;
|
||||
|
||||
int moves;
|
||||
|
||||
int is_over;
|
||||
|
||||
int *permutation;
|
||||
|
||||
};
|
||||
|
||||
|
||||
void game_init(struct GameState* state, int rows, int cols);
|
||||
|
||||
void game_move(struct GameState* state, int tile);
|
||||
|
||||
int game_can_move(const struct GameState* state, int tile);
|
||||
|
||||
int game_is_solved(const struct GameState* state);
|
||||
|
||||
void game_shuffle(struct GameState* state);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef GAME_VIEW_H
|
||||
|
||||
#define GAME_VIEW_H
|
||||
|
||||
|
||||
#include "game.h"
|
||||
|
||||
|
||||
void render_game(const struct GameState* state);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+180
@@ -0,0 +1,180 @@
|
||||
Baptiste LECOINTRE <baptou.lecointre@gmail.com>
|
||||
|
||||
13:01 (il y a 3 minutes)
|
||||
|
||||
|
||||
À moi
|
||||
Ce message semble être en anglais
|
||||
|
||||
#include "game.h"
|
||||
|
||||
#include "game_view.h"
|
||||
|
||||
#include "menu_view.h"
|
||||
|
||||
#include "input.h"
|
||||
|
||||
|
||||
int main(void)
|
||||
|
||||
{
|
||||
|
||||
/* TODO : initialiser la bibliothèque graphique */
|
||||
|
||||
/* TODO : boucle principale */
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "game.h"
|
||||
|
||||
|
||||
void game_init(struct GameState* state, int rows, int cols)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
void game_move(struct GameState* state, int tile)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
int game_can_move(const struct GameState* state, int tile)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int game_is_solved(const struct GameState* state)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void game_shuffle(struct GameState* state)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "game_view.h"
|
||||
|
||||
|
||||
void render_game(const struct GameState* state)
|
||||
|
||||
{
|
||||
|
||||
/* TODO : dessiner les tuiles */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "menu_view.h"
|
||||
|
||||
|
||||
void render_menu(const struct MenuState* menu)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
void menu_handle_mouse(struct MenuState* menu, int x, int y)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
void menu_handle_key(struct MenuState* menu, int key)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "input.h"
|
||||
|
||||
|
||||
void input_handle_mouse_game(struct GameState* state, int x, int y)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
void input_handle_key_game(struct GameState* state, int key)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "images.h"
|
||||
|
||||
|
||||
Image load_image(const char* path)
|
||||
|
||||
{
|
||||
|
||||
Image img;
|
||||
|
||||
/* TODO */
|
||||
|
||||
return img;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void slice_image_into_tiles(const Image img, int rows, int cols)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef IMAGES_H
|
||||
|
||||
#define IMAGES_H
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
/* dépend de la bibliothèque de l’IUT */
|
||||
|
||||
int width;
|
||||
|
||||
int height;
|
||||
|
||||
void* data;
|
||||
|
||||
} Image;
|
||||
|
||||
|
||||
Image load_image(const char* path);
|
||||
|
||||
void slice_image_into_tiles(const Image img, int rows, int cols);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
ifndef IMAGES_H
|
||||
|
||||
#define IMAGES_H
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
/* dépend de la bibliothèque de l’IUT */
|
||||
|
||||
int width;
|
||||
|
||||
int height;
|
||||
|
||||
void* data;
|
||||
|
||||
} Image;
|
||||
|
||||
|
||||
Image load_image(const char* path);
|
||||
|
||||
void slice_image_into_tiles(const Image img, int rows, int cols);
|
||||
|
||||
|
||||
#endif
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
Baptiste LECOINTRE <baptou.lecointre@gmail.com>
|
||||
|
||||
13:01 (il y a 3 minutes)
|
||||
|
||||
|
||||
À moi
|
||||
Ce message semble être en anglais
|
||||
|
||||
#include "game.h"
|
||||
|
||||
#include "game_view.h"
|
||||
|
||||
#include "menu_view.h"
|
||||
|
||||
#include "input.h"
|
||||
|
||||
|
||||
int main(void)
|
||||
|
||||
{
|
||||
|
||||
/* TODO : initialiser la bibliothèque graphique */
|
||||
|
||||
/* TODO : boucle principale */
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "game.h"
|
||||
|
||||
|
||||
void game_init(struct GameState* state, int rows, int cols)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
void game_move(struct GameState* state, int tile)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
int game_can_move(const struct GameState* state, int tile)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int game_is_solved(const struct GameState* state)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void game_shuffle(struct GameState* state)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "game_view.h"
|
||||
|
||||
|
||||
void render_game(const struct GameState* state)
|
||||
|
||||
{
|
||||
|
||||
/* TODO : dessiner les tuiles */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "menu_view.h"
|
||||
|
||||
|
||||
void render_menu(const struct MenuState* menu)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
void menu_handle_mouse(struct MenuState* menu, int x, int y)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
void menu_handle_key(struct MenuState* menu, int key)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "input.h"
|
||||
|
||||
|
||||
void input_handle_mouse_game(struct GameState* state, int x, int y)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
void input_handle_key_game(struct GameState* state, int key)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
#ifndef INPUT_H
|
||||
|
||||
#define INPUT_H
|
||||
|
||||
|
||||
#include "game.h"
|
||||
|
||||
#include "menu_view.h"
|
||||
|
||||
|
||||
void input_handle_mouse_game(struct GameState* state, int x, int y);
|
||||
|
||||
void input_handle_key_game(struct GameState* state, int key);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
#include "game.h"
|
||||
|
||||
#include "game_view.h"
|
||||
|
||||
#include "menu_view.h"
|
||||
|
||||
#include "input.h"
|
||||
|
||||
|
||||
int main(void)
|
||||
|
||||
{
|
||||
|
||||
/* TODO : initialiser la bibliothèque graphique */
|
||||
|
||||
/* TODO : boucle principale */
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
|
||||
#include "menu_view.h"
|
||||
|
||||
|
||||
void render_menu(const struct MenuState* menu)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
void menu_handle_mouse(struct MenuState* menu, int x, int y)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
void menu_handle_key(struct MenuState* menu, int key)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
|
||||
#ifndef MENU_VIEW_H
|
||||
|
||||
#define MENU_VIEW_H
|
||||
|
||||
|
||||
struct MenuState {
|
||||
|
||||
int selected_image;
|
||||
|
||||
int rows;
|
||||
|
||||
int cols;
|
||||
|
||||
int ready;
|
||||
|
||||
};
|
||||
|
||||
|
||||
void render_menu(const struct MenuState* menu);
|
||||
|
||||
void menu_handle_mouse(struct MenuState* menu, int x, int y);
|
||||
|
||||
void menu_handle_key(struct MenuState* menu, int key);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+207
@@ -0,0 +1,207 @@
|
||||
Baptiste LECOINTRE <baptou.lecointre@gmail.com>
|
||||
|
||||
13:01 (il y a 4 minutes)
|
||||
|
||||
|
||||
À moi
|
||||
Ce message semble être en anglais
|
||||
|
||||
#include "game.h"
|
||||
|
||||
#include "game_view.h"
|
||||
|
||||
#include "menu_view.h"
|
||||
|
||||
#include "input.h"
|
||||
|
||||
|
||||
int main(void)
|
||||
|
||||
{
|
||||
|
||||
/* TODO : initialiser la bibliothèque graphique */
|
||||
|
||||
/* TODO : boucle principale */
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "game.h"
|
||||
|
||||
|
||||
void game_init(struct GameState* state, int rows, int cols)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
void game_move(struct GameState* state, int tile)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
int game_can_move(const struct GameState* state, int tile)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int game_is_solved(const struct GameState* state)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void game_shuffle(struct GameState* state)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "game_view.h"
|
||||
|
||||
|
||||
void render_game(const struct GameState* state)
|
||||
|
||||
{
|
||||
|
||||
/* TODO : dessiner les tuiles */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "menu_view.h"
|
||||
|
||||
|
||||
void render_menu(const struct MenuState* menu)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
void menu_handle_mouse(struct MenuState* menu, int x, int y)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
void menu_handle_key(struct MenuState* menu, int key)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "input.h"
|
||||
|
||||
|
||||
void input_handle_mouse_game(struct GameState* state, int x, int y)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
void input_handle_key_game(struct GameState* state, int key)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "images.h"
|
||||
|
||||
|
||||
Image load_image(const char* path)
|
||||
|
||||
{
|
||||
|
||||
Image img;
|
||||
|
||||
/* TODO */
|
||||
|
||||
return img;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void slice_image_into_tiles(const Image img, int rows, int cols)
|
||||
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
|
||||
int random_int(int max)
|
||||
|
||||
{
|
||||
|
||||
return rand() % max;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void swap(int* a, int* b)
|
||||
|
||||
{
|
||||
|
||||
int tmp = *a;
|
||||
|
||||
*a = *b;
|
||||
|
||||
*b = tmp;
|
||||
|
||||
}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
#ifndef UTILS_H
|
||||
|
||||
#define UTILS_H
|
||||
|
||||
|
||||
int random_int(int max);
|
||||
|
||||
void swap(int* a, int* b);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user