Map editor

This commit is contained in:
Anonymus Raccoon
2020-04-14 15:25:08 +02:00
27 changed files with 633 additions and 65 deletions
+24
View File
@@ -0,0 +1,24 @@
//
// Created by anonymus-raccoon on 3/3/20.
//
#ifndef _TEAMS_COMPONENT_C_
#define _TEAMS_COMPONENT_H_
#include "component.h"
typedef enum display_type
{
SELECT_TILE_DISPLAY
} display_type_enum;
struct game_display
{
gc_component base;
display_type_enum type;
};
const struct game_display game_display;
const struct gc_system game_display_system;
#endif //_TEAMS_COMPONENT_C_
+73
View File
@@ -0,0 +1,73 @@
/*
** EPITECH PROJECT, 2020
** my_rpg
** File description:
** map_editor.h
*/
#ifndef MY_RPG_MAP_EDITOR_H
#define MY_RPG_MAP_EDITOR_H
#include "engine.h"
#include "components/vertex_component.h"
#include "keybindings.h"
#include "component.h"
#include <stdbool.h>
enum modes_on_tile {
VERTEX_0 = 2,
VERTEX_1 = 4,
VERTEX_2 = 8,
VERTEX_3 = 16,
ALL_VERTICES = 30,
INVERT_ADD_VALUE = 1
};
bool map_onclick(gc_engine *engine, gc_entity *entity, gc_vector2 pos, \
enum gc_mousekeys key);
bool tile_select(gc_engine *engine, gc_entity *entity, gc_vector2 _,
enum gc_mousekeys __);
bool vertex_select(gc_engine *engine, gc_entity *entity, gc_vector2 _,
enum gc_mousekeys __);
bool up_down(gc_engine *engine, gc_entity *entity, gc_vector2 _,
enum gc_mousekeys __);
bool reset(gc_engine *engine, gc_entity *entity, gc_vector2 _,
enum gc_mousekeys __);
bool rotate(gc_engine *engine, gc_entity *entity, gc_vector2 _,
enum gc_mousekeys __);
bool texture(gc_engine *engine, gc_entity *entity, gc_vector2 _,
enum gc_mousekeys __);
bool switch_texture(gc_engine *engine, gc_entity *entity, gc_vector2 _,
enum gc_mousekeys __);
bool save_map(gc_engine *engine, gc_entity *entity, gc_vector2 _,
enum gc_mousekeys __);
enum brush
{
MOVE,
RESET,
ROTATE,
TEXTURE
};
struct map_manager_component
{
gc_component base;
bool tile_mode;
enum brush brush;
void *selected_texture;
};
const struct map_manager_component map_manager_component;
#define ADD_VALUE 10
void move_verticies(gc_engine *engine, struct tile *ret, char mode, bool r);
int get_index_nearest_vertex(struct tile *sel, gc_vector2 pos);
struct tile *get_tile_from_pos(struct vertex_component *map, gc_vector2 pos);
bool map_manage_click(gc_engine *engine, int id, gc_vector2 pos);
gc_vector2 gc_vector2_from_coords(float x, float y, float z);
bool is_pos_in_tile(gc_vector2 pos, struct tile *tile);
#endif //MY_RPG_MAP_EDITOR_H
+1 -1
View File
@@ -10,7 +10,7 @@
#define ERROR 84
#include "scene.h"
int start_game(void);
int start_game(bool map_editor);
bool start_button(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
enum gc_mousekeys __);