Merge branch 'master' of https://github.com/Doy-lee/Dengine
This commit is contained in:
commit
3729ddf164
@ -990,6 +990,32 @@ void asteroid_gameUpdateAndRender(GameState *state, Memory *memory,
|
|||||||
collideColor, flags);
|
collideColor, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ // Draw Ui
|
||||||
|
UiState *uiState = &state->uiState;
|
||||||
|
MemoryArena_ *transientArena = &state->transientArena;
|
||||||
|
AssetManager *assetManager = &state->assetManager;
|
||||||
|
Renderer *renderer = &state->renderer;
|
||||||
|
InputBuffer *inputBuffer = &state->input;
|
||||||
|
|
||||||
|
userInterface_beginState(uiState);
|
||||||
|
|
||||||
|
WindowState window = {0};
|
||||||
|
window.id = userInterface_generateId(uiState);
|
||||||
|
|
||||||
|
Rect windowRect = {0};
|
||||||
|
windowRect.min = V2(200, 200);
|
||||||
|
windowRect.max = V2(500, 500);
|
||||||
|
|
||||||
|
window.rect = windowRect;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
userInterface_window(uiState, transientArena, assetManager, renderer,
|
||||||
|
&assetManager->font, *inputBuffer, &window);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
userInterface_endState(uiState, inputBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
for (i32 i = 0; i < world->numAudioRenderers; i++)
|
for (i32 i = 0; i < world->numAudioRenderers; i++)
|
||||||
{
|
{
|
||||||
AudioRenderer *audioRenderer = &world->audioRenderer[i];
|
AudioRenderer *audioRenderer = &world->audioRenderer[i];
|
||||||
|
@ -272,6 +272,8 @@ const i32 audio_playVorbis(MemoryArena_ *arena, AudioManager *audioManager,
|
|||||||
AudioRenderer *audioRenderer, AudioVorbis *vorbis,
|
AudioRenderer *audioRenderer, AudioVorbis *vorbis,
|
||||||
i32 numPlays)
|
i32 numPlays)
|
||||||
{
|
{
|
||||||
|
if(vorbis) return -1;
|
||||||
|
|
||||||
i32 result = initRendererForPlayback(arena, audioManager, audioRenderer,
|
i32 result = initRendererForPlayback(arena, audioManager, audioRenderer,
|
||||||
vorbis, numPlays);
|
vorbis, numPlays);
|
||||||
|
|
||||||
@ -302,6 +304,8 @@ const i32 audio_streamPlayVorbis(MemoryArena_ *arena, AudioManager *audioManager
|
|||||||
// TODO(doyle): Streaming leaks memory, we don't free the "copy audio"
|
// TODO(doyle): Streaming leaks memory, we don't free the "copy audio"
|
||||||
ASSERT(INVALID_CODE_PATH);
|
ASSERT(INVALID_CODE_PATH);
|
||||||
|
|
||||||
|
if(vorbis) return -1;
|
||||||
|
|
||||||
i32 result = initRendererForPlayback(arena, audioManager, audioRenderer,
|
i32 result = initRendererForPlayback(arena, audioManager, audioRenderer,
|
||||||
vorbis, numPlays);
|
vorbis, numPlays);
|
||||||
// NOTE(doyle): We make a copy of the audio vorbis file using all the same
|
// NOTE(doyle): We make a copy of the audio vorbis file using all the same
|
||||||
|
@ -1,9 +1,33 @@
|
|||||||
#include "Dengine/UserInterface.h"
|
#include "Dengine/UserInterface.h"
|
||||||
#include "Dengine/AssetManager.h"
|
#include "Dengine/AssetManager.h"
|
||||||
#include "Dengine/Assets.h"
|
#include "Dengine/Assets.h"
|
||||||
|
#include "Dengine/Asteroid.h"
|
||||||
#include "Dengine/Debug.h"
|
#include "Dengine/Debug.h"
|
||||||
#include "Dengine/Renderer.h"
|
#include "Dengine/Renderer.h"
|
||||||
|
|
||||||
|
void userInterface_beginState(UiState *state)
|
||||||
|
{
|
||||||
|
state->hotItem = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void userInterface_endState(UiState *state, InputBuffer *input)
|
||||||
|
{
|
||||||
|
if (!common_isSet(input->keys[keycode_mouseLeft].flags,
|
||||||
|
keystateflag_ended_down))
|
||||||
|
{
|
||||||
|
state->activeItem = 0;
|
||||||
|
}
|
||||||
|
else if (state->activeItem == 0)
|
||||||
|
{
|
||||||
|
state->activeItem = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state->keyEntered == keycode_tab) state->kbdItem = 0;
|
||||||
|
|
||||||
|
state->keyEntered = keycode_null;
|
||||||
|
state->keyChar = keycode_null;
|
||||||
|
}
|
||||||
|
|
||||||
i32 userInterface_button(UiState *const uiState, MemoryArena_ *const arena,
|
i32 userInterface_button(UiState *const uiState, MemoryArena_ *const arena,
|
||||||
AssetManager *const assetManager,
|
AssetManager *const assetManager,
|
||||||
Renderer *const renderer, Font *const font,
|
Renderer *const renderer, Font *const font,
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "Dengine/MemoryArena.h"
|
#include "Dengine/MemoryArena.h"
|
||||||
#include "Dengine/Platform.h"
|
#include "Dengine/Platform.h"
|
||||||
#include "Dengine/Renderer.h"
|
#include "Dengine/Renderer.h"
|
||||||
|
#include "Dengine/UserInterface.h"
|
||||||
|
|
||||||
typedef struct World
|
typedef struct World
|
||||||
{
|
{
|
||||||
@ -49,6 +50,8 @@ typedef struct GameState {
|
|||||||
AssetManager assetManager;
|
AssetManager assetManager;
|
||||||
InputBuffer input;
|
InputBuffer input;
|
||||||
Renderer renderer;
|
Renderer renderer;
|
||||||
|
|
||||||
|
UiState uiState;
|
||||||
World world;
|
World world;
|
||||||
|
|
||||||
} GameState;
|
} GameState;
|
||||||
|
@ -10,6 +10,7 @@ typedef struct AssetManager AssetManager;
|
|||||||
typedef struct Font Font;
|
typedef struct Font Font;
|
||||||
typedef struct MemoryArena MemoryArena_;
|
typedef struct MemoryArena MemoryArena_;
|
||||||
typedef struct Renderer Renderer;
|
typedef struct Renderer Renderer;
|
||||||
|
typedef struct GameState GameState;
|
||||||
|
|
||||||
enum UiType
|
enum UiType
|
||||||
{
|
{
|
||||||
@ -76,6 +77,9 @@ inline i32 userInterface_generateId(UiState *const uiState)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void userInterface_beginState(UiState *state);
|
||||||
|
void userInterface_endState(UiState *state, InputBuffer *input);
|
||||||
|
|
||||||
i32 userInterface_button(UiState *const uiState, MemoryArena_ *const arena,
|
i32 userInterface_button(UiState *const uiState, MemoryArena_ *const arena,
|
||||||
AssetManager *const assetManager,
|
AssetManager *const assetManager,
|
||||||
Renderer *const renderer, Font *const font,
|
Renderer *const renderer, Font *const font,
|
||||||
|
Loading…
Reference in New Issue
Block a user