Update Files

This commit is contained in:
2025-01-22 16:18:30 +01:00
parent ed4603cf95
commit a36294b518
16718 changed files with 2960346 additions and 0 deletions

View File

@ -0,0 +1,13 @@
#pragma once
#define KINC_ATOMIC_COMPARE_EXCHANGE(pointer, oldValue, newValue)
#define KINC_ATOMIC_COMPARE_EXCHANGE_POINTER(pointer, oldValue, newValue)
#define KINC_ATOMIC_INCREMENT(pointer)
#define KINC_ATOMIC_DECREMENT(pointer)
#define KINC_ATOMIC_EXCHANGE_32(pointer, value)
#define KINC_ATOMIC_EXCHANGE_FLOAT(pointer, value)

View File

@ -0,0 +1,118 @@
#include <AL/al.h>
#include <AL/alc.h>
#include <assert.h>
#include <emscripten.h>
#include <kinc/audio2/audio.h>
#include <stdio.h>
#include <stdlib.h>
static kinc_a2_buffer_t a2_buffer;
static ALCdevice *device = NULL;
static ALCcontext *context = NULL;
static unsigned int channels = 0;
static unsigned int bits = 0;
static ALenum format = 0;
static ALuint source = 0;
static bool audioRunning = false;
#define BUFSIZE 4096
static short buf[BUFSIZE];
#define NUM_BUFFERS 3
static uint32_t samples_per_second = 44100;
static void copySample(void *buffer) {
float left_value = *(float *)&a2_buffer.channels[0][a2_buffer.read_location];
float right_value = *(float *)&a2_buffer.channels[1][a2_buffer.read_location];
a2_buffer.read_location += 1;
if (a2_buffer.read_location >= a2_buffer.data_size) {
a2_buffer.read_location = 0;
}
((int16_t *)buffer)[0] = (int16_t)(left_value * 32767);
((int16_t *)buffer)[1] = (int16_t)(right_value * 32767);
}
static void streamBuffer(ALuint buffer) {
if (kinc_a2_internal_callback(&a2_buffer, BUFSIZE / 2)) {
for (int i = 0; i < BUFSIZE; i += 2) {
copySample(&buf[i]);
}
}
alBufferData(buffer, format, buf, BUFSIZE * 2, samples_per_second);
}
static void iter() {
if (!audioRunning) {
return;
}
ALint processed;
alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed);
if (processed <= 0) {
return;
}
while (processed--) {
ALuint buffer;
alSourceUnqueueBuffers(source, 1, &buffer);
streamBuffer(buffer);
alSourceQueueBuffers(source, 1, &buffer);
}
ALint playing;
alGetSourcei(source, AL_SOURCE_STATE, &playing);
if (playing != AL_PLAYING) {
alSourcePlay(source);
}
}
static bool a2_initialized = false;
void kinc_a2_init() {
if (a2_initialized) {
return;
}
kinc_a2_internal_init();
a2_initialized = true;
a2_buffer.read_location = 0;
a2_buffer.write_location = 0;
a2_buffer.data_size = 128 * 1024;
a2_buffer.channel_count = 2;
a2_buffer.channels[0] = (float*)malloc(a2_buffer.data_size * sizeof(float));
a2_buffer.channels[1] = (float*)malloc(a2_buffer.data_size * sizeof(float));
audioRunning = true;
device = alcOpenDevice(NULL);
context = alcCreateContext(device, NULL);
alcMakeContextCurrent(context);
format = AL_FORMAT_STEREO16;
ALuint buffers[NUM_BUFFERS];
alGenBuffers(NUM_BUFFERS, buffers);
alGenSources(1, &source);
streamBuffer(buffers[0]);
streamBuffer(buffers[1]);
streamBuffer(buffers[2]);
alSourceQueueBuffers(source, NUM_BUFFERS, buffers);
alSourcePlay(source);
}
void kinc_a2_update() {
iter();
}
void kinc_a2_shutdown() {
audioRunning = false;
}
uint32_t kinc_a2_samples_per_second(void) {
return samples_per_second;
}

View File

@ -0,0 +1,47 @@
#include <kinc/display.h>
void kinc_display_init(void) {}
int kinc_primary_display(void) {
return 0;
}
int kinc_count_displays(void) {
return 1;
}
bool kinc_display_available(int display_index) {
return false;
}
const char *kinc_display_name(int display_index) {
return "Browser";
}
kinc_display_mode_t kinc_display_current_mode(int display_index) {
kinc_display_mode_t mode;
mode.x = 0;
mode.y = 0;
mode.width = 800;
mode.height = 600;
mode.pixels_per_inch = 96;
mode.frequency = 60;
mode.bits_per_pixel = 32;
return mode;
}
int kinc_display_count_available_modes(int display_index) {
return 1;
}
kinc_display_mode_t kinc_display_available_mode(int display_index, int mode_index) {
kinc_display_mode_t mode;
mode.x = 0;
mode.y = 0;
mode.width = 800;
mode.height = 600;
mode.pixels_per_inch = 96;
mode.frequency = 60;
mode.bits_per_pixel = 32;
return mode;
}

View File

@ -0,0 +1,15 @@
#include <kinc/threads/event.h>
void kinc_event_init(kinc_event_t *event, bool auto_reset) {}
void kinc_event_destroy(kinc_event_t *event) {}
void kinc_event_signal(kinc_event_t *event) {}
void kinc_event_wait(kinc_event_t *event) {}
bool kinc_event_try_to_wait(kinc_event_t *event, double seconds) {
return false;
}
void kinc_event_reset(kinc_event_t *event) {}

View File

@ -0,0 +1,13 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int nothing;
} kinc_event_impl_t;
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,15 @@
#include <kinc/input/gamepad.h>
const char *kinc_gamepad_vendor(int gamepad) {
return "None";
}
const char *kinc_gamepad_product_name(int gamepad) {
return "Gamepad";
}
bool kinc_gamepad_connected(int gamepad) {
return false;
}
void kinc_gamepad_rumble(int gamepad, float left, float right) {}

View File

@ -0,0 +1,12 @@
#include "audio.c.h"
#include "display.c.h"
#include "event.c.h"
#include "gamepad.c.h"
#include "mouse.c.h"
#include "mutex.c.h"
#include "semaphore.c.h"
#include "system.c.h"
#include "thread.c.h"
#include "threadlocal.c.h"
#include "video.c.h"
#include "window.c.h"

View File

@ -0,0 +1,17 @@
#include <kinc/input/mouse.h>
void kinc_internal_mouse_lock(int window) {}
void kinc_internal_mouse_unlock(void) {}
bool kinc_mouse_can_lock(void) {
return false;
}
void kinc_mouse_show() {}
void kinc_mouse_hide() {}
void kinc_mouse_set_position(int window, int x, int y) {}
void kinc_mouse_get_position(int window, int *x, int *y) {}

View File

@ -0,0 +1,23 @@
#include <kinc/threads/mutex.h>
void kinc_mutex_init(kinc_mutex_t *mutex) {}
void kinc_mutex_destroy(kinc_mutex_t *mutex) {}
bool kinc_mutex_try_to_lock(kinc_mutex_t *mutex) {
return false;
}
void kinc_mutex_lock(kinc_mutex_t *mutex) {}
void kinc_mutex_unlock(kinc_mutex_t *mutex) {}
bool kinc_uber_mutex_init(kinc_uber_mutex_t *mutex, const char *name) {
return false;
}
void kinc_uber_mutex_destroy(kinc_uber_mutex_t *mutex) {}
void kinc_uber_mutex_lock(kinc_uber_mutex_t *mutex) {}
void kinc_uber_mutex_unlock(kinc_uber_mutex_t *mutex) {}

View File

@ -0,0 +1,17 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int nothing;
} kinc_mutex_impl_t;
typedef struct {
int nothing;
} kinc_uber_mutex_impl_t;
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,13 @@
#include <kinc/threads/semaphore.h>
void kinc_semaphore_init(kinc_semaphore_t *semaphore, int current, int max) {}
void kinc_semaphore_destroy(kinc_semaphore_t *semaphore) {}
void kinc_semaphore_release(kinc_semaphore_t *semaphore, int count) {}
void kinc_semaphore_acquire(kinc_semaphore_t *semaphore) {}
bool kinc_semaphore_try_to_acquire(kinc_semaphore_t *semaphore, double seconds) {
return false;
}

View File

@ -0,0 +1,13 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int nothing;
} kinc_semaphore_impl_t;
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,350 @@
#ifdef KINC_OPENGL
#include <GL/glfw.h>
#endif
#include <emscripten/emscripten.h>
#include <kinc/audio2/audio.h>
#include <kinc/graphics4/graphics.h>
#include <kinc/input/keyboard.h>
#include <kinc/input/mouse.h>
#include <kinc/log.h>
#include <kinc/system.h>
#include <kinc/window.h>
#include <stdio.h>
#include <stdlib.h>
static int html5_argc;
static char **html5_argv;
static bool initialized = false;
static void drawfunc() {
if (!initialized)
return;
kinc_internal_update_callback();
kinc_a2_update();
#ifdef KINC_OPENGL
glfwSwapBuffers();
#endif
}
#define KEY_DOWN(GLFW_KEYCODE, KINC_KEY) \
case GLFW_KEYCODE: \
kinc_internal_keyboard_trigger_key_down(KINC_KEY); \
break;
#define KEY_UP(GLFW_KEYCODE, KINC_KEY) \
case GLFW_KEYCODE: \
kinc_internal_keyboard_trigger_key_up(KINC_KEY); \
break;
#ifdef KINC_OPENGL
// glfw mappings as state here: https://www.glfw.org/docs/3.3/group__keys.html
static void onKeyPressed(int key, int action) {
if (action == GLFW_PRESS) {
switch (key) {
KEY_DOWN(32, KINC_KEY_SPACE)
KEY_DOWN(39, KINC_KEY_QUOTE)
KEY_DOWN(44, KINC_KEY_COMMA)
KEY_DOWN(45, KINC_KEY_SUBTRACT)
KEY_DOWN(46, KINC_KEY_PERIOD)
KEY_DOWN(47, KINC_KEY_SLASH)
KEY_DOWN(48, KINC_KEY_0)
KEY_DOWN(49, KINC_KEY_1)
KEY_DOWN(50, KINC_KEY_2)
KEY_DOWN(51, KINC_KEY_3)
KEY_DOWN(52, KINC_KEY_4)
KEY_DOWN(53, KINC_KEY_5)
KEY_DOWN(54, KINC_KEY_6)
KEY_DOWN(55, KINC_KEY_7)
KEY_DOWN(56, KINC_KEY_8)
KEY_DOWN(57, KINC_KEY_9)
KEY_DOWN(59, KINC_KEY_SEMICOLON)
KEY_DOWN(61, KINC_KEY_EQUALS)
KEY_DOWN(65, KINC_KEY_A)
KEY_DOWN(66, KINC_KEY_B)
KEY_DOWN(67, KINC_KEY_C)
KEY_DOWN(68, KINC_KEY_D)
KEY_DOWN(69, KINC_KEY_E)
KEY_DOWN(70, KINC_KEY_F)
KEY_DOWN(71, KINC_KEY_G)
KEY_DOWN(72, KINC_KEY_H)
KEY_DOWN(73, KINC_KEY_I)
KEY_DOWN(74, KINC_KEY_J)
KEY_DOWN(75, KINC_KEY_K)
KEY_DOWN(76, KINC_KEY_L)
KEY_DOWN(77, KINC_KEY_M)
KEY_DOWN(78, KINC_KEY_N)
KEY_DOWN(79, KINC_KEY_O)
KEY_DOWN(80, KINC_KEY_P)
KEY_DOWN(81, KINC_KEY_Q)
KEY_DOWN(82, KINC_KEY_R)
KEY_DOWN(83, KINC_KEY_S)
KEY_DOWN(84, KINC_KEY_T)
KEY_DOWN(85, KINC_KEY_U)
KEY_DOWN(86, KINC_KEY_V)
KEY_DOWN(87, KINC_KEY_W)
KEY_DOWN(88, KINC_KEY_X)
KEY_DOWN(89, KINC_KEY_Y)
KEY_DOWN(90, KINC_KEY_Z)
KEY_DOWN(92, KINC_KEY_BACK_SLASH)
KEY_DOWN(256, KINC_KEY_ESCAPE)
KEY_DOWN(257, KINC_KEY_RETURN)
KEY_DOWN(258, KINC_KEY_TAB)
KEY_DOWN(259, KINC_KEY_BACKSPACE)
KEY_DOWN(260, KINC_KEY_INSERT)
KEY_DOWN(261, KINC_KEY_DELETE)
KEY_DOWN(262, KINC_KEY_RIGHT)
KEY_DOWN(263, KINC_KEY_LEFT)
KEY_DOWN(264, KINC_KEY_DOWN)
KEY_DOWN(265, KINC_KEY_UP)
KEY_DOWN(268, KINC_KEY_HOME)
KEY_DOWN(269, KINC_KEY_END)
KEY_DOWN(284, KINC_KEY_PAUSE)
KEY_DOWN(290, KINC_KEY_F1)
KEY_DOWN(291, KINC_KEY_F2)
KEY_DOWN(292, KINC_KEY_F3)
KEY_DOWN(293, KINC_KEY_F4)
KEY_DOWN(294, KINC_KEY_F5)
KEY_DOWN(295, KINC_KEY_F6)
KEY_DOWN(296, KINC_KEY_F7)
KEY_DOWN(297, KINC_KEY_F8)
KEY_DOWN(298, KINC_KEY_F9)
KEY_DOWN(299, KINC_KEY_F10)
KEY_DOWN(300, KINC_KEY_F11)
KEY_DOWN(301, KINC_KEY_F12)
KEY_DOWN(302, KINC_KEY_F13)
KEY_DOWN(303, KINC_KEY_F14)
KEY_DOWN(304, KINC_KEY_F15)
KEY_DOWN(305, KINC_KEY_F16)
KEY_DOWN(306, KINC_KEY_F17)
KEY_DOWN(307, KINC_KEY_F18)
KEY_DOWN(308, KINC_KEY_F19)
KEY_DOWN(309, KINC_KEY_F20)
KEY_DOWN(310, KINC_KEY_F21)
KEY_DOWN(311, KINC_KEY_F22)
KEY_DOWN(312, KINC_KEY_F23)
KEY_DOWN(313, KINC_KEY_F24)
KEY_DOWN(348, KINC_KEY_CONTEXT_MENU)
}
}
else {
switch (key) {
KEY_UP(32, KINC_KEY_SPACE)
KEY_UP(39, KINC_KEY_QUOTE)
KEY_UP(44, KINC_KEY_COMMA)
KEY_UP(45, KINC_KEY_SUBTRACT)
KEY_UP(46, KINC_KEY_PERIOD)
KEY_UP(47, KINC_KEY_SLASH)
KEY_UP(48, KINC_KEY_0)
KEY_UP(49, KINC_KEY_1)
KEY_UP(50, KINC_KEY_2)
KEY_UP(51, KINC_KEY_3)
KEY_UP(52, KINC_KEY_4)
KEY_UP(53, KINC_KEY_5)
KEY_UP(54, KINC_KEY_6)
KEY_UP(55, KINC_KEY_7)
KEY_UP(56, KINC_KEY_8)
KEY_UP(57, KINC_KEY_9)
KEY_UP(59, KINC_KEY_SEMICOLON)
KEY_UP(61, KINC_KEY_EQUALS)
KEY_UP(65, KINC_KEY_A)
KEY_UP(66, KINC_KEY_B)
KEY_UP(67, KINC_KEY_C)
KEY_UP(68, KINC_KEY_D)
KEY_UP(69, KINC_KEY_E)
KEY_UP(70, KINC_KEY_F)
KEY_UP(71, KINC_KEY_G)
KEY_UP(72, KINC_KEY_H)
KEY_UP(73, KINC_KEY_I)
KEY_UP(74, KINC_KEY_J)
KEY_UP(75, KINC_KEY_K)
KEY_UP(76, KINC_KEY_L)
KEY_UP(77, KINC_KEY_M)
KEY_UP(78, KINC_KEY_N)
KEY_UP(79, KINC_KEY_O)
KEY_UP(80, KINC_KEY_P)
KEY_UP(81, KINC_KEY_Q)
KEY_UP(82, KINC_KEY_R)
KEY_UP(83, KINC_KEY_S)
KEY_UP(84, KINC_KEY_T)
KEY_UP(85, KINC_KEY_U)
KEY_UP(86, KINC_KEY_V)
KEY_UP(87, KINC_KEY_W)
KEY_UP(88, KINC_KEY_X)
KEY_UP(89, KINC_KEY_Y)
KEY_UP(90, KINC_KEY_Z)
KEY_UP(92, KINC_KEY_BACK_SLASH)
KEY_UP(256, KINC_KEY_ESCAPE)
KEY_UP(257, KINC_KEY_RETURN)
KEY_UP(258, KINC_KEY_TAB)
KEY_UP(259, KINC_KEY_BACKSPACE)
KEY_UP(260, KINC_KEY_INSERT)
KEY_UP(261, KINC_KEY_DELETE)
KEY_UP(262, KINC_KEY_RIGHT)
KEY_UP(263, KINC_KEY_LEFT)
KEY_UP(264, KINC_KEY_DOWN)
KEY_UP(265, KINC_KEY_UP)
KEY_UP(268, KINC_KEY_HOME)
KEY_UP(269, KINC_KEY_END)
KEY_UP(284, KINC_KEY_PAUSE)
KEY_UP(290, KINC_KEY_F1)
KEY_UP(291, KINC_KEY_F2)
KEY_UP(292, KINC_KEY_F3)
KEY_UP(293, KINC_KEY_F4)
KEY_UP(294, KINC_KEY_F5)
KEY_UP(295, KINC_KEY_F6)
KEY_UP(296, KINC_KEY_F7)
KEY_UP(297, KINC_KEY_F8)
KEY_UP(298, KINC_KEY_F9)
KEY_UP(299, KINC_KEY_F10)
KEY_UP(300, KINC_KEY_F11)
KEY_UP(301, KINC_KEY_F12)
KEY_UP(302, KINC_KEY_F13)
KEY_UP(303, KINC_KEY_F14)
KEY_UP(304, KINC_KEY_F15)
KEY_UP(305, KINC_KEY_F16)
KEY_UP(306, KINC_KEY_F17)
KEY_UP(307, KINC_KEY_F18)
KEY_UP(308, KINC_KEY_F19)
KEY_UP(309, KINC_KEY_F20)
KEY_UP(310, KINC_KEY_F21)
KEY_UP(311, KINC_KEY_F22)
KEY_UP(312, KINC_KEY_F23)
KEY_UP(313, KINC_KEY_F24)
KEY_UP(348, KINC_KEY_CONTEXT_MENU)
}
}
}
static int mouseX = 0;
static int mouseY = 0;
static void onMouseClick(int button, int action) {
if (action == GLFW_PRESS) {
if (button == 0) {
kinc_internal_mouse_trigger_press(0, 0, mouseX, mouseY);
}
else if (button == 1) {
kinc_internal_mouse_trigger_press(0, 1, mouseX, mouseY);
}
}
else {
if (button == 0) {
kinc_internal_mouse_trigger_release(0, 0, mouseX, mouseY);
}
else if (button == 1) {
kinc_internal_mouse_trigger_release(0, 1, mouseX, mouseY);
}
}
}
static void onMouseMove(int x, int y) {
mouseX = x;
mouseY = y;
kinc_internal_mouse_trigger_move(0, x, y);
}
#endif
static int with, height;
extern int kinc_internal_window_width;
extern int kinc_internal_window_height;
#ifdef KINC_KONG
void kong_init(void);
#endif
int kinc_init(const char *name, int width, int height, kinc_window_options_t *win, kinc_framebuffer_options_t *frame) {
kinc_window_options_t defaultWin;
if (win == NULL) {
kinc_window_options_set_defaults(&defaultWin);
win = &defaultWin;
}
kinc_framebuffer_options_t defaultFrame;
if (frame == NULL) {
kinc_framebuffer_options_set_defaults(&defaultFrame);
frame = &defaultFrame;
}
win->width = width;
win->height = height;
#ifdef KINC_OPENGL
glfwInit();
glfwOpenWindow(width, height, 8, 8, 8, 0, frame->depth_bits, frame->stencil_bits, GLFW_WINDOW);
glfwSetWindowTitle(name);
glfwSetKeyCallback(onKeyPressed);
glfwSetMousePosCallback(onMouseMove);
glfwSetMouseButtonCallback(onMouseClick);
#endif
kinc_internal_window_width = width;
kinc_internal_window_height = height;
kinc_g4_internal_init();
kinc_g4_internal_init_window(0, frame->depth_bits, frame->stencil_bits, true);
#ifdef KINC_KONG
kong_init();
#endif
return 0;
}
bool kinc_internal_handle_messages() {
return true;
}
void kinc_set_keep_screen_on(bool on) {}
double kinc_frequency(void) {
return 1000.0;
}
kinc_ticks_t kinc_timestamp(void) {
#ifdef KINC_OPENGL
return (kinc_ticks_t)(glfwGetTime() * 1000.0);
#else
return (kinc_ticks_t)(0.0);
#endif
}
double kinc_time(void) {
#ifdef KINC_OPENGL
return glfwGetTime();
#else
return 0.0;
#endif
}
int kinc_cpu_cores(void) {
return 4;
}
int kinc_hardware_threads(void) {
return 4;
}
extern int kickstart(int argc, char **argv);
#ifdef KINC_WEBGPU
EMSCRIPTEN_KEEPALIVE void kinc_internal_webgpu_initialized() {
kickstart(html5_argc, html5_argv);
initialized = true;
}
#endif
int main(int argc, char **argv) {
html5_argc = argc;
html5_argv = argv;
#ifdef KINC_WEBGPU
char *code = "(async () => {\
const adapter = await navigator.gpu.requestAdapter();\
const device = await adapter.requestDevice();\
Module.preinitializedWebGPUDevice = device;\
_kinc_internal_webgpu_initialized();\
})();";
emscripten_run_script(code);
#else
kickstart(argc, argv);
initialized = true;
#endif
emscripten_set_main_loop(drawfunc, 0, 1);
}

View File

@ -0,0 +1,15 @@
#include <kinc/threads/thread.h>
void kinc_thread_init(kinc_thread_t *t, void (*thread)(void *param), void *param) {}
void kinc_thread_wait_and_destroy(kinc_thread_t *thread) {}
bool kinc_thread_try_to_destroy(kinc_thread_t *thread) {
return false;
}
void kinc_threads_init() {}
void kinc_threads_quit() {}
void kinc_thread_sleep(int milliseconds) {}

View File

@ -0,0 +1,13 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int nothing;
} kinc_thread_impl_t;
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,13 @@
#include <kinc/threads/threadlocal.h>
#include <string.h>
void kinc_thread_local_init(kinc_thread_local_t *local) {}
void kinc_thread_local_destroy(kinc_thread_local_t *local) {}
void *kinc_thread_local_get(kinc_thread_local_t *local) {
return NULL;
}
void kinc_thread_local_set(kinc_thread_local_t *local, void *data) {}

View File

@ -0,0 +1,13 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int nothing;
} kinc_thread_local_impl_t;
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,57 @@
#include <kinc/video.h>
void kinc_video_init(kinc_video_t *video, const char *filename) {}
void kinc_video_destroy(kinc_video_t *video) {}
void kinc_video_play(kinc_video_t *video, bool loop) {}
void kinc_video_pause(kinc_video_t *video) {}
void kinc_video_stop(kinc_video_t *video) {}
int kinc_video_width(kinc_video_t *video) {
return 256;
}
int kinc_video_height(kinc_video_t *video) {
return 256;
}
kinc_g4_texture_t *kinc_video_current_image(kinc_video_t *video) {
return NULL;
}
double kinc_video_duration(kinc_video_t *video) {
return 0.0;
}
double kinc_video_position(kinc_video_t *video) {
return 0.0;
}
bool kinc_video_finished(kinc_video_t *video) {
return false;
}
bool kinc_video_paused(kinc_video_t *video) {
return false;
}
void kinc_video_update(kinc_video_t *video, double time) {}
void kinc_internal_video_sound_stream_init(kinc_internal_video_sound_stream_t *stream, int channel_count, int frequency) {}
void kinc_internal_video_sound_stream_destroy(kinc_internal_video_sound_stream_t *stream) {}
void kinc_internal_video_sound_stream_insert_data(kinc_internal_video_sound_stream_t *stream, float *data, int sample_count) {}
float samples[2] = {0};
float *kinc_internal_video_sound_stream_next_frame(kinc_internal_video_sound_stream_t *stream) {
return samples;
}
bool kinc_internal_video_sound_stream_ended(kinc_internal_video_sound_stream_t *stream) {
return true;
}

View File

@ -0,0 +1,27 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int nothing;
} kinc_video_impl_t;
typedef struct kinc_internal_video_sound_stream {
int nothing;
} kinc_internal_video_sound_stream_t;
void kinc_internal_video_sound_stream_init(kinc_internal_video_sound_stream_t *stream, int channel_count, int frequency);
void kinc_internal_video_sound_stream_destroy(kinc_internal_video_sound_stream_t *stream);
void kinc_internal_video_sound_stream_insert_data(kinc_internal_video_sound_stream_t *stream, float *data, int sample_count);
float *kinc_internal_video_sound_stream_next_frame(kinc_internal_video_sound_stream_t *stream);
bool kinc_internal_video_sound_stream_ended(kinc_internal_video_sound_stream_t *stream);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,81 @@
#include <kinc/display.h>
#include <kinc/graphics4/graphics.h>
#include <kinc/window.h>
#include <string.h>
int kinc_internal_window_width = 0;
int kinc_internal_window_height = 0;
kinc_window_mode_t kinc_internal_window_mode = KINC_WINDOW_MODE_WINDOW;
int kinc_count_windows(void) {
return 1;
}
int kinc_window_x(int window_index) {
return 0;
}
int kinc_window_y(int window_index) {
return 0;
}
int kinc_window_width(int window_index) {
return kinc_internal_window_width;
}
int kinc_window_height(int window_index) {
return kinc_internal_window_height;
}
void kinc_window_resize(int window_index, int width, int height) {}
void kinc_window_move(int window_index, int x, int y) {}
void kinc_window_change_framebuffer(int window_index, kinc_framebuffer_options_t *frame) {
//**kinc_g4_changeFramebuffer(0, frame);
}
void kinc_window_change_features(int window_index, int features) {}
// In HTML5 fullscreen is activable only from user input.
void kinc_window_change_mode(int window_index, kinc_window_mode_t mode) {
if (mode == KINC_WINDOW_MODE_FULLSCREEN || mode == KINC_WINDOW_MODE_EXCLUSIVE_FULLSCREEN) {
if (kinc_internal_window_mode == KINC_WINDOW_MODE_FULLSCREEN || kinc_internal_window_mode == KINC_WINDOW_MODE_EXCLUSIVE_FULLSCREEN) {
kinc_internal_window_mode = mode;
return;
}
// TODO: call js Fullscreen API
kinc_internal_window_mode = mode;
}
else {
if (mode == kinc_internal_window_mode) {
return;
}
// TODO: call js Fullscreen API
kinc_internal_window_mode = mode;
}
}
void kinc_window_destroy(int window_index) {}
void kinc_window_show(int window_index) {}
void kinc_window_hide(int window_index) {}
// TODO: change browser title.
void kinc_window_set_title(int window_index, const char *title) {}
int kinc_window_create(kinc_window_options_t *win, kinc_framebuffer_options_t *frame) {
return 0;
}
void kinc_window_set_resize_callback(int window_index, void (*callback)(int x, int y, void *data), void *data) {}
void kinc_window_set_ppi_changed_callback(int window_index, void (*callback)(int ppi, void *data), void *data) {}
void kinc_window_set_close_callback(int window, bool (*callback)(void *), void *data) {}
kinc_window_mode_t kinc_window_get_mode(int window_index) {
return kinc_internal_window_mode;
}

View File

@ -0,0 +1,8 @@
#pragma once
namespace Kore {
struct WindowData {
int width, height, mode;
WindowData();
};
}