Compare commits
2 Commits
ee4cde886d
...
a498acb4d9
| Author | SHA1 | Date |
|---|---|---|
|
|
a498acb4d9 | |
|
|
965015fa6d |
|
|
@ -1,5 +1,5 @@
|
|||
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||
# 2D_Engine_C SDL2 Core
|
||||
# 2D_Engine_C_SDL2_Core
|
||||
|
||||
## Description
|
||||
The core made on SDL2 for the multi-platform 2D_Engine_C.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
# Source files
|
||||
CORE_SOURCES := \
|
||||
asset_manager.c \
|
||||
texture_manager.c \
|
||||
event.c \
|
||||
vector2d.c \
|
||||
|
|
@ -8,7 +9,7 @@ CORE_SOURCES := \
|
|||
|
||||
# Compiler and flags
|
||||
CORE_CC = gcc
|
||||
CORE_CFLAGS = -Wall -Wextra -std=c17 -fPIC -g
|
||||
CORE_CFLAGS = -Wall -Wextra -std=c17 -fPIC -g -DASSET_FILE=$(ASSET_OUTPUT)
|
||||
CORE_INCLUDE_DIRS = $(CORE_DIR)/headers
|
||||
CORE_LDFLAGS = $(shell sdl2-config --cflags --libs)
|
||||
|
||||
|
|
@ -26,7 +27,7 @@ core_setup:
|
|||
@echo "Building libCore.so (1/3)"
|
||||
$(Q)mkdir -p $(dir $(CORE_OBJECTS))
|
||||
|
||||
# Count files to build
|
||||
# Count nb of files to build
|
||||
count_core_build:
|
||||
$(eval export TOTAL_CORE_FILES := $(shell echo $$(($$(make -n $(CORE_OBJECTS) 2>/dev/null | grep -c "Building") + 1))))
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
#include "asset_manager.h"
|
||||
|
||||
#include <SDL2/SDL_render.h>
|
||||
#include "display.h"
|
||||
#include "linked_list.h"
|
||||
|
||||
|
||||
|
||||
static void temporary_extract_asset(const char *path)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
SDL_Texture load_image(const char *path)
|
||||
{
|
||||
IMG_LoadTexture(renderer, path);
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
#include "display.h"
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_image.h>
|
||||
|
||||
SDL_Window *window = NULL;
|
||||
SDL_Renderer *renderer = NULL;
|
||||
|
|
@ -8,6 +9,8 @@ SDL_Renderer *renderer = NULL;
|
|||
void display_init(void)
|
||||
{
|
||||
SDL_Init(SDL_INIT_EVERYTHING);
|
||||
IMG_Init(IMG_INIT_PNG);
|
||||
|
||||
window = SDL_CreateWindow("2D_Engine", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, DISPLAY_WIDTH * DISPLAY_SCALE, DISPLAY_HEIGHT * DISPLAY_SCALE, SDL_WINDOW_SHOWN);
|
||||
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef ASSET_MANAGER_H
|
||||
#define ASSET_MANAGER_H
|
||||
|
||||
#include <SDL2/SDL_image.h>
|
||||
|
||||
SDL_Texture load_image(const char *path);
|
||||
|
||||
#endif // ASSET_MANAGER_H
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef MALLOC_H
|
||||
#define MALLOC_H
|
||||
#ifndef MEMORY_ALLOC_H
|
||||
#define MEMORY_ALLOC_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#endif // MALLOC_H
|
||||
#endif // MEMORY_ALLOC_H
|
||||
|
|
@ -37,6 +37,7 @@ inline void texture_manager_init(texture_manager_t *texture_manager)
|
|||
|
||||
inline void texture_manager_load_texture(texture_manager_t *texture_manager, const char *name)
|
||||
{
|
||||
texture_t *texture;
|
||||
linked_list_push_back(&texture_manager->textures, texture);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue