forked from LeenkxTeam/LNXSDK
Update Files
This commit is contained in:
246
Kha/Kinc/Backends/System/Wasm/Sources/GL/gl.h
Normal file
246
Kha/Kinc/Backends/System/Wasm/Sources/GL/gl.h
Normal file
@ -0,0 +1,246 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef int GLint;
|
||||
typedef unsigned GLuint;
|
||||
typedef size_t GLsizei;
|
||||
typedef float GLfloat;
|
||||
typedef int GLenum;
|
||||
typedef bool GLboolean;
|
||||
typedef uint8_t GLubyte;
|
||||
typedef float GLclampf;
|
||||
typedef int GLbitfield;
|
||||
typedef uint64_t GLsizeiptr;
|
||||
typedef uint64_t GLintptr;
|
||||
typedef char GLchar;
|
||||
|
||||
// custom
|
||||
#define GL_MAJOR_VERSION 2
|
||||
#define GL_EXTENSIONS 0
|
||||
#define GL_TRUE 1
|
||||
#define GL_FALSE 0
|
||||
|
||||
// not supported
|
||||
#define GL_INFO_LOG_LENGTH 0xABCD
|
||||
|
||||
// regular WebGL defines
|
||||
#define GL_CLAMP_TO_EDGE 0x812F
|
||||
#define GL_INT_VEC2 0x8B53
|
||||
#define GL_INT_VEC3 0x8B54
|
||||
#define GL_INT_VEC4 0x8B55
|
||||
#define GL_FLOAT_VEC2 0x8B50
|
||||
#define GL_FLOAT_VEC3 0x8B51
|
||||
#define GL_FLOAT_VEC4 0x8B52
|
||||
#define GL_FLOAT_MAT4 0x8B5C
|
||||
#define GL_UNSIGNED_SHORT 0x1403
|
||||
#define GL_UNSIGNED_INT 0x1405
|
||||
#define GL_TRIANGLES 0x0004
|
||||
#define GL_SCISSOR_TEST 15
|
||||
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
|
||||
#define GL_TEXTURE0 0x84C0
|
||||
#define GL_TEXTURE_WRAP_S 0x2802
|
||||
#define GL_TEXTURE_WRAP_T 0x2803
|
||||
#define GL_REPEAT 0x2901
|
||||
#define GL_DEPTH_TEST 0x0B71
|
||||
#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||
#define GL_DEPTH_BUFFER_BIT 0x00000100
|
||||
#define GL_STENCIL_BUFFER_BIT 0x00000400
|
||||
#define GL_TEXTURE_2D 0x0DE1
|
||||
#define GL_TEXTURE_MIN_FILTER 0x2801
|
||||
#define GL_TEXTURE_MAG_FILTER 0x2800
|
||||
#define GL_NEAREST 0x2600
|
||||
#define GL_LINEAR 0x2601
|
||||
#define GL_NEAREST_MIPMAP_NEAREST 0x2700
|
||||
#define GL_LINEAR_MIPMAP_NEAREST 0x2701
|
||||
#define GL_NEAREST_MIPMAP_LINEAR 0x2702
|
||||
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
|
||||
#define GL_LEQUAL 0x0203
|
||||
#define GL_NONE 0
|
||||
#define GL_TEXTURE_CUBE_MAP 0x8513
|
||||
#define GL_TEXTURE_MIN_LOD 0x813A
|
||||
#define GL_TEXTURE_MAX_LOD 0x813B
|
||||
#define GL_FRAMEBUFFER 0x8D40
|
||||
#define GL_COLOR_ATTACHMENT0 0x8CE0
|
||||
#define GL_DEPTH_ATTACHMENT 0x8D00
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
|
||||
#define GL_ANY_SAMPLES_PASSED 0x8C2F
|
||||
#define GL_QUERY_RESULT_AVAILABLE 0x8867
|
||||
#define GL_QUERY_RESULT 0x8866
|
||||
#define GL_FRONT 0x0404
|
||||
#define GL_BACK 0x0405
|
||||
#define GL_ALWAYS 0x0207
|
||||
#define GL_EQUAL 0x0202
|
||||
#define GL_GREATER 0x0204
|
||||
#define GL_GEQUAL 0x0206
|
||||
#define GL_LESS 0x0201
|
||||
#define GL_NEVER 0x0200
|
||||
#define GL_NOTEQUAL 0x0205
|
||||
#define GL_STATIC_DRAW 0x88E4
|
||||
#define GL_DYNAMIC_DRAW 0x88E8
|
||||
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
|
||||
#define GL_DECR 0x1E03
|
||||
#define GL_DECR_WRAP 0x8508
|
||||
#define GL_INCR 0x1E02
|
||||
#define GL_INCR_WRAP 0x8507
|
||||
#define GL_INVERT 0x150A
|
||||
#define GL_KEEP 0x1E00
|
||||
#define GL_REPLACE 0x1E01
|
||||
#define GL_ZERO 0
|
||||
#define GL_ONE 1
|
||||
#define GL_SRC_ALPHA 0x0302
|
||||
#define GL_DST_ALPHA 0x0304
|
||||
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
|
||||
#define GL_ONE_MINUS_DST_ALPHA 0x0305
|
||||
#define GL_SRC_COLOR 0x0300
|
||||
#define GL_DST_COLOR 0x0306
|
||||
#define GL_ONE_MINUS_SRC_COLOR 0x0301
|
||||
#define GL_ONE_MINUS_DST_COLOR 0x0307
|
||||
#define GL_FUNC_ADD 0x8006
|
||||
#define GL_FUNC_SUBTRACT 0x800A
|
||||
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
|
||||
#define GL_MIN 0x8007
|
||||
#define GL_MAX 0x8008
|
||||
#define GL_VERTEX_SHADER 0x8B31
|
||||
#define GL_FRAGMENT_SHADER 0x8B30
|
||||
#define GL_COMPILE_STATUS 0x8B81
|
||||
#define GL_LINK_STATUS 0x8B82
|
||||
#define GL_STENCIL_TEST 0x0B90
|
||||
#define GL_CULL_FACE 0x0B44
|
||||
#define GL_BLEND 0x0BE2
|
||||
#define GL_FLOAT 0x1406
|
||||
#define GL_ACTIVE_UNIFORMS 0x8B86
|
||||
#define GL_DEPTH24_STENCIL8_OES 0x88F0
|
||||
#define GL_DEPTH_COMPONENT 0x1902
|
||||
#define GL_DEPTH_COMPONENT16 0x81A5
|
||||
#define GL_STENCIL_ATTACHMENT 0x8D20
|
||||
#define GL_RENDERBUFFER 0x8D41
|
||||
#define GL_RGBA 0x1908
|
||||
#define GL_LUMINANCE 0x1909
|
||||
#define GL_R8 0x8229
|
||||
#define GL_RED 0x1903
|
||||
#define GL_UNSIGNED_BYTE 0x1401
|
||||
#define GL_RGB 0x1907
|
||||
#define GL_UNPACK_ALIGNMENT 0x0CF5
|
||||
#define GL_ARRAY_BUFFER 0x8892
|
||||
#define GL_BYTE 0x1400
|
||||
#define GL_SHORT 0x1402
|
||||
#define GL_INT 0x1404
|
||||
#define GL_CONSTANT_COLOR 0x8001
|
||||
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
|
||||
#define GL_MAX_VERTEX_ATTRIBS 0x8869
|
||||
|
||||
__attribute__((import_module("imports"), import_name("glUniform1i"))) void glUniform1i(GLint location, GLint v0);
|
||||
__attribute__((import_module("imports"), import_name("glUniform2i"))) void glUniform2i(GLint location, GLint v0, GLint v1);
|
||||
__attribute__((import_module("imports"), import_name("glUniform3i"))) void glUniform3i(GLint location, GLint v0, GLint v1, GLint v2);
|
||||
__attribute__((import_module("imports"), import_name("glUniform4i"))) void glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
__attribute__((import_module("imports"), import_name("glUniform1iv"))) void glUniform1iv(GLint location, GLsizei count, const GLint *value);
|
||||
__attribute__((import_module("imports"), import_name("glUniform2iv"))) void glUniform2iv(GLint location, GLsizei count, const GLint *value);
|
||||
__attribute__((import_module("imports"), import_name("glUniform3iv"))) void glUniform3iv(GLint location, GLsizei count, const GLint *value);
|
||||
__attribute__((import_module("imports"), import_name("glUniform4iv"))) void glUniform4iv(GLint location, GLsizei count, const GLint *value);
|
||||
__attribute__((import_module("imports"), import_name("glUniform1f"))) void glUniform1f(GLint location, GLfloat v0);
|
||||
__attribute__((import_module("imports"), import_name("glUniform2f"))) void glUniform2f(GLint location, GLfloat v0, GLfloat v1);
|
||||
__attribute__((import_module("imports"), import_name("glUniform3f"))) void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
__attribute__((import_module("imports"), import_name("glUniform4f"))) void glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
__attribute__((import_module("imports"), import_name("glUniform1fv"))) void glUniform1fv(GLint location, GLsizei count, const GLfloat *value);
|
||||
__attribute__((import_module("imports"), import_name("glUniform2fv"))) void glUniform2fv(GLint location, GLsizei count, const GLfloat *value);
|
||||
__attribute__((import_module("imports"), import_name("glUniform3fv"))) void glUniform3fv(GLint location, GLsizei count, const GLfloat *value);
|
||||
__attribute__((import_module("imports"), import_name("glUniform4fv"))) void glUniform4fv(GLint location, GLsizei count, const GLfloat *value);
|
||||
__attribute__((import_module("imports"), import_name("glUniformMatrix3fv"))) void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose,
|
||||
const GLfloat *value);
|
||||
__attribute__((import_module("imports"), import_name("glUniformMatrix4fv"))) void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose,
|
||||
const GLfloat *value);
|
||||
__attribute__((import_module("imports"), import_name("glViewport"))) void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
__attribute__((import_module("imports"), import_name("glGetIntegerv"))) void glGetIntegerv(GLenum pname, GLint *data);
|
||||
__attribute__((import_module("imports"), import_name("glGetString"))) const GLubyte *glGetString(GLenum name);
|
||||
__attribute__((import_module("imports"), import_name("glDrawElements"))) void glDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices);
|
||||
__attribute__((import_module("imports"), import_name("glEnable"))) void glEnable(GLenum cap);
|
||||
__attribute__((import_module("imports"), import_name("glDisable"))) void glDisable(GLenum cap);
|
||||
__attribute__((import_module("imports"), import_name("glScissor"))) void glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
__attribute__((import_module("imports"), import_name("glColorMask"))) void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
__attribute__((import_module("imports"), import_name("glClearColor"))) void glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
__attribute__((import_module("imports"), import_name("glDepthMask"))) void glDepthMask(GLboolean flag);
|
||||
__attribute__((import_module("imports"), import_name("glClearDepthf"))) void glClearDepthf(GLclampf depth);
|
||||
__attribute__((import_module("imports"), import_name("glStencilMask"))) void glStencilMask(GLuint mask);
|
||||
__attribute__((import_module("imports"), import_name("glClearStencil"))) void glClearStencil(GLint s);
|
||||
__attribute__((import_module("imports"), import_name("glClear"))) void glClear(GLbitfield mask);
|
||||
__attribute__((import_module("imports"), import_name("glTexParameteri"))) void glTexParameteri(GLenum target, GLenum pname, GLint param);
|
||||
__attribute__((import_module("imports"), import_name("glActiveTexture"))) void glActiveTexture(GLenum texture);
|
||||
__attribute__((import_module("imports"), import_name("glGetFloatv"))) void glGetFloatv(GLenum pname, GLfloat *params);
|
||||
__attribute__((import_module("imports"), import_name("glTexParameterf"))) void glTexParameterf(GLenum target, GLenum pname, GLfloat param);
|
||||
__attribute__((import_module("imports"), import_name("glBindFramebuffer"))) void glBindFramebuffer(GLenum target, GLuint framebuffer);
|
||||
__attribute__((import_module("imports"), import_name("glFramebufferTexture2D"))) void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget,
|
||||
GLuint texture, GLint level);
|
||||
__attribute__((import_module("imports"), import_name("glGenQueries"))) void glGenQueries(GLsizei n, GLuint *ids);
|
||||
__attribute__((import_module("imports"), import_name("glDeleteQueries"))) void glDeleteQueries(GLsizei n, const GLuint *ids);
|
||||
__attribute__((import_module("imports"), import_name("glBeginQuery"))) void glBeginQuery(GLenum target, GLuint id);
|
||||
__attribute__((import_module("imports"), import_name("glEndQuery"))) void glEndQuery(GLenum target);
|
||||
__attribute__((import_module("imports"), import_name("glGetQueryObjectuiv"))) void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
|
||||
__attribute__((import_module("imports"), import_name("glDrawArrays"))) void glDrawArrays(GLenum mode, GLint first, GLsizei count);
|
||||
__attribute__((import_module("imports"), import_name("glFlush"))) void glFlush(void);
|
||||
__attribute__((import_module("imports"), import_name("glStencilFuncSeparate"))) void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
|
||||
__attribute__((import_module("imports"), import_name("glGenBuffers"))) void glGenBuffers(GLsizei n, GLuint *buffers);
|
||||
__attribute__((import_module("imports"), import_name("glDeleteBuffers"))) void glDeleteBuffers(GLsizei n, const GLuint *buffers);
|
||||
__attribute__((import_module("imports"), import_name("glBindBuffer"))) void glBindBuffer(GLenum target, GLuint buffer);
|
||||
__attribute__((import_module("imports"), import_name("glBufferData"))) void glBufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||
__attribute__((import_module("imports"), import_name("glCreateProgram"))) GLuint glCreateProgram(void);
|
||||
__attribute__((import_module("imports"), import_name("glDeleteProgram"))) void glDeleteProgram(GLuint program);
|
||||
__attribute__((import_module("imports"), import_name("glCreateShader"))) GLuint glCreateShader(GLenum shaderType);
|
||||
__attribute__((import_module("imports"), import_name("glShaderSource"))) void glShaderSource(GLuint shader, GLsizei count, const GLchar **string,
|
||||
const GLint *length);
|
||||
__attribute__((import_module("imports"), import_name("glCompileShader"))) void glCompileShader(GLuint shader);
|
||||
__attribute__((import_module("imports"), import_name("glGetShaderiv"))) void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);
|
||||
__attribute__((import_module("imports"), import_name("glGetShaderInfoLog"))) void glGetShaderInfoLog(GLuint shader, GLsizei maxLength, GLsizei *length,
|
||||
GLchar *infoLog);
|
||||
__attribute__((import_module("imports"), import_name("glAttachShader"))) void glAttachShader(GLuint program, GLuint shader);
|
||||
__attribute__((import_module("imports"), import_name("glBindAttribLocation"))) void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name);
|
||||
__attribute__((import_module("imports"), import_name("glLinkProgram"))) void glLinkProgram(GLuint program);
|
||||
__attribute__((import_module("imports"), import_name("glGetProgramiv"))) void glGetProgramiv(GLuint program, GLenum pname, GLint *params);
|
||||
__attribute__((import_module("imports"), import_name("glGetProgramInfoLog"))) void glGetProgramInfoLog(GLuint program, GLsizei maxLength, GLsizei *length,
|
||||
GLchar *infoLog);
|
||||
__attribute__((import_module("imports"), import_name("glUseProgram"))) void glUseProgram(GLuint program);
|
||||
__attribute__((import_module("imports"), import_name("glStencilMaskSeparate"))) void glStencilMaskSeparate(GLenum face, GLuint mask);
|
||||
__attribute__((import_module("imports"), import_name("glStencilOpSeparate"))) void glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
|
||||
__attribute__((import_module("imports"), import_name("glDepthFunc"))) void glDepthFunc(GLenum func);
|
||||
__attribute__((import_module("imports"), import_name("glCullFace"))) void glCullFace(GLenum mode);
|
||||
__attribute__((import_module("imports"), import_name("glBlendFuncSeparate"))) void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha,
|
||||
GLenum dstAlpha);
|
||||
__attribute__((import_module("imports"), import_name("glBlendEquationSeparate"))) void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
|
||||
__attribute__((import_module("imports"), import_name("glGetUniformLocation"))) GLint glGetUniformLocation(GLuint program, const GLchar *name);
|
||||
__attribute__((import_module("imports"), import_name("glGetActiveUniform"))) void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize,
|
||||
GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
__attribute__((import_module("imports"), import_name("glGenTextures"))) void glGenTextures(GLsizei n, GLuint *textures);
|
||||
__attribute__((import_module("imports"), import_name("glDeleteTextures"))) void glDeleteTextures(GLsizei n, const GLuint *textures);
|
||||
__attribute__((import_module("imports"), import_name("glBindTexture"))) void glBindTexture(GLenum target, GLuint texture);
|
||||
__attribute__((import_module("imports"), import_name("glTexImage2D"))) void
|
||||
glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *data);
|
||||
__attribute__((import_module("imports"), import_name("glGenRenderbuffers"))) void glGenRenderbuffers(GLsizei n, GLuint *renderbuffers);
|
||||
__attribute__((import_module("imports"), import_name("glBindRenderbuffer"))) void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
|
||||
__attribute__((import_module("imports"), import_name("glRenderbufferStorage"))) void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width,
|
||||
GLsizei height);
|
||||
__attribute__((import_module("imports"), import_name("glGenFramebuffers"))) void glGenFramebuffers(GLsizei n, GLuint *ids);
|
||||
__attribute__((import_module("imports"), import_name("glDeleteFramebuffers"))) void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
|
||||
__attribute__((import_module("imports"), import_name("glReadPixels"))) void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
|
||||
GLenum type, void *data);
|
||||
__attribute__((import_module("imports"), import_name("glFramebufferRenderbuffer"))) void
|
||||
glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
__attribute__((import_module("imports"), import_name("glGenerateMipmap"))) void glGenerateMipmap(GLenum target);
|
||||
__attribute__((import_module("imports"), import_name("glDeleteShader"))) void glDeleteShader(GLuint shader);
|
||||
__attribute__((import_module("imports"), import_name("glPixelStorei"))) void glPixelStorei(GLenum pname, GLint param);
|
||||
__attribute__((import_module("imports"), import_name("glCompressedTexImage2D"))) void
|
||||
glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
|
||||
__attribute__((import_module("imports"), import_name("glTexSubImage2D"))) void
|
||||
glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
|
||||
__attribute__((import_module("imports"), import_name("glBufferSubData"))) void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size,
|
||||
const void *data);
|
||||
__attribute__((import_module("imports"), import_name("glEnableVertexAttribArray"))) void glEnableVertexAttribArray(GLuint index);
|
||||
__attribute__((import_module("imports"), import_name("glDisableVertexAttribArray"))) void glDisableVertexAttribArray(GLuint index);
|
||||
__attribute__((import_module("imports"), import_name("glVertexAttribPointer"))) void
|
||||
glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
|
||||
__attribute__((import_module("imports"), import_name("glBlendColor"))) void glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
__attribute__((import_module("imports"), import_name("glDrawBuffers"))) void glDrawBuffers(GLsizei n, const GLenum *bufs);
|
||||
__attribute__((import_module("imports"), import_name("glDrawElementsInstanced"))) void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
|
||||
const void *indices, GLsizei instancecount);
|
||||
__attribute__((import_module("imports"), import_name("glVertexAttribDivisor"))) void glVertexAttribDivisor(GLuint index, GLuint divisor);
|
13
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/atomic.h
Normal file
13
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/atomic.h
Normal 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)
|
18
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/audio.c.h
Normal file
18
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/audio.c.h
Normal file
@ -0,0 +1,18 @@
|
||||
#include <kinc/audio2/audio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static kinc_a2_buffer_t a2_buffer;
|
||||
|
||||
void kinc_a2_init() {
|
||||
kinc_a2_internal_init();
|
||||
}
|
||||
|
||||
void kinc_a2_update() {}
|
||||
|
||||
void kinc_a2_shutdown() {}
|
||||
|
||||
static uint32_t samples_per_second = 44100;
|
||||
|
||||
uint32_t kinc_a2_samples_per_second(void) {
|
||||
return samples_per_second;
|
||||
}
|
@ -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;
|
||||
}
|
15
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/event.c.h
Normal file
15
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/event.c.h
Normal 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) {}
|
13
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/event.h
Normal file
13
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/event.h
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int nothing;
|
||||
} kinc_event_impl_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -0,0 +1,11 @@
|
||||
#include "audio.c.h"
|
||||
#include "display.c.h"
|
||||
#include "event.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"
|
17
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/mouse.c.h
Normal file
17
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/mouse.c.h
Normal 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) {}
|
23
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/mutex.c.h
Normal file
23
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/mutex.c.h
Normal 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) {}
|
17
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/mutex.h
Normal file
17
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/mutex.h
Normal 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
|
@ -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;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int nothing;
|
||||
} kinc_semaphore_impl_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
108
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/system.c.h
Normal file
108
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/system.c.h
Normal file
@ -0,0 +1,108 @@
|
||||
#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>
|
||||
|
||||
__attribute__((import_module("imports"), import_name("js_time"))) int js_time();
|
||||
|
||||
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;
|
||||
|
||||
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) {
|
||||
return (kinc_ticks_t)(js_time());
|
||||
}
|
||||
|
||||
double kinc_time(void) {
|
||||
return js_time() / 1000.0;
|
||||
}
|
||||
|
||||
int kinc_cpu_cores(void) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
int kinc_hardware_threads(void) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
void kinc_internal_shutdown(void) {}
|
||||
|
||||
extern int kickstart(int argc, char **argv);
|
||||
|
||||
__attribute__((export_name("_start"))) void _start(void) {
|
||||
kickstart(0, NULL);
|
||||
}
|
||||
|
||||
__attribute__((export_name("_update"))) void _update(void) {
|
||||
kinc_internal_update_callback();
|
||||
kinc_a2_update();
|
||||
}
|
||||
|
||||
__attribute__((export_name("_mousedown"))) void _mousedown(int button, int x, int y) {
|
||||
kinc_internal_mouse_trigger_press(0, button, x, y);
|
||||
}
|
||||
|
||||
__attribute__((export_name("_mouseup"))) void _mouseup(int button, int x, int y) {
|
||||
kinc_internal_mouse_trigger_release(0, button, x, y);
|
||||
}
|
||||
|
||||
__attribute__((export_name("_mousemove"))) void _mousemove(int x, int y) {
|
||||
kinc_internal_mouse_trigger_move(0, x, y);
|
||||
}
|
||||
|
||||
__attribute__((export_name("_wheel"))) void _wheel(int delta) {
|
||||
kinc_internal_mouse_trigger_scroll(0, delta);
|
||||
}
|
||||
|
||||
__attribute__((export_name("_keydown"))) void _keydown(int key) {
|
||||
kinc_internal_keyboard_trigger_key_down(key);
|
||||
}
|
||||
|
||||
__attribute__((export_name("_keyup"))) void _keyup(int key) {
|
||||
kinc_internal_keyboard_trigger_key_up(key);
|
||||
}
|
@ -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) {}
|
13
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/thread.h
Normal file
13
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/thread.h
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int nothing;
|
||||
} kinc_thread_impl_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -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) {}
|
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int nothing;
|
||||
} kinc_thread_local_impl_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
57
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/video.c.h
Normal file
57
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/video.c.h
Normal 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) {}
|
||||
|
||||
static 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;
|
||||
}
|
27
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/video.h
Normal file
27
Kha/Kinc/Backends/System/Wasm/Sources/kinc/backend/video.h
Normal 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
|
@ -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;
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
namespace Kore {
|
||||
struct WindowData {
|
||||
int width, height, mode;
|
||||
WindowData();
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user