mirror of
https://github.com/nishiowo/nishbox
synced 2025-04-21 20:24:39 +00:00
add some files
This commit is contained in:
parent
e8babc59a1
commit
fb08464f0b
@ -1,3 +1,8 @@
|
||||
# NishBox
|
||||
|
||||
multiplayer sandbox game i might work on
|
||||
|
||||
## Stack
|
||||
- OpenGL 1.1 (probably) on WGL/GLX
|
||||
- Open Dynamics Engine
|
||||
- PawnScript
|
||||
|
@ -1,24 +1,29 @@
|
||||
/* Interface */
|
||||
#include "nb_core.h"
|
||||
|
||||
/* NishBox */
|
||||
#include "nb_draw.h"
|
||||
|
||||
/* External library */
|
||||
#include <ode/ode.h>
|
||||
|
||||
/* Standard */
|
||||
#include <stdlib.h>
|
||||
|
||||
void nb_engine_begin(void){
|
||||
dInitODE();
|
||||
}
|
||||
void nb_engine_begin(void) { dInitODE(); }
|
||||
|
||||
void nb_engine_end(void){
|
||||
dCloseODE();
|
||||
}
|
||||
void nb_engine_end(void) { dCloseODE(); }
|
||||
|
||||
nb_engine_t* nb_engine_create(void){
|
||||
nb_engine_t* nb_engine_create(void) {
|
||||
nb_engine_t* engine = malloc(sizeof(*engine));
|
||||
engine->draw = nb_draw_create();
|
||||
if(engine->draw == NULL) {
|
||||
free(engine);
|
||||
return NULL;
|
||||
}
|
||||
engine->world = dWorldCreate();
|
||||
dWorldSetGravity(engine->world, 0, 0, -9.81);
|
||||
return engine;
|
||||
}
|
||||
|
||||
void nb_engine_destroy(nb_engine_t* engine){
|
||||
dWorldDestroy(engine->world);
|
||||
}
|
||||
void nb_engine_destroy(nb_engine_t* engine) { dWorldDestroy(engine->world); }
|
||||
|
@ -1 +1,24 @@
|
||||
/* Interface */
|
||||
#include "nb_draw.h"
|
||||
|
||||
/* NishBox */
|
||||
|
||||
/* External library */
|
||||
#include <GL/gl.h>
|
||||
#if defined(USE_GLX)
|
||||
#include <X11/Xlib.h>
|
||||
#include <GL/glx.h>
|
||||
#elif defined(USE_WGL)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
/* Standard */
|
||||
#include <stdlib.h>
|
||||
|
||||
nb_draw_t* nb_draw_create(void) {
|
||||
nb_draw_t* draw = malloc(sizeof(*draw));
|
||||
#if defined(USE_GLX)
|
||||
#elif defined(USE_WGL)
|
||||
#endif
|
||||
return draw;
|
||||
}
|
||||
|
@ -1,18 +1,23 @@
|
||||
#ifndef __NB_CORE_H__
|
||||
#define __NB_CORE_H__
|
||||
|
||||
#include <nb_draw.h>
|
||||
/* Interface */
|
||||
|
||||
/* NishBox */
|
||||
|
||||
/* External library */
|
||||
#include <ode/ode.h>
|
||||
|
||||
/* Standard */
|
||||
|
||||
typedef struct nb_engine {
|
||||
dWorldID world;
|
||||
nb_draw_t* draw;
|
||||
void* draw; /* User should not touch this directly: internally pointer of nb_draw_t */
|
||||
} nb_engine_t;
|
||||
|
||||
void nb_engine_begin(void);
|
||||
void nb_engine_end(void);
|
||||
void nb_engine_begin(void);
|
||||
void nb_engine_end(void);
|
||||
nb_engine_t* nb_engine_create(void);
|
||||
void nb_engine_destroy(nb_engine_t* engine);
|
||||
void nb_engine_destroy(nb_engine_t* engine);
|
||||
|
||||
#endif
|
||||
|
@ -1,21 +1,34 @@
|
||||
#ifndef __NB_DRAW_H__
|
||||
#define __NB_DRAW_H__
|
||||
|
||||
/* Interface */
|
||||
|
||||
/* NishBox */
|
||||
|
||||
/* External library */
|
||||
#include <GL/gl.h>
|
||||
#if defined(USE_GLX)
|
||||
#include <X11/Xlib.h>
|
||||
#include <GL/glx.h>
|
||||
#include <GL/glxext.h>
|
||||
#elif defined(USE_WGL)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
/* Standard */
|
||||
|
||||
typedef struct nb_draw {
|
||||
#if defined(USE_GLX)
|
||||
Display* display;
|
||||
Window window;
|
||||
Display* display;
|
||||
Window window;
|
||||
GLXContext context;
|
||||
#elif defined(USE_WGL)
|
||||
HINSTANCE instance;
|
||||
HWND window;
|
||||
HDC dc;
|
||||
HGLRC glrc;
|
||||
#endif
|
||||
} nb_draw_t;
|
||||
|
||||
nb_draw_t* nb_draw_create(void);
|
||||
|
||||
#endif
|
||||
|
@ -1,6 +1,14 @@
|
||||
#ifndef __NB_VERSION_H__
|
||||
#define __NB_VERSION_H__
|
||||
|
||||
/* Interface */
|
||||
|
||||
/* NishBox */
|
||||
|
||||
/* External library */
|
||||
|
||||
/* Standard */
|
||||
|
||||
typedef struct nb_version {
|
||||
int major;
|
||||
int minor;
|
||||
|
@ -1,5 +1,11 @@
|
||||
/* Interface */
|
||||
#include "nb_version.h"
|
||||
|
||||
/* NishBox */
|
||||
|
||||
/* External library */
|
||||
|
||||
/* Standard */
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
7
include_order.c
Normal file
7
include_order.c
Normal file
@ -0,0 +1,7 @@
|
||||
/* Interface */
|
||||
|
||||
/* NishBox */
|
||||
|
||||
/* External library */
|
||||
|
||||
/* Standard */
|
11
src/main.c
11
src/main.c
@ -1,6 +1,12 @@
|
||||
/* Interface */
|
||||
|
||||
/* NishBox */
|
||||
#include <nb_version.h>
|
||||
#include <nb_core.h>
|
||||
|
||||
/* External library */
|
||||
|
||||
/* Standard */
|
||||
#include <stdio.h>
|
||||
|
||||
nb_engine_t* engine;
|
||||
@ -12,6 +18,11 @@ int main(int argc, char** argv) {
|
||||
|
||||
nb_engine_begin();
|
||||
engine = nb_engine_create();
|
||||
if(engine == NULL) {
|
||||
fprintf(stderr, "Engine creation failure\n");
|
||||
nb_engine_end();
|
||||
return 1;
|
||||
}
|
||||
nb_engine_destroy(engine);
|
||||
nb_engine_end();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user