Remove stdstring, use platform layer to open files
This commit is contained in:
@@ -1,38 +1,25 @@
|
||||
#ifndef DENGINE_ASSET_MANAGER_H
|
||||
#define DENGINE_ASSET_MANAGER_H
|
||||
|
||||
#include <Dengine/Common.h>
|
||||
#include <Dengine/Platform.h>
|
||||
#include <Dengine/Shader.h>
|
||||
#include <Dengine/Texture.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
enum Assets
|
||||
{
|
||||
asset_vertShader,
|
||||
asset_fragShader,
|
||||
asset_hero,
|
||||
};
|
||||
|
||||
struct AssetManager
|
||||
{
|
||||
Textures textures[256];
|
||||
Shaders shaders[256];
|
||||
};
|
||||
extern std::map<std::string, Texture> textures;
|
||||
extern std::map<std::string, Shader> shaders;
|
||||
|
||||
/* Texture */
|
||||
Texture *asset_getTexture(const std::string name);
|
||||
const i32 asset_loadTextureImage(const std::string path,
|
||||
const std::string name);
|
||||
Texture *asset_getTexture(const char *const name);
|
||||
const i32 asset_loadTextureImage(const char *const path,
|
||||
const char *const name);
|
||||
|
||||
/* Shaders */
|
||||
Shader *asset_getShader(const std::string name);
|
||||
const i32 asset_loadShaderFiles(const std::string vertexPath,
|
||||
const std::string fragmentPath,
|
||||
const std::string name);
|
||||
Shader *asset_getShader(const char *const name);
|
||||
const i32 asset_loadShaderFiles(const char *const vertexPath,
|
||||
const char *const fragmentPath,
|
||||
const char *const name);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define DENGINE_COMMON_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef uint8_t u8;
|
||||
typedef uint32_t u32;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef DENGINE_ENTITY_H
|
||||
#define DENGINE_ENTITY_H
|
||||
|
||||
#include <Dengine/Common.h>
|
||||
#include <Dengine/Texture.h>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef DENGINE_PLATFORM_H
|
||||
#define DENGINE_PLATFORM_H
|
||||
|
||||
#include <Dengine/Common.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <Windows.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *buffer;
|
||||
i32 size;
|
||||
} PlatformFileReadResult;
|
||||
|
||||
i32 platform_readFileToBuffer(const char *const filePath,
|
||||
PlatformFileReadResult *file);
|
||||
|
||||
inline void platform_closeFileReadResult(PlatformFileReadResult *file)
|
||||
{
|
||||
if (file->buffer)
|
||||
{
|
||||
free(file->buffer);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user