soon
This commit is contained in:
parent
1864346fe1
commit
3af095361d
10 changed files with 63 additions and 51 deletions
|
|
@ -33,9 +33,9 @@ GSClient GSClientCreate(GSEngine engine) {
|
|||
|
||||
client->skybox = GSSkyBoxTry(client, "default");
|
||||
|
||||
if(GSGLTextureTry(client->gl, &client->font, &client->font_width, &client->font_height, "game:/font")){
|
||||
}else if(GSGLTextureTry(client->gl, &client->font, &client->font_width, &client->font_height, "base:/font")){
|
||||
}else{
|
||||
if(GSGLTextureTry(client->gl, &client->font, &client->font_width, &client->font_height, "game:/font")) {
|
||||
} else if(GSGLTextureTry(client->gl, &client->font, &client->font_width, &client->font_height, "base:/font")) {
|
||||
} else {
|
||||
client->font = 0;
|
||||
}
|
||||
|
||||
|
|
@ -59,14 +59,14 @@ static void scene(GSClient client) {
|
|||
}
|
||||
|
||||
void GSClientStep(GSClient client) {
|
||||
int tw, th;
|
||||
int tw2, th2;
|
||||
int sw, sh;
|
||||
char buf[512];
|
||||
char buf2[512];
|
||||
int tw, th;
|
||||
int tw2, th2;
|
||||
int sw, sh;
|
||||
char buf[512];
|
||||
char buf2[512];
|
||||
GSVersion ver;
|
||||
GSVector4 white = {1, 1, 1, 1};
|
||||
GSVector4 half = {0, 0, 0, 0.5};
|
||||
GSVector4 half = {0, 0, 0, 0.5};
|
||||
GSVector2 sq[4];
|
||||
|
||||
GSGLClear(client->gl);
|
||||
|
|
@ -78,22 +78,21 @@ void GSClientStep(GSClient client) {
|
|||
GSGLShadowAfterMapping(client->gl);
|
||||
}
|
||||
|
||||
if(client->skybox_enabled){
|
||||
if(client->skybox_enabled) {
|
||||
if(client->skybox != NULL) GSSkyBoxDraw(client->skybox);
|
||||
}
|
||||
scene(client);
|
||||
GSGLShadowEnd(client->gl);
|
||||
|
||||
|
||||
GSVersionGet(&ver);
|
||||
|
||||
|
||||
sprintf(buf, "GearSrc Engine %s", ver.string);
|
||||
|
||||
|
||||
tw = GSGLTextWidth(client->gl, buf);
|
||||
th = GSGLTextHeight(client->gl, buf);
|
||||
|
||||
sprintf(buf2, "%s", ver.copyright);
|
||||
|
||||
|
||||
tw2 = GSGLTextWidth(client->gl, buf2);
|
||||
th2 = GSGLTextHeight(client->gl, buf2);
|
||||
|
||||
|
|
@ -113,16 +112,16 @@ void GSClientStep(GSClient client) {
|
|||
GSGLSetColor(client->gl, white);
|
||||
GSGLText(client->gl, client->engine->width - tw, client->engine->height - th * 2, buf);
|
||||
GSGLText(client->gl, client->engine->width - tw2, client->engine->height - th2, buf2);
|
||||
|
||||
|
||||
client->engine->param->gl_swapbuffer();
|
||||
|
||||
if(client->engine->param->after_render != NULL) client->engine->param->after_render(client->engine);
|
||||
}
|
||||
|
||||
GSGL GSClientGetGL(GSClient client){
|
||||
GSGL GSClientGetGL(GSClient client) {
|
||||
return client->gl;
|
||||
}
|
||||
|
||||
void GSClientToggleSkybox(GSClient client, GSBool toggle){
|
||||
void GSClientToggleSkybox(GSClient client, GSBool toggle) {
|
||||
client->skybox_enabled = toggle;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ void GSEngineLoop(GSEngine engine) {
|
|||
|
||||
if(engine->param->tick != NULL) engine->param->tick();
|
||||
|
||||
if(wait_actually) {
|
||||
if(wait_actually && !engine->param->client) {
|
||||
int diff = (engine->param->get_tick() - t);
|
||||
|
||||
if(wait > diff)
|
||||
|
|
|
|||
|
|
@ -146,6 +146,6 @@ void GSGLCallList(GSGL gl, GLuint list) {
|
|||
glCallList(list);
|
||||
}
|
||||
|
||||
void GSGLSetColor(GSGL gl, GSVector4 color){
|
||||
void GSGLSetColor(GSGL gl, GSVector4 color) {
|
||||
glColor4f(color[0], color[1], color[2], color[3]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ GSBool GSGLTextureLoadFile(GSGL gl, GLuint* texture, int* width, int* height, co
|
|||
}
|
||||
|
||||
GSBool GSGLTextureTry(GSGL gl, GLuint* texture, int* width, int* height, const char* prefix) {
|
||||
char* png = GSStringConcat(prefix, ".png");
|
||||
char* bmp = GSStringConcat(prefix, ".bmp");
|
||||
char* jpg = GSStringConcat(prefix, ".jpg");
|
||||
char* jpeg = GSStringConcat(prefix, ".jpeg");
|
||||
GSBool st = GSTrue;
|
||||
char* png = GSStringConcat(prefix, ".png");
|
||||
char* bmp = GSStringConcat(prefix, ".bmp");
|
||||
char* jpg = GSStringConcat(prefix, ".jpg");
|
||||
char* jpeg = GSStringConcat(prefix, ".jpeg");
|
||||
GSBool st = GSTrue;
|
||||
|
||||
if(GSGLTextureLoadFile(gl, texture, width, height, prefix)) {
|
||||
} else if(GSGLTextureLoadFile(gl, texture, width, height, png)) {
|
||||
|
|
@ -61,21 +61,21 @@ GSBool GSGLTextureTry(GSGL gl, GLuint* texture, int* width, int* height, const c
|
|||
return st;
|
||||
}
|
||||
|
||||
void GSGLTextEx(GSGL gl, double x, double y, double sx, double sy, const char* text){
|
||||
void GSGLTextEx(GSGL gl, double x, double y, double sx, double sy, const char* text) {
|
||||
double px = x;
|
||||
double py = y;
|
||||
int i;
|
||||
int i;
|
||||
double gw = gl->engine->client->font_width / 16 * sx;
|
||||
double gh = gl->engine->client->font_height / 16 * sy;
|
||||
|
||||
GSGLBegin2D(gl);
|
||||
GSGLTextureSet(gl, gl->engine->client->font);
|
||||
|
||||
for(i = 0; text[i] != 0; i++){
|
||||
for(i = 0; text[i] != 0; i++) {
|
||||
GSVector2 v[4];
|
||||
GSVector2 t[4];
|
||||
double gx = text[i] % 16;
|
||||
double gy = text[i] / 16;
|
||||
double gx = text[i] % 16;
|
||||
double gy = text[i] / 16;
|
||||
|
||||
gx = gx / 16;
|
||||
gy = gy / 16;
|
||||
|
|
@ -102,14 +102,14 @@ void GSGLTextEx(GSGL gl, double x, double y, double sx, double sy, const char* t
|
|||
GSGLEnd2D(gl);
|
||||
}
|
||||
|
||||
void GSGLText(GSGL gl, double x, double y, const char* text){
|
||||
void GSGLText(GSGL gl, double x, double y, const char* text) {
|
||||
GSGLTextEx(gl, x, y, 1, 1, text);
|
||||
}
|
||||
|
||||
double GSGLTextWidth(GSGL gl, const char* text){
|
||||
double GSGLTextWidth(GSGL gl, const char* text) {
|
||||
return gl->engine->client->font_width / 16 * strlen(text);
|
||||
}
|
||||
|
||||
double GSGLTextHeight(GSGL gl, const char* text){
|
||||
double GSGLTextHeight(GSGL gl, const char* text) {
|
||||
return gl->engine->client->font_height / 16;
|
||||
}
|
||||
|
|
|
|||
7
engine/src/gl_cull.c
Normal file
7
engine/src/gl_cull.c
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#include <GearSrc/GL.h>
|
||||
|
||||
void GSGLCullCalculate(GSGL gl) {
|
||||
}
|
||||
|
||||
GSBool GSGLCullTest(GSGL gl, GSBox* box) {
|
||||
}
|
||||
|
|
@ -274,7 +274,7 @@ GSModel GSModelOpen(GSEngine engine, const char* path) {
|
|||
|
||||
/* TODO: check for animation */
|
||||
if(gl != NULL) {
|
||||
GLuint list = GSGLBeginList(gl);
|
||||
GLuint list = GSGLBeginList(gl);
|
||||
GSModelDraw(model);
|
||||
GSGLEndList(gl);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue