mirror of
https://github.com/nishiowo/nishbox
synced 2025-04-21 20:24:39 +00:00
draw
This commit is contained in:
parent
e3f819c2b5
commit
65eb9099df
4
Makefile
4
Makefile
@ -6,9 +6,11 @@ AMX_LIBS = `pkg-config --libs amx`
|
||||
GL_CFLAGS = `pkg-config --cflags gl`
|
||||
GL_LIBS = `pkg-config --libs gl`
|
||||
|
||||
BACKEND = GLX
|
||||
|
||||
AR = $(TARGET_PREFIX)ar
|
||||
CC = $(TARGET_PREFIX)gcc
|
||||
CFLAGS = -D_DEFAULT_SOURCE -I../engine $(ODE_CFLAGS) $(AMX_CFLAGS) $(GL_CFLAGS)
|
||||
CFLAGS = -D_DEFAULT_SOURCE -DUSE_$(BACKEND) -I../engine $(ODE_CFLAGS) $(AMX_CFLAGS) $(GL_CFLAGS)
|
||||
LDFLAGS =
|
||||
LIBS = $(ODE_LIBS) $(AMX_LIBS) $(GL_LIBS)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
TARGET = libnishbox.a
|
||||
OBJS = version.o core.o
|
||||
OBJS = version.o core.o draw.o
|
||||
|
||||
include ../common.mk
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include <ode/ode.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
void nb_engine_begin(void){
|
||||
dInitODE();
|
||||
}
|
||||
@ -10,9 +12,11 @@ void nb_engine_end(void){
|
||||
dCloseODE();
|
||||
}
|
||||
|
||||
void nb_engine_create(nb_engine_t* engine){
|
||||
nb_engine_t* nb_engine_create(void){
|
||||
nb_engine_t* engine = malloc(sizeof(*engine));
|
||||
engine->world = dWorldCreate();
|
||||
dWorldSetGravity(engine->world, 0, 0, -9.81);
|
||||
return engine;
|
||||
}
|
||||
|
||||
void nb_engine_destroy(nb_engine_t* engine){
|
||||
|
1
engine/draw.c
Normal file
1
engine/draw.c
Normal file
@ -0,0 +1 @@
|
||||
#include "nb_draw.h"
|
@ -1,15 +1,18 @@
|
||||
#ifndef __NB_CORE_H__
|
||||
#define __NB_CORE_H__
|
||||
|
||||
#include <nb_draw.h>
|
||||
|
||||
#include <ode/ode.h>
|
||||
|
||||
typedef struct nb_engine {
|
||||
dWorldID world;
|
||||
nb_draw_t* draw;
|
||||
} nb_engine_t;
|
||||
|
||||
void nb_engine_begin(void);
|
||||
void nb_engine_end(void);
|
||||
void nb_engine_create(nb_engine_t* engine);
|
||||
nb_engine_t* nb_engine_create(void);
|
||||
void nb_engine_destroy(nb_engine_t* engine);
|
||||
|
||||
#endif
|
||||
|
21
engine/nb_draw.h
Normal file
21
engine/nb_draw.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef __NB_DRAW_H__
|
||||
#define __NB_DRAW_H__
|
||||
|
||||
#include <GL/gl.h>
|
||||
#if defined(USE_GLX)
|
||||
#include <X11/Xlib.h>
|
||||
#include <GL/glx.h>
|
||||
#include <GL/glxext.h>
|
||||
#elif defined(USE_WGL)
|
||||
#endif
|
||||
|
||||
typedef struct nb_draw {
|
||||
#if defined(USE_GLX)
|
||||
Display* display;
|
||||
Window window;
|
||||
GLXContext context;
|
||||
#elif defined(USE_WGL)
|
||||
#endif
|
||||
} nb_draw_t;
|
||||
|
||||
#endif
|
@ -3,15 +3,17 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
nb_engine_t engine;
|
||||
nb_engine_t* engine;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
nb_version_t ver;
|
||||
nb_get_version(&ver);
|
||||
printf("NishBox engine %s - Powered by Pawn and ODE\n", ver.full);
|
||||
|
||||
nb_engine_begin();
|
||||
nb_engine_create(&engine);
|
||||
nb_engine_destroy(&engine);
|
||||
engine = nb_engine_create();
|
||||
nb_engine_destroy(engine);
|
||||
nb_engine_end();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user