add gb_makepak

This commit is contained in:
Nishi 2026-01-10 00:55:45 +09:00
commit b66cf8068a
Signed by: nishi
GPG key ID: 27EF69B208EB9343
16 changed files with 349 additions and 5 deletions

View file

@ -0,0 +1,19 @@
#ifndef __GEARBOX_FILE_H__
#define __GEARBOX_FILE_H__
#include <GearBox/MachDep.h>
#include <GearBox/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
GBDECL GBFile GBFileOpen(GBEngine engine, const char* path);
GBDECL int GBFileRead(GBFile file, void* out, int size);
GBDECL void GBFileClose(GBFile file);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -11,5 +11,7 @@
#include <GearBox/Server.h>
#include <GearBox/Math.h>
#include <GearBox/GL.h>
#include <GearBox/File.h>
#include <GearBox/Resource.h>
#endif

View file

@ -0,0 +1,18 @@
#ifndef __GEARBOX_RESOURCE_H__
#define __GEARBOX_RESOURCE_H__
#include <GearBox/MachDep.h>
#include <GearBox/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
GBDECL GBResource GBResourceOpen(GBEngine engine, const char* path);
GBDECL void GBResourceClose(GBResource resource);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,17 @@
#ifndef __GEARBOX_STRING_H__
#define __GEARBOX_STRING_H__
#include <GearBox/MachDep.h>
#include <GearBox/TypeDefs.h>
#ifdef __cplusplus
extern "C" {
#endif
GBDECL char* GBStringDuplicate(const char* str);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,16 +1,23 @@
#ifndef __GEARBOX_TYPEDEFS_H__
#define __GEARBOX_TYPEDEFS_H__
#include <GearBox/MachDep.h>
typedef struct _GBVersion GBVersion;
typedef struct _GBEngineParam GBEngineParam;
typedef struct _GBResourceKV GBResourceKV;
#ifdef _GEARBOX
typedef struct _GBClient* GBClient;
typedef struct _GBServer* GBServer;
typedef struct _GBEngine* GBEngine;
typedef struct _GBClient* GBClient;
typedef struct _GBServer* GBServer;
typedef struct _GBEngine* GBEngine;
typedef struct _GBFile* GBFile;
typedef struct _GBResource* GBResource;
#else
typedef void* GBClient;
typedef void* GBServer;
typedef void* GBEngine;
typedef void* GBFile;
typedef void* GBResource;
#endif
typedef void (*GBGLSwapBufferCallback)(void);
@ -19,6 +26,11 @@ typedef void (*GBTickCallback)(void);
typedef long (*GBGetTickCallback)(void);
typedef void (*GBSleepCallback)(int ms);
struct _GBResourceKV {
char* key;
GBResource value;
};
#ifdef _GEARBOX
struct _GBClient {
GBEngine engine;
@ -32,6 +44,15 @@ struct _GBEngine {
GBEngineParam* param;
GBClient client;
GBServer server;
GBResourceKV* resource;
};
struct _GBFile {
FILE* fp;
};
struct _GBResource {
GBFile file;
};
#endif