mirror of
https://github.com/Karaka-Management/cOMS.git
synced 2026-01-26 17:48:40 +00:00
pulled audio in own thread, not working
This commit is contained in:
parent
333c7d6e53
commit
2420efab8a
|
|
@ -33,7 +33,11 @@ void audio_from_file(RingMemory* ring, const char* path, Audio* audio)
|
|||
}
|
||||
|
||||
inline
|
||||
void audio_fill_buffer(AudioSetting* setting, uint32 to_fill, Audio* sound, int16* buffer1, int32 buffer1_size, int16* buffer2 = NULL, int32 buffer2_size = 0)
|
||||
void audio_fill_buffer(
|
||||
AudioSetting* setting, uint32 to_fill, const Audio* sound,
|
||||
int16* buffer1, int32 buffer1_size,
|
||||
int16* buffer2 = NULL, int32 buffer2_size = 0
|
||||
)
|
||||
{
|
||||
uint32 limit = to_fill / setting->sample_size;
|
||||
buffer1_size /= setting->sample_size;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@
|
|||
// @performance Create improved vertice generation for components (input + button, chat, ...) where we don't use as many
|
||||
// degenerate triangled
|
||||
|
||||
// @todo in many places we use ->value_int. We should load it as a value_float and also define it as float in the theme.
|
||||
// This way we wouldn't have to convert the value
|
||||
|
||||
inline
|
||||
void vertex_degenerate_create(
|
||||
Vertex3DTextureColorIndex* __restrict vertices, uint32* __restrict index, f32 zindex,
|
||||
|
|
@ -53,7 +56,7 @@ inline
|
|||
void vertex_line_create(
|
||||
Vertex3DTextureColorIndex* __restrict vertices, uint32* __restrict index, f32 zindex,
|
||||
f32 x1, f32 y1, f32 x2, f32 y2, f32 thickness, int32 align_h, int32 align_v,
|
||||
uint32 color_index = 0, f32 tex_x1 = 0.0f, f32 tex_y1 = 0.0f, f32 tex_x2 = 0.0f, f32 tex_y2 = 0.0f
|
||||
f32 color_index = 0, f32 tex_x1 = 0.0f, f32 tex_y1 = 0.0f, f32 tex_x2 = 0.0f, f32 tex_y2 = 0.0f
|
||||
) {
|
||||
if (align_h == UI_ALIGN_H_RIGHT) {
|
||||
x1 -= thickness;
|
||||
|
|
@ -132,7 +135,7 @@ inline
|
|||
void vertex_rect_create(
|
||||
Vertex3DTextureColorIndex* __restrict vertices, uint32* __restrict index, f32 zindex,
|
||||
f32 x, f32 y, f32 width, f32 height, int32 align_h, int32 align_v,
|
||||
uint32 color_index = 0, f32 tex_x1 = 0.0f, f32 tex_y1 = 0.0f, f32 tex_x2 = 0.0f, f32 tex_y2 = 0.0f
|
||||
f32 color_index = 0, f32 tex_x1 = 0.0f, f32 tex_y1 = 0.0f, f32 tex_x2 = 0.0f, f32 tex_y2 = 0.0f
|
||||
) {
|
||||
if (align_h == UI_ALIGN_H_RIGHT) {
|
||||
x -= width;
|
||||
|
|
@ -189,7 +192,7 @@ inline
|
|||
void vertex_rect_border_create(
|
||||
Vertex3DTextureColorIndex* __restrict vertices, uint32* __restrict index, f32 zindex,
|
||||
f32 x, f32 y, f32 width, f32 height, f32 thickness, int32 align_h, int32 align_v,
|
||||
uint32 color_index = 0, f32 tex_x1 = 0.0f, f32 tex_y1 = 0.0f, f32 tex_x2 = 0.0f, f32 tex_y2 = 0.0f
|
||||
f32 color_index = 0, f32 tex_x1 = 0.0f, f32 tex_y1 = 0.0f, f32 tex_x2 = 0.0f, f32 tex_y2 = 0.0f
|
||||
) {
|
||||
if (align_h == UI_ALIGN_H_RIGHT) {
|
||||
x -= width;
|
||||
|
|
@ -325,7 +328,7 @@ void vertex_rect_border_create(
|
|||
|
||||
void vertex_input(Vertex3DTextureColorIndex* __restrict vertices, uint32* __restrict index, f32 zindex,
|
||||
f32 x, f32 y, f32 width, f32 height, int32 align_h, int32 align_v,
|
||||
uint32 color_index = 0, f32 tex_x1 = 0.0f, f32 tex_y1 = 0.0f, f32 tex_x2 = 0.0f, f32 tex_y2 = 0.0f
|
||||
f32 color_index = 0, f32 tex_x1 = 0.0f, f32 tex_y1 = 0.0f, f32 tex_x2 = 0.0f, f32 tex_y2 = 0.0f
|
||||
)
|
||||
{
|
||||
vertex_rect_border_create(
|
||||
|
|
@ -473,7 +476,7 @@ void text_calculate_dimensions(
|
|||
f32 vertex_text_create(
|
||||
Vertex3DTextureColorIndex* __restrict vertices, uint32* __restrict index, f32 zindex,
|
||||
f32 x, f32 y, f32 width, f32 height, int32 align_h, int32 align_v,
|
||||
const Font* __restrict font, const char* __restrict text, f32 size, uint32 color_index = 0
|
||||
const Font* __restrict font, const char* __restrict text, f32 size, f32 color_index = 0
|
||||
) {
|
||||
int32 length = utf8_strlen(text);
|
||||
bool is_ascii = strlen(text) == length;
|
||||
|
|
@ -619,8 +622,8 @@ f32 ui_text_create(
|
|||
|
||||
// If we do a different alignment we need to pre-calculate the width and height
|
||||
if (align_h != NULL || align_v != NULL) {
|
||||
f32 tmp_width = width->value_int;
|
||||
f32 tmp_height = height->value_int;
|
||||
f32 tmp_width = (f32) width->value_int;
|
||||
f32 tmp_height = (f32) height->value_int;
|
||||
|
||||
if (align_h != NULL && align_v != NULL) {
|
||||
text_calculate_dimensions(&tmp_width, &tmp_height, &theme->font, text->value_str, is_ascii, scale, length);
|
||||
|
|
@ -646,14 +649,14 @@ f32 ui_text_create(
|
|||
uint32 first_glyph = theme->font.glyphs[0].codepoint;
|
||||
|
||||
int32 start = *index;
|
||||
f32 offset_x = x->value_int;
|
||||
f32 offset_y = y->value_int;
|
||||
f32 offset_x = (f32) x->value_int;
|
||||
f32 offset_y = (f32) y->value_int;
|
||||
for (int32 i = 0; i < length; ++i) {
|
||||
int32 character = is_ascii ? text->value_str[i] : utf8_get_char_at(text->value_str, i);
|
||||
|
||||
if (character == '\n') {
|
||||
offset_y += theme->font.line_height * scale;
|
||||
offset_x = x->value_int;
|
||||
offset_x = (f32) x->value_int;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@
|
|||
|
||||
#define SETTING_DEBUG_VISIBILITY_WIREFRAME 1
|
||||
#define SETTING_DEBUG_VISIBILITY_DEBUG 2
|
||||
#define SETTING_DEBUG_VISIBILITY_NORMALS 4
|
||||
#define SETTING_DEBUG_VISIBILITY_3D 2048
|
||||
#define SETTING_DEBUG_VISIBILITY_NORMALS 4096
|
||||
|
||||
#define SETTING_UI_VISIBILITY_FPS 1
|
||||
#define SETTING_UI_VISIBILITY_APM 2
|
||||
|
|
|
|||
|
|
@ -23,7 +23,25 @@
|
|||
#include "../../memory/RingMemory.h"
|
||||
|
||||
#define strtok_r strtok_s
|
||||
#define usleep Sleep
|
||||
|
||||
void usleep(uint64 microseconds)
|
||||
{
|
||||
if ((microseconds % 1000) == 0) {
|
||||
Sleep((DWORD) (microseconds / 1000));
|
||||
return;
|
||||
}
|
||||
|
||||
LARGE_INTEGER frequency;
|
||||
QueryPerformanceFrequency(&frequency);
|
||||
|
||||
LARGE_INTEGER start, end;
|
||||
QueryPerformanceCounter(&start);
|
||||
long long target = start.QuadPart + (microseconds * frequency.QuadPart) / 1000000;
|
||||
|
||||
do {
|
||||
QueryPerformanceCounter(&end);
|
||||
} while (end.QuadPart < target);
|
||||
}
|
||||
|
||||
inline
|
||||
time_t system_time()
|
||||
|
|
@ -113,7 +131,7 @@ file_size(const char* path)
|
|||
}
|
||||
|
||||
inline
|
||||
uint64 time_ms()
|
||||
uint64 time_mu()
|
||||
{
|
||||
LARGE_INTEGER frequency;
|
||||
LARGE_INTEGER counter;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user