Putting it all together and testing it.

This commit is contained in:
2021-05-05 09:24:36 -07:00
parent c3244274ce
commit 040459bf9c
13 changed files with 200 additions and 170 deletions

View File

@ -9,10 +9,6 @@
game_t GAME_STATE;
primitive_t *prim;
framebuffer_t *fbo;
texture_t *text;
bool gameInit() {
// Init the game
GAME_STATE.name = GAME_NAME;
@ -21,18 +17,15 @@ bool gameInit() {
gameTimeInit();
renderInit();
inputInit();
worldInit();
prim = cubeCreate(1, 1, 1);
text = assetTextureLoad("bruh.png");
fbo = frameBufferCreate(128, 128);
// Load the world shader.
GAME_STATE.shaderWorld = assetShaderLoad(
"shaders/textured.vert", "shaders/textured.frag"
);
// Send to Texas Game
holdemGameInit();
// Init the input manger.
return true;
}
@ -42,27 +35,8 @@ bool gameUpdate(float platformDelta) {
renderFrameStart();
inputUpdate();
// Set up the camera and shader.
shaderUse(GAME_STATE.shaderWorld);
frameBufferUse(fbo, true);
cameraLookAt(&GAME_STATE.cameraWorld, 2, 2, 2, 0, 0, 0);
cameraPerspective(&GAME_STATE.cameraWorld, 45.0f,
((float)fbo->texture->width) / ((float)fbo->texture->height),
0.5f, 500.0f
);
shaderUseCamera(GAME_STATE.shaderWorld, &GAME_STATE.cameraWorld);
shaderUsePosition(GAME_STATE.shaderWorld, 0, 0, 0, TIME_STATE.current, TIME_STATE.current, 0);
shaderUseTexture(GAME_STATE.shaderWorld, text);
primitiveDraw(prim, 0, prim->indiceCount);
frameBufferUse(NULL, true);
shaderUseTexture(GAME_STATE.shaderWorld, fbo->texture);
cameraPerspective(&GAME_STATE.cameraWorld, 45.0f,
((float)RENDER_STATE.width) / ((float)RENDER_STATE.height),
0.5f, 500.0f
);
shaderUseCamera(GAME_STATE.shaderWorld, &GAME_STATE.cameraWorld);
primitiveDraw(prim, 0, prim->indiceCount);
shaderUse(GAME_STATE.shaderWorld);// TODO: remove
holdemGameUpdate();
if(inputIsPressed(INPUT_NULL)) return false;
return true;

View File

@ -11,11 +11,7 @@
#include "../display/shader.h"
#include "../file/asset.h"
#include "../input/input.h"
#include "../display/primitive.h"
#include "../display/framebuffer.h"
#include "../display/primitives/cube.h"
#include "../display/primitives/quad.h"
#include "../card/poker/holdemgame.h"
/**
* Initialize the game context.