Character is rendering in-game
This commit is contained in:
@ -10,17 +10,29 @@
|
||||
bool pokerGameInit(game_t *game) {
|
||||
pokergame_t *pokerGame = &game->pokerGame;
|
||||
|
||||
// Load the Assets
|
||||
// Load the Assets.
|
||||
pokerGameAssetsInit(&pokerGame->assets);
|
||||
|
||||
// Initialize the Visual Novel Engine.
|
||||
vnSceneInit(&pokerGame->scene,
|
||||
&pokerGame->assets.font,
|
||||
&pokerGame->assets.testTexture
|
||||
);
|
||||
|
||||
// Initialize the world
|
||||
pokerRenderInit(&pokerGame->render);
|
||||
pokerWorldInit(pokerGame);
|
||||
|
||||
vnCharacterInit(pokerGame->scene.characters, &pokerGame->assets.pennyTexture,
|
||||
1000, 1920,
|
||||
367,256, 280,280
|
||||
);
|
||||
pokerGame->scene.characterCount = 1;
|
||||
|
||||
|
||||
// Initialize the UI.
|
||||
pokerUiInit(pokerGame);
|
||||
|
||||
// Prep the VN Conversation Engine.
|
||||
vnSceneInit(&pokerGame->scene, &pokerGame->assets.font, &pokerGame->assets.testTexture);
|
||||
|
||||
// Add the first action, the game action, and then start the action queue.
|
||||
pokerGameActionStartAdd(pokerGame);
|
||||
queueNext(&pokerGame->scene.conversation.actionQueue);
|
||||
|
||||
@ -31,17 +43,17 @@ void pokerGameUpdate(game_t *game) {
|
||||
pokergame_t *pokerGame;
|
||||
pokerGame = &game->pokerGame;
|
||||
|
||||
// Update the scene
|
||||
// Update the VN Engine.
|
||||
vnSceneUpdate(&pokerGame->scene, &game->engine);
|
||||
|
||||
// Bind the shader.
|
||||
shaderUse(&pokerGame->assets.shader);
|
||||
|
||||
// Render the visual novel scene
|
||||
// Render the visual novel scene.
|
||||
vnSceneRenderWorld(&pokerGame->scene,&game->engine,&pokerGame->assets.shader);
|
||||
|
||||
// Render the world
|
||||
pokerRenderRender(&pokerGame->render, &game->engine, &pokerGame->assets);
|
||||
pokerWorldRender(&pokerGame->world, &game->engine, &pokerGame->assets);
|
||||
vnSceneRenderCharacters(&pokerGame->scene, &pokerGame->assets.shader);
|
||||
|
||||
// Render the UI
|
||||
vnSceneRenderGui(&pokerGame->scene, &game->engine, &pokerGame->assets.shader);
|
||||
@ -49,8 +61,18 @@ void pokerGameUpdate(game_t *game) {
|
||||
}
|
||||
|
||||
void pokerGameDispose(game_t *game) {
|
||||
pokerUiDispose(&game->pokerGame);
|
||||
pokerRenderDispose(&game->pokerGame.render);
|
||||
vnSceneDispose(&game->pokerGame.scene);
|
||||
pokerGameAssetsDispose(&game->pokerGame.assets);
|
||||
pokergame_t *pokerGame;
|
||||
pokerGame = &game->pokerGame;
|
||||
|
||||
//Cleanup the UI
|
||||
pokerUiDispose(pokerGame);
|
||||
|
||||
// Cleanup the world
|
||||
pokerWorldDispose(pokerGame);
|
||||
|
||||
// Destroy the Visual Novel engine.
|
||||
vnSceneDispose(&pokerGame->scene);
|
||||
|
||||
// Unload all assets
|
||||
pokerGameAssetsDispose(&pokerGame->assets);
|
||||
}
|
@ -13,13 +13,9 @@
|
||||
#include "../../vn/vnscene.h"
|
||||
#include "actions/start.h"
|
||||
#include "pokerui.h"
|
||||
#include "pokerrender.h"
|
||||
#include "pokerworld.h"
|
||||
#include "actions/start.h"
|
||||
|
||||
#include "../../ui/frame.h"
|
||||
#include "../../physics/aabb.h"
|
||||
#include "../../input/input.h"
|
||||
|
||||
/**
|
||||
* Initializes the game state for the poker game.
|
||||
*
|
||||
|
@ -7,20 +7,35 @@
|
||||
#include "pokergameassets.h"
|
||||
|
||||
bool pokerGameAssetsInit(pokergameassets_t *assets) {
|
||||
// Load the game's shader
|
||||
assetShaderLoad(&assets->shader,
|
||||
"shaders/textured.vert", "shaders/textured.frag"
|
||||
);
|
||||
|
||||
// Load the game's font
|
||||
assetFontLoad(&assets->font, "fonts/opensans/OpenSans-Bold.ttf");
|
||||
|
||||
// Initialize the language buffer.
|
||||
languageInit(&assets->language, "locale/language/en-US.csv");
|
||||
|
||||
// Load the world textures.
|
||||
assetTextureLoad(&assets->testTexture, "test_texture.png");
|
||||
assetTextureLoad(&assets->roomTexture, "textures/pub_skywall.png");
|
||||
assetTextureLoad(&assets->roomTexture, "world/pub/pub_skywall.png");
|
||||
|
||||
// Load the character textures.
|
||||
assetTextureLoad(&assets->pennyTexture, "characters/penny/sprites/sheet.png");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void pokerGameAssetsDispose(pokergameassets_t *assets) {
|
||||
// Now we unload in what is essentially the reverse of the above.
|
||||
textureDispose(&assets->roomTexture);
|
||||
textureDispose(&assets->testTexture);
|
||||
|
||||
languageDispose(&assets->language);
|
||||
shaderDispose(&assets->shader);
|
||||
|
||||
fontDispose(&assets->font);
|
||||
|
||||
shaderDispose(&assets->shader);
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "pokerrender.h"
|
||||
|
||||
void pokerRenderInit(pokerrender_t *render) {
|
||||
skywallInit(&render->skywall);
|
||||
}
|
||||
|
||||
void pokerRenderRender(
|
||||
pokerrender_t *render, engine_t *engine, pokergameassets_t *assets
|
||||
) {
|
||||
// Render the wall
|
||||
shaderUseTexture(&assets->shader, &assets->roomTexture);
|
||||
shaderUsePosition(&assets->shader, 0, 0, 0, 0,engine->time.current/3,0);
|
||||
primitiveDraw(&render->skywall, 0, -1);
|
||||
}
|
||||
|
||||
void pokerRenderDispose(pokerrender_t *render) {
|
||||
primitiveDispose(&render->skywall);
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <dawn/dawn.h>
|
||||
#include "../../display/shader.h"
|
||||
#include "../../display/primitive.h"
|
||||
#include "../../display/primitives/skywall.h"
|
||||
#include "../../vn/vnscene.h"
|
||||
|
||||
/**
|
||||
* Initialize the poker renderer.
|
||||
*
|
||||
* @param render Render to initialize.
|
||||
*/
|
||||
void pokerRenderInit(pokerrender_t *render);
|
||||
|
||||
/**
|
||||
* Render the poker game.
|
||||
* @param render Renderer to use.
|
||||
* @param engine Engine for rendering.
|
||||
* @param assets Poker game assets.
|
||||
*/
|
||||
void pokerRenderRender(
|
||||
pokerrender_t *render, engine_t *engine, pokergameassets_t *assets
|
||||
);
|
||||
|
||||
/**
|
||||
* Cleanup the poker renderer.
|
||||
* @param render Render to dispose.
|
||||
*/
|
||||
void pokerRenderDispose(pokerrender_t *render);
|
26
src/game/poker/pokerworld.c
Normal file
26
src/game/poker/pokerworld.c
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "pokerworld.h"
|
||||
|
||||
void pokerWorldInit(pokergame_t *game) {
|
||||
// Initialize the skywal
|
||||
skywallInit(&game->world.skywall);
|
||||
}
|
||||
|
||||
void pokerWorldRender(
|
||||
pokerworld_t *world, engine_t *engine, pokergameassets_t *assets
|
||||
) {
|
||||
// Render the wall
|
||||
shaderUseTexture(&assets->shader, &assets->roomTexture);
|
||||
shaderUsePosition(&assets->shader, 0, 0, 0, 0,0,0);
|
||||
primitiveDraw(&world->skywall, 0, -1);
|
||||
}
|
||||
|
||||
void pokerWorldDispose(pokergame_t *game) {
|
||||
primitiveDispose(&game->world.skywall);
|
||||
}
|
37
src/game/poker/pokerworld.h
Normal file
37
src/game/poker/pokerworld.h
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <dawn/dawn.h>
|
||||
#include "../../display/shader.h"
|
||||
#include "../../display/primitive.h"
|
||||
#include "../../display/primitives/skywall.h"
|
||||
#include "../../vn/vnscene.h"
|
||||
|
||||
/**
|
||||
* Initialize the poker renderer.
|
||||
*
|
||||
* @param game Game to initialize for.
|
||||
*/
|
||||
void pokerWorldInit(pokergame_t *game);
|
||||
|
||||
/**
|
||||
* Render the poker world.
|
||||
*
|
||||
* @param world Poker Game World.
|
||||
* @param engine Game engine.
|
||||
* @param assets Assets to use.
|
||||
*/
|
||||
void pokerWorldRender(
|
||||
pokerworld_t *world, engine_t *engine, pokergameassets_t *assets
|
||||
);
|
||||
|
||||
/**
|
||||
* Cleanup the poker world.
|
||||
* @param game Game to clean up for.
|
||||
*/
|
||||
void pokerWorldDispose(pokergame_t *game);
|
Reference in New Issue
Block a user