aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/old/vlib/sokol
diff options
context:
space:
mode:
authorIndrajith K L2022-12-03 17:00:20 +0530
committerIndrajith K L2022-12-03 17:00:20 +0530
commitf5c4671bfbad96bf346bd7e9a21fc4317b4959df (patch)
tree2764fc62da58f2ba8da7ed341643fc359873142f /v_windows/v/old/vlib/sokol
downloadcli-tools-windows-master.tar.gz
cli-tools-windows-master.tar.bz2
cli-tools-windows-master.zip
Adds most of the toolsHEADmaster
Diffstat (limited to 'v_windows/v/old/vlib/sokol')
-rw-r--r--v_windows/v/old/vlib/sokol/audio/audio.v134
-rw-r--r--v_windows/v/old/vlib/sokol/c/declaration.c.v58
-rw-r--r--v_windows/v/old/vlib/sokol/f/f.v15
-rw-r--r--v_windows/v/old/vlib/sokol/gfx/enums.v297
-rw-r--r--v_windows/v/old/vlib/sokol/gfx/gfx.v266
-rw-r--r--v_windows/v/old/vlib/sokol/gfx/gfx_funcs.v71
-rw-r--r--v_windows/v/old/vlib/sokol/gfx/gfx_structs.v535
-rw-r--r--v_windows/v/old/vlib/sokol/gfx/gfx_utils.v17
-rw-r--r--v_windows/v/old/vlib/sokol/sapp/enums.v165
-rw-r--r--v_windows/v/old/vlib/sokol/sapp/sapp.v237
-rw-r--r--v_windows/v/old/vlib/sokol/sapp/sapp_funcs.v105
-rw-r--r--v_windows/v/old/vlib/sokol/sapp/sapp_structs.v104
-rw-r--r--v_windows/v/old/vlib/sokol/sfons/sfons.v28
-rw-r--r--v_windows/v/old/vlib/sokol/sfons/sfons_funcs.v6
-rw-r--r--v_windows/v/old/vlib/sokol/sgl/sgl.v375
-rw-r--r--v_windows/v/old/vlib/sokol/sgl/sgl_funcs.v91
-rw-r--r--v_windows/v/old/vlib/sokol/sgl/sgl_structs.v24
-rw-r--r--v_windows/v/old/vlib/sokol/sokol.v19
18 files changed, 2547 insertions, 0 deletions
diff --git a/v_windows/v/old/vlib/sokol/audio/audio.v b/v_windows/v/old/vlib/sokol/audio/audio.v
new file mode 100644
index 0000000..50acb7f
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/audio/audio.v
@@ -0,0 +1,134 @@
+module audio
+
+$if linux {
+ // provide a nicer error for the user that does not have ALSA installed
+ #include <alsa/asoundlib.h> # Please install the `libasound2-dev` package
+}
+
+#flag -I @VEXEROOT/thirdparty/sokol
+#define SOKOL_IMPL
+#include "sokol_audio.h"
+#flag linux -lasound
+#flag darwin -framework AudioToolbox
+#flag windows -lole32
+
+//
+pub type FNStreamingCB = fn (buffer &f32, num_frames int, num_channels int)
+
+pub type FnStreamingCBWithUserData = fn (buffer &f32, num_frames int, num_channels int, user_data voidptr)
+
+pub fn (x FNStreamingCB) str() string {
+ return '&FNStreamingCB{ ${ptr_str(x)} }'
+}
+
+pub fn (x FnStreamingCBWithUserData) str() string {
+ return '&FnStreamingCBWithUserData{ ${ptr_str(x)} }'
+}
+
+//
+pub struct C.saudio_desc {
+ sample_rate int
+ num_channels int
+ buffer_frames int
+ packet_frames int
+ num_packets int
+ stream_cb FNStreamingCB
+ stream_userdata_cb FnStreamingCBWithUserData
+ user_data voidptr
+}
+
+fn C.saudio_setup(desc &C.saudio_desc)
+
+fn C.saudio_shutdown()
+
+fn C.saudio_isvalid() bool
+
+fn C.saudio_userdata() voidptr
+
+fn C.saudio_query_desc() C.saudio_desc
+
+fn C.saudio_sample_rate() int
+
+fn C.saudio_buffer_frames() int
+
+fn C.saudio_channels() int
+
+fn C.saudio_expect() int
+
+fn C.saudio_push(frames &f32, num_frames int) int
+
+// audio.setup - setup sokol-audio
+pub fn setup(desc C.saudio_desc) {
+ C.saudio_setup(&desc)
+}
+
+// audio.shutdown - shutdown sokol-audio
+pub fn shutdown() {
+ C.saudio_shutdown()
+}
+
+// audio.is_valid - true after setup if audio backend was successfully initialized
+pub fn is_valid() bool {
+ return C.saudio_isvalid()
+}
+
+// audio.userdata - return the saudio_desc.user_data pointer
+pub fn user_data() voidptr {
+ return C.saudio_userdata()
+}
+
+// audio.query - return a copy of the original saudio_desc struct
+pub fn query() C.saudio_desc {
+ return C.saudio_query_desc()
+}
+
+// audio.sample_rate - actual sample rate
+pub fn sample_rate() int {
+ return C.saudio_sample_rate()
+}
+
+// audio.buffer_frames - return actual backend buffer size in number of frames
+pub fn buffer_frames() int {
+ return C.saudio_buffer_frames()
+}
+
+// audio.channels - actual number of channels
+pub fn channels() int {
+ return C.saudio_channels()
+}
+
+// audio.expect - get current number of frames to fill packet queue; use in combination with audio.push/2
+pub fn expect() int {
+ return C.saudio_expect()
+}
+
+// audio.push - push sample frames from main thread, returns number of frames actually pushed
+pub fn push(frames &f32, num_frames int) int {
+ return C.saudio_push(frames, num_frames)
+}
+
+//
+[inline]
+pub fn fclamp(x f32, flo f32, fhi f32) f32 {
+ if x > fhi {
+ return fhi
+ }
+ if x < flo {
+ return flo
+ }
+ return x
+}
+
+pub fn min(x int, y int) int {
+ if x < y {
+ return x
+ }
+ return y
+}
+
+pub fn max(x int, y int) int {
+ if x < y {
+ return y
+ }
+ return x
+}
diff --git a/v_windows/v/old/vlib/sokol/c/declaration.c.v b/v_windows/v/old/vlib/sokol/c/declaration.c.v
new file mode 100644
index 0000000..c2e435a
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/c/declaration.c.v
@@ -0,0 +1,58 @@
+module c
+
+pub const (
+ used_import = 1
+)
+
+#flag -I @VEXEROOT/thirdparty/sokol
+#flag -I @VEXEROOT/thirdparty/sokol/util
+#flag freebsd -I /usr/local/include
+#flag darwin -fobjc-arc
+#flag linux -lX11 -lGL -lXcursor -lXi -lpthread
+#flag freebsd -L/usr/local/lib -lX11 -lGL -lXcursor -lXi
+#flag windows -lgdi32
+// METAL
+$if macos {
+ #flag -DSOKOL_METAL
+ #flag -framework Metal -framework Cocoa -framework MetalKit -framework QuartzCore
+}
+$if ios {
+ #flag -DSOKOL_METAL
+ #flag -framework Foundation -framework Metal -framework MetalKit -framework UIKit
+}
+// OPENGL
+#flag linux -DSOKOL_GLCORE33
+#flag freebsd -DSOKOL_GLCORE33
+//#flag darwin -framework OpenGL -framework Cocoa -framework QuartzCore
+// D3D
+#flag windows -DSOKOL_GLCORE33
+//#flag windows -DSOKOL_D3D11
+// for simplicity, all header includes are here because import order matters and we dont have any way
+// to ensure import order with V yet
+#define SOKOL_IMPL
+// TODO should not be defined for android graphic (apk/aab using sokol) builds, but we have no ways to undefine
+//#define SOKOL_NO_ENTRY
+#flag linux -DSOKOL_NO_ENTRY
+#flag darwin -DSOKOL_NO_ENTRY
+#flag windows -DSOKOL_NO_ENTRY
+#flag windows -DSOKOL_WIN32_FORCE_MAIN
+#flag freebsd -DSOKOL_NO_ENTRY
+#flag solaris -DSOKOL_NO_ENTRY
+// TODO end
+
+#flag linux -ldl
+
+$if gcboehm ? {
+ #define SOKOL_MALLOC GC_MALLOC
+ #define SOKOL_CALLOC(n,m) GC_MALLOC((n)*(m))
+ #define SOKOL_REALLOC GC_REALLOC
+ #define SOKOL_FREE GC_FREE
+}
+
+#include "sokol_v.h"
+#include "sokol_app.h"
+#define SOKOL_IMPL
+#define SOKOL_NO_DEPRECATED
+#include "sokol_gfx.h"
+#define SOKOL_GL_IMPL
+#include "util/sokol_gl.h"
diff --git a/v_windows/v/old/vlib/sokol/f/f.v b/v_windows/v/old/vlib/sokol/f/f.v
new file mode 100644
index 0000000..5c5e714
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/f/f.v
@@ -0,0 +1,15 @@
+module f
+
+import fontstash
+import sokol.c
+
+pub const (
+ used_import = fontstash.used_import + c.used_import
+)
+
+#flag linux -I.
+
+//#include "ft2build.h"
+
+#define SOKOL_FONTSTASH_IMPL
+#include "util/sokol_fontstash.h"
diff --git a/v_windows/v/old/vlib/sokol/gfx/enums.v b/v_windows/v/old/vlib/sokol/gfx/enums.v
new file mode 100644
index 0000000..fbe336e
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/gfx/enums.v
@@ -0,0 +1,297 @@
+module gfx
+
+pub enum Backend {
+ glcore33
+ gles2
+ gles3
+ d3d11
+ metal_ios
+ metal_macos
+ metal_simulator
+ dummy
+}
+
+pub enum PixelFormat {
+ _default // value 0 reserved for default-init
+ @none
+ r8
+ r8sn
+ r8ui
+ r8si
+ r16
+ r16sn
+ r16ui
+ r16si
+ r16f
+ rg8
+ rg8sn
+ rg8ui
+ rg8si
+ r32ui
+ r32si
+ r32f
+ rg16
+ rg16sn
+ rg16ui
+ rg16si
+ rg16f
+ rgba8
+ rgba8sn
+ rgba8ui
+ rgba8si
+ bgra8
+ rgb10a2
+ rg11b10f
+ rg32ui
+ rg32si
+ rg32f
+ rgba16
+ rgba16sn
+ rgba16ui
+ rgba16si
+ rgba16f
+ rgba32ui
+ rgba32si
+ rgba32f
+ depth
+ depth_stencil
+ bc1_rgba
+ bc2_rgba
+ bc3_rgba
+ bc4_r
+ bc4_rsn
+ bc5_rg
+ bc5_rgsn
+ bc6h_rgbf
+ bc6h_rgbuf
+ bc7_rgba
+ pvrtc_rgb_2bpp
+ pvrtc_rgb_4bpp
+ pvrtc_rgba_2bpp
+ pvrtc_rgba_4bpp
+ etc2_rgb8
+ etc2_rgb8a1
+ etc2_rgba8
+ etc2_rg11
+ etc2_rg11sn
+ _num
+}
+
+pub enum ResourceState {
+ initial
+ alloc
+ valid
+ failed
+ invalid
+}
+
+pub enum Usage {
+ _default // value 0 reserved for default-init
+ immutable
+ dynamic
+ stream
+ _num
+}
+
+pub enum BufferType {
+ _default // value 0 reserved for default-init
+ vertexbuffer
+ indexbuffer
+ _num
+}
+
+pub enum IndexType {
+ _default // value 0 reserved for default-init
+ @none
+ uint16
+ uint32
+ _num
+}
+
+pub enum ImageType {
+ _default // value 0 reserved for default-init
+ _2d
+ cube
+ _3d
+ array
+ _num
+}
+
+pub enum CubeFace {
+ pos_x
+ neg_x
+ pos_y
+ neg_y
+ pos_z
+ neg_z
+ num
+ _force_u32 = 0x7fffffff
+}
+
+pub enum ShaderStage {
+ vs
+ fs
+}
+
+pub enum PrimitiveType {
+ _default // value 0 reserved for default-init
+ points
+ lines
+ line_strip
+ triangles
+ triangle_strip
+ _num
+}
+
+pub enum Filter {
+ _default // value 0 reserved for default-init
+ nearest
+ linear
+ nearest_mipmap_nearest
+ nearest_mipmap_linear
+ linear_mipmap_nearest
+ linear_mipmap_linear
+ _num
+}
+
+pub enum Wrap {
+ _default // value 0 reserved for default-init
+ repeat
+ clamp_to_edge
+ clamp_to_border
+ mirrored_repeat
+ _num
+}
+
+pub enum BorderColor {
+ _default // value 0 reserved for default-init
+ transparent_black
+ opaque_black
+ opaque_white
+ _num
+}
+
+pub enum VertexFormat {
+ invalid
+ float
+ float2
+ float3
+ float4
+ byte4
+ byte4n
+ ubyte4
+ ubyte4n
+ short2
+ short2n
+ ushort2n
+ short4
+ short4n
+ ushort4n
+ uint10_n2
+ _num
+}
+
+pub enum VertexStep {
+ _default // value 0 reserved for default-init
+ per_vertex
+ per_instance
+ _num
+}
+
+pub enum UniformType {
+ invalid
+ float
+ float2
+ float3
+ float4
+ mat4
+ _num
+}
+
+pub enum CullMode {
+ _default // value 0 reserved for default-init
+ @none
+ front
+ back
+ _num
+}
+
+pub enum FaceWinding {
+ _facewinding_default // value 0 reserved for default-init
+ facewinding_ccw
+ facewinding_cw
+ _facewinding_num
+}
+
+pub enum CompareFunc {
+ _default // value 0 reserved for default-init
+ never
+ less
+ equal
+ less_equal
+ greater
+ not_equal
+ greater_equal
+ always
+ _num
+}
+
+pub enum StencilOp {
+ _default // value 0 reserved for default-init
+ keep
+ zero
+ replace
+ incr_clamp
+ decr_clamp
+ invert
+ incr_wrap
+ decr_wrap
+ _num
+}
+
+pub enum BlendFactor {
+ _default // value 0 reserved for default-init
+ zero
+ one
+ src_color
+ one_minus_src_color
+ src_alpha
+ one_minus_src_alpha
+ dst_color
+ one_minus_dst_color
+ dst_alpha
+ one_minus_dst_alpha
+ src_alpha_saturated
+ blend_color
+ one_minus_blend_color
+ blend_alpha
+ one_minus_blend_alpha
+ _num
+}
+
+pub enum BlendOp {
+ _default // value 0 reserved for default-init
+ add
+ subtract
+ reverse_subtract
+ _num
+}
+
+pub enum ColorMask {
+ _default = 0 // value 0 reserved for default-init
+ @none = 0x10 // special value for 'all channels disabled
+ r = 1
+ g = 2
+ b = 4
+ a = 8
+ rgb = 0x7
+ rgba = 0xF
+}
+
+pub enum Action {
+ _default
+ clear
+ load
+ dontcare
+ _num
+}
diff --git a/v_windows/v/old/vlib/sokol/gfx/gfx.v b/v_windows/v/old/vlib/sokol/gfx/gfx.v
new file mode 100644
index 0000000..9480173
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/gfx/gfx.v
@@ -0,0 +1,266 @@
+module gfx
+
+import sokol.c
+
+pub const (
+ version = 1
+ used_import = c.used_import
+)
+
+// setup and misc functions
+[inline]
+pub fn setup(desc &C.sg_desc) {
+ C.sg_setup(desc)
+}
+
+[inline]
+pub fn shutdown() {
+ C.sg_shutdown()
+}
+
+[inline]
+pub fn reset_state_cache() {
+ C.sg_reset_state_cache()
+}
+
+// resource creation, destruction and updating
+[inline]
+pub fn make_buffer(desc &C.sg_buffer_desc) C.sg_buffer {
+ return C.sg_make_buffer(desc)
+}
+
+[inline]
+pub fn make_image(desc &C.sg_image_desc) C.sg_image {
+ return C.sg_make_image(desc)
+}
+
+[inline]
+pub fn make_shader(desc &C.sg_shader_desc) C.sg_shader {
+ return C.sg_make_shader(desc)
+}
+
+[inline]
+pub fn make_pipeline(desc &C.sg_pipeline_desc) C.sg_pipeline {
+ return C.sg_make_pipeline(desc)
+}
+
+[inline]
+pub fn make_pass(desc &C.sg_pass_desc) C.sg_pass {
+ return C.sg_make_pass(desc)
+}
+
+[inline]
+pub fn destroy_buffer(buf C.sg_buffer) {
+ C.sg_destroy_buffer(buf)
+}
+
+[inline]
+pub fn destroy_image(img C.sg_image) {
+ C.sg_destroy_image(img)
+}
+
+[inline]
+pub fn destroy_shader(shd C.sg_shader) {
+ C.sg_destroy_shader(shd)
+}
+
+[inline]
+pub fn destroy_pipeline(pip C.sg_pipeline) {
+ C.sg_destroy_pipeline(pip)
+}
+
+[inline]
+pub fn destroy_pass(pass C.sg_pass) {
+ C.sg_destroy_pass(pass)
+}
+
+[inline]
+pub fn update_buffer(buf C.sg_buffer, data &C.sg_range) {
+ C.sg_update_buffer(buf, data)
+}
+
+[inline]
+pub fn update_image(img C.sg_image, data &C.sg_image_data) {
+ C.sg_update_image(img, data)
+}
+
+[inline]
+pub fn append_buffer(buf C.sg_buffer, data &C.sg_range) int {
+ return C.sg_append_buffer(buf, data)
+}
+
+[inline]
+pub fn query_buffer_overflow(buf C.sg_buffer) bool {
+ return C.sg_query_buffer_overflow(buf)
+}
+
+// rendering functions
+[inline]
+pub fn begin_default_pass(actions &C.sg_pass_action, width int, height int) {
+ C.sg_begin_default_pass(actions, width, height)
+}
+
+[inline]
+pub fn begin_pass(pass C.sg_pass, actions &C.sg_pass_action) {
+ C.sg_begin_pass(pass, actions)
+}
+
+[inline]
+pub fn apply_viewport(x int, y int, width int, height int, origin_top_left bool) {
+ C.sg_apply_viewport(x, y, width, height, origin_top_left)
+}
+
+[inline]
+pub fn apply_scissor_rect(x int, y int, width int, height int, origin_top_left bool) {
+ C.sg_apply_scissor_rect(x, y, width, height, origin_top_left)
+}
+
+[inline]
+pub fn apply_pipeline(pip C.sg_pipeline) {
+ C.sg_apply_pipeline(pip)
+}
+
+[inline]
+pub fn apply_bindings(bindings &C.sg_bindings) {
+ C.sg_apply_bindings(bindings)
+}
+
+[inline]
+pub fn apply_uniforms(stage int, ub_index int, data &C.sg_range) {
+ C.sg_apply_uniforms(stage, ub_index, data)
+}
+
+[inline]
+pub fn draw(base_element int, num_elements int, num_instances int) {
+ C.sg_draw(base_element, num_elements, num_instances)
+}
+
+[inline]
+pub fn end_pass() {
+ C.sg_end_pass()
+}
+
+[inline]
+pub fn commit() {
+ C.sg_commit()
+}
+
+// getting information
+[inline]
+pub fn query_desc() C.sg_desc {
+ return C.sg_query_desc()
+}
+
+[inline]
+pub fn query_backend() Backend {
+ return Backend(C.sg_query_backend())
+}
+
+[inline]
+pub fn query_features() C.sg_features {
+ return C.sg_query_features()
+}
+
+[inline]
+pub fn query_limits() C.sg_limits {
+ return C.sg_query_limits()
+}
+
+[inline]
+pub fn query_pixelformat(fmt PixelFormat) C.sg_pixelformat_info {
+ return C.sg_query_pixelformat(fmt)
+}
+
+// get current state of a resource (INITIAL, ALLOC, VALID, FAILED, INVALID)
+[inline]
+pub fn query_buffer_state(buf C.sg_buffer) C.sg_resource_state {
+ return C.sg_query_buffer_state(buf)
+}
+
+[inline]
+pub fn query_image_state(img C.sg_image) C.sg_resource_state {
+ return C.sg_query_image_state(img)
+}
+
+[inline]
+pub fn query_shader_state(shd C.sg_shader) C.sg_resource_state {
+ return C.sg_query_shader_state(shd)
+}
+
+[inline]
+pub fn query_pipeline_state(pip C.sg_pipeline) C.sg_resource_state {
+ return C.sg_query_pipeline_state(pip)
+}
+
+[inline]
+pub fn query_pass_state(pass C.sg_pass) C.sg_resource_state {
+ return C.sg_query_pass_state(pass)
+}
+
+// get runtime information about a resource
+[inline]
+pub fn query_buffer_info(buf C.sg_buffer) C.sg_buffer_info {
+ return C.sg_query_buffer_info(buf)
+}
+
+[inline]
+pub fn query_image_info(img C.sg_image) C.sg_image_info {
+ return C.sg_query_image_info(img)
+}
+
+[inline]
+pub fn query_shader_info(shd C.sg_shader) C.sg_shader_info {
+ return C.sg_query_shader_info(shd)
+}
+
+[inline]
+pub fn query_pipeline_info(pip C.sg_pipeline) C.sg_pipeline_info {
+ return C.sg_query_pipeline_info(pip)
+}
+
+[inline]
+pub fn query_pass_info(pass C.sg_pass) C.sg_pass_info {
+ return C.sg_query_pass_info(pass)
+}
+
+// get resource creation desc struct with their default values replaced
+[inline]
+pub fn query_buffer_defaults(desc &C.sg_buffer) C.sg_buffer_desc {
+ return C.sg_query_buffer_defaults(unsafe { &C.sg_buffer_desc(desc) })
+}
+
+[inline]
+pub fn query_image_defaults(desc &C.sg_image) C.sg_image_desc {
+ return C.sg_query_image_defaults(unsafe { &C.sg_image_desc(desc) })
+}
+
+[inline]
+pub fn query_shader_defaults(desc &C.sg_shader) C.sg_shader_desc {
+ return C.sg_query_shader_defaults(unsafe { &C.sg_shader_desc(desc) })
+}
+
+[inline]
+pub fn query_pipeline_defaults(desc &C.sg_pipeline) C.sg_pipeline_desc {
+ return C.sg_query_pipeline_defaults(unsafe { &C.sg_pipeline_desc(desc) })
+}
+
+[inline]
+pub fn query_pass_defaults(desc &C.sg_pass) C.sg_pass_desc {
+ return C.sg_query_pass_defaults(unsafe { &C.sg_pass_desc(desc) })
+}
+
+// rendering contexts (optional)
+[inline]
+pub fn setup_context() C.sg_context {
+ return C.sg_setup_context()
+}
+
+[inline]
+pub fn activate_context(ctx_id C.sg_context) {
+ C.sg_activate_context(ctx_id)
+}
+
+[inline]
+pub fn discard_context(ctx_id C.sg_context) {
+ C.sg_discard_context(ctx_id)
+}
diff --git a/v_windows/v/old/vlib/sokol/gfx/gfx_funcs.v b/v_windows/v/old/vlib/sokol/gfx/gfx_funcs.v
new file mode 100644
index 0000000..eb4e99b
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/gfx/gfx_funcs.v
@@ -0,0 +1,71 @@
+module gfx
+
+// setup and misc functions
+fn C.sg_setup(desc &C.sg_desc)
+fn C.sg_shutdown()
+fn C.sg_reset_state_cache()
+
+// resource creation, destruction and updating
+fn C.sg_make_buffer(desc &C.sg_buffer_desc) C.sg_buffer
+fn C.sg_make_image(desc &C.sg_image_desc) C.sg_image
+fn C.sg_make_shader(desc &C.sg_shader_desc) C.sg_shader
+fn C.sg_make_pipeline(desc &C.sg_pipeline_desc) C.sg_pipeline
+fn C.sg_make_pass(desc &C.sg_pass_desc) C.sg_pass
+fn C.sg_destroy_buffer(buf C.sg_buffer)
+fn C.sg_destroy_image(img C.sg_image)
+fn C.sg_destroy_shader(shd C.sg_shader)
+fn C.sg_destroy_pipeline(pip C.sg_pipeline)
+fn C.sg_destroy_pass(pass C.sg_pass)
+fn C.sg_update_buffer(buf C.sg_buffer, data &C.sg_range)
+fn C.sg_update_image(img C.sg_image, data &C.sg_image_data)
+fn C.sg_append_buffer(buf C.sg_buffer, data &C.sg_range) int
+fn C.sg_query_buffer_overflow(buf C.sg_buffer) bool
+
+// rendering functions
+fn C.sg_begin_default_pass(actions &C.sg_pass_action, width int, height int)
+fn C.sg_begin_pass(pass C.sg_pass, actions &C.sg_pass_action)
+fn C.sg_apply_viewport(x int, y int, width int, height int, origin_top_left bool)
+fn C.sg_apply_viewportf(x f32, y f32, width f32, height f32, origin_top_left bool)
+fn C.sg_apply_scissor_rect(x int, y int, width int, height int, origin_top_left bool)
+fn C.sg_apply_scissor_rectf(x f32, y f32, width f32, height f32, origin_top_left bool)
+fn C.sg_apply_pipeline(pip C.sg_pipeline)
+fn C.sg_apply_bindings(bindings &C.sg_bindings)
+
+// stage == sg_shader_stage
+fn C.sg_apply_uniforms(stage int, ub_index int, data &C.sg_range)
+fn C.sg_draw(base_element int, num_elements int, num_instances int)
+fn C.sg_end_pass()
+fn C.sg_commit()
+
+// getting information
+fn C.sg_query_desc() C.sg_desc
+fn C.sg_query_backend() Backend
+fn C.sg_query_features() C.sg_features
+fn C.sg_query_limits() C.sg_limits
+fn C.sg_query_pixelformat(fmt PixelFormat) C.sg_pixelformat_info
+
+// get current state of a resource (INITIAL, ALLOC, VALID, FAILED, INVALID)
+fn C.sg_query_buffer_state(buf C.sg_buffer) C.sg_resource_state
+fn C.sg_query_image_state(img C.sg_image) C.sg_resource_state
+fn C.sg_query_shader_state(shd C.sg_shader) C.sg_resource_state
+fn C.sg_query_pipeline_state(pip C.sg_pipeline) C.sg_resource_state
+fn C.sg_query_pass_state(pass C.sg_pass) C.sg_resource_state
+
+// get runtime information about a resource
+fn C.sg_query_buffer_info(buf C.sg_buffer) C.sg_buffer_info
+fn C.sg_query_image_info(img C.sg_image) C.sg_image_info
+fn C.sg_query_shader_info(shd C.sg_shader) C.sg_shader_info
+fn C.sg_query_pipeline_info(pip C.sg_pipeline) C.sg_pipeline_info
+fn C.sg_query_pass_info(pass C.sg_pass) C.sg_pass_info
+
+// get resource creation desc struct with their default values replaced
+fn C.sg_query_buffer_defaults(desc &C.sg_buffer_desc) C.sg_buffer_desc
+fn C.sg_query_image_defaults(desc &C.sg_image_desc) C.sg_image_desc
+fn C.sg_query_shader_defaults(desc &C.sg_shader_desc) C.sg_shader_desc
+fn C.sg_query_pipeline_defaults(desc &C.sg_pipeline_desc) C.sg_pipeline_desc
+fn C.sg_query_pass_defaults(desc &C.sg_pass_desc) C.sg_pass_desc
+
+// rendering contexts (optional)
+fn C.sg_setup_context() C.sg_context
+fn C.sg_activate_context(ctx_id C.sg_context)
+fn C.sg_discard_context(ctx_id C.sg_context)
diff --git a/v_windows/v/old/vlib/sokol/gfx/gfx_structs.v b/v_windows/v/old/vlib/sokol/gfx/gfx_structs.v
new file mode 100644
index 0000000..1bf6c3a
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/gfx/gfx_structs.v
@@ -0,0 +1,535 @@
+module gfx
+
+pub struct C.sg_desc {
+ _start_canary u32
+ buffer_pool_size int
+ image_pool_size int
+ shader_pool_size int
+ pipeline_pool_size int
+ pass_pool_size int
+ context_pool_size int
+ context C.sg_context_desc
+ /*
+ // GL specific
+ gl_force_gles2 bool
+ // Metal-specific
+ mtl_device voidptr
+ mtl_renderpass_descriptor_cb fn() voidptr
+ mtl_drawable_cb fn() voidptr
+ mtl_global_uniform_buffer_size int
+ mtl_sampler_cache_size int
+ // D3D11-specific
+ d3d11_device voidptr
+ d3d11_device_context voidptr
+ d3d11_render_target_view_cb fn() voidptr
+ d3d11_depth_stencil_view_cb fn() voidptr
+ */
+ _end_canary u32
+}
+
+pub struct C.sg_context_desc {
+ /*
+ sg_pixel_format color_format;
+ sg_pixel_format depth_format;
+ int sample_count;
+ sg_wgpu_context_desc wgpu;
+ */
+ sample_count int
+ gl C.sg_gl_context_desc
+ metal C.sg_metal_context_desc
+ d3d11 C.sg_d3d11_context_desc
+ color_format PixelFormat
+ depth_format PixelFormat
+}
+
+pub struct C.sg_gl_context_desc {
+ force_gles2 bool
+}
+
+pub struct C.sg_metal_context_desc {
+ device voidptr
+ renderpass_descriptor_cb fn () voidptr
+ drawable_cb fn () voidptr
+}
+
+pub struct C.sg_d3d11_context_desc {
+ device voidptr
+ device_context voidptr
+ render_target_view_cb fn () voidptr
+ depth_stencil_view_cb fn () voidptr
+}
+
+pub struct C.sg_color_state {
+pub mut:
+ pixel_format PixelFormat
+ write_mask ColorMask
+ blend C.sg_blend_state
+}
+
+pub struct C.sg_pipeline_desc {
+pub mut:
+ _start_canary u32
+ shader C.sg_shader
+ layout C.sg_layout_desc
+ depth C.sg_depth_state
+ stencil C.sg_stencil_state
+ color_count int
+ colors [4]C.sg_color_state // C.SG_MAX_COLOR_ATTACHMENTS
+ primitive_type PrimitiveType
+ index_type IndexType
+ cull_mode CullMode
+ face_winding FaceWinding
+ sample_count int
+ blend_color C.sg_color
+ alpha_to_coverage_enabled bool
+ label &char = &char(0)
+ _end_canary u32
+}
+
+pub struct C.sg_pipeline_info {
+}
+
+pub struct C.sg_pipeline {
+pub:
+ id u32
+}
+
+pub fn (p C.sg_pipeline) free() {
+ C.sg_destroy_pipeline(p)
+}
+
+pub struct C.sg_bindings {
+pub mut:
+ _start_canary u32
+ vertex_buffers [8]C.sg_buffer
+ vertex_buffer_offsets [8]int
+ index_buffer C.sg_buffer
+ index_buffer_offset int
+ vs_images [8]C.sg_image
+ fs_images [8]C.sg_image
+ _end_canary u32
+}
+
+pub fn (mut b C.sg_bindings) set_vert_image(index int, img C.sg_image) {
+ b.vs_images[index] = img
+}
+
+pub fn (mut b C.sg_bindings) set_frag_image(index int, img C.sg_image) {
+ b.fs_images[index] = img
+}
+
+pub fn (b &C.sg_bindings) update_vert_buffer(index int, data voidptr, element_size int, element_count int) {
+ range := C.sg_range{
+ ptr: data
+ size: size_t(element_size * element_count)
+ }
+ C.sg_update_buffer(b.vertex_buffers[index], &range)
+}
+
+pub fn (b &C.sg_bindings) append_vert_buffer(index int, data voidptr, element_size int, element_count int) int {
+ range := C.sg_range{
+ ptr: data
+ size: size_t(element_size * element_count)
+ }
+ return C.sg_append_buffer(b.vertex_buffers[index], &range)
+}
+
+pub fn (b &C.sg_bindings) update_index_buffer(data voidptr, element_size int, element_count int) {
+ range := C.sg_range{
+ ptr: data
+ size: size_t(element_size * element_count)
+ }
+ C.sg_update_buffer(b.index_buffer, &range)
+}
+
+pub fn (b &C.sg_bindings) append_index_buffer(data voidptr, element_size int, element_count int) int {
+ range := C.sg_range{
+ ptr: data
+ size: size_t(element_size * element_count)
+ }
+ return C.sg_append_buffer(b.index_buffer, &range)
+}
+
+[heap]
+pub struct C.sg_shader_desc {
+pub mut:
+ _start_canary u32
+ attrs [16]C.sg_shader_attr_desc
+ vs C.sg_shader_stage_desc
+ fs C.sg_shader_stage_desc
+ label &char
+ _end_canary u32
+}
+
+pub fn (mut desc C.sg_shader_desc) set_vert_src(src string) &C.sg_shader_desc {
+ desc.vs.source = &char(src.str)
+ return desc
+}
+
+pub fn (mut desc C.sg_shader_desc) set_frag_src(src string) &C.sg_shader_desc {
+ desc.fs.source = &char(src.str)
+ return desc
+}
+
+pub fn (mut desc C.sg_shader_desc) set_vert_image(index int, name string) &C.sg_shader_desc {
+ desc.vs.images[index].name = &char(name.str)
+ desc.vs.images[index].image_type = ._2d
+ return desc
+}
+
+pub fn (mut desc C.sg_shader_desc) set_frag_image(index int, name string) &C.sg_shader_desc {
+ desc.fs.images[index].name = &char(name.str)
+ desc.fs.images[index].image_type = ._2d
+ return desc
+}
+
+pub fn (mut desc C.sg_shader_desc) set_vert_uniform_block_size(block_index int, size size_t) &C.sg_shader_desc {
+ desc.vs.uniform_blocks[block_index].size = size
+ return desc
+}
+
+pub fn (mut desc C.sg_shader_desc) set_frag_uniform_block_size(block_index int, size size_t) &C.sg_shader_desc {
+ desc.fs.uniform_blocks[block_index].size = size
+ return desc
+}
+
+pub fn (mut desc C.sg_shader_desc) set_vert_uniform(block_index int, uniform_index int, name string, @type UniformType, array_count int) &C.sg_shader_desc {
+ desc.vs.uniform_blocks[block_index].uniforms[uniform_index].name = &char(name.str)
+ desc.vs.uniform_blocks[block_index].uniforms[uniform_index].@type = @type
+ return desc
+}
+
+pub fn (mut desc C.sg_shader_desc) set_frag_uniform(block_index int, uniform_index int, name string, @type UniformType, array_count int) &C.sg_shader_desc {
+ desc.fs.uniform_blocks[block_index].uniforms[uniform_index].name = &char(name.str)
+ desc.fs.uniform_blocks[block_index].uniforms[uniform_index].@type = @type
+ return desc
+}
+
+pub fn (desc &C.sg_shader_desc) make_shader() C.sg_shader {
+ return C.sg_make_shader(desc)
+}
+
+pub struct C.sg_shader_attr_desc {
+pub mut:
+ name &char // GLSL vertex attribute name (only required for GLES2)
+ sem_name &char // HLSL semantic name
+ sem_index int // HLSL semantic index
+}
+
+pub struct C.sg_shader_stage_desc {
+pub mut:
+ source &char
+ bytecode C.sg_range
+ entry &char
+ uniform_blocks [4]C.sg_shader_uniform_block_desc
+ images [12]C.sg_shader_image_desc
+}
+
+pub fn (mut desc C.sg_shader_stage_desc) set_image(index int, name string) C.sg_shader_stage_desc {
+ desc.images[index].name = &char(name.str)
+ desc.images[index].image_type = ._2d
+ return *desc
+}
+
+pub struct C.sg_shader_uniform_block_desc {
+pub mut:
+ size size_t
+ uniforms [16]C.sg_shader_uniform_desc
+}
+
+pub struct C.sg_shader_uniform_desc {
+pub mut:
+ name &char
+ @type UniformType
+ array_count int
+}
+
+pub struct C.sg_shader_image_desc {
+pub mut:
+ name &char
+ image_type ImageType
+}
+
+pub struct C.sg_shader_info {
+}
+
+pub struct C.sg_context {
+ id u32
+}
+
+pub struct C.sg_range {
+pub mut:
+ ptr voidptr
+ size size_t
+}
+
+pub struct C.sg_color {
+pub mut:
+ r f32
+ g f32
+ b f32
+ a f32
+}
+
+pub struct C.sg_shader {
+pub:
+ id u32
+}
+
+pub fn (s C.sg_shader) free() {
+ C.sg_destroy_shader(s)
+}
+
+pub struct C.sg_pass_desc {
+pub mut:
+ _start_canary u32
+ color_attachments [4]C.sg_pass_attachment_desc
+ depth_stencil_attachment C.sg_pass_attachment_desc
+ label &char
+ _end_canary u32
+}
+
+pub struct C.sg_pass_info {
+ info C.sg_slot_info
+}
+
+pub struct C.sg_pass_action {
+pub mut:
+ _start_canary u32
+ colors [4]C.sg_color_attachment_action
+ depth C.sg_depth_attachment_action
+ stencil C.sg_stencil_attachment_action
+ _end_canary u32
+}
+
+pub struct C.sg_pass {
+ id u32
+}
+
+pub fn (p C.sg_pass) free() {
+ C.sg_destroy_pass(p)
+}
+
+pub struct C.sg_buffer_desc {
+pub mut:
+ _start_canary u32
+ size size_t
+ @type BufferType
+ usage Usage
+ data C.sg_range
+ label &char
+ // GL specific
+ gl_buffers [2]u32
+ // Metal specific
+ mtl_buffers [2]voidptr
+ // D3D11 specific
+ d3d11_buffer voidptr
+ _end_canary u32
+}
+
+pub struct C.sg_buffer_info {
+}
+
+pub struct C.sg_buffer {
+ id u32
+}
+
+pub fn (b C.sg_buffer) free() {
+ C.sg_destroy_buffer(b)
+}
+
+pub struct DepthLayers {
+ depth int
+ layers int
+}
+
+pub struct C.sg_image_desc {
+pub mut:
+ _start_canary u32
+ @type ImageType
+ render_target bool
+ width int
+ height int
+ num_slices int
+ num_mipmaps int
+ usage Usage
+ pixel_format PixelFormat
+ sample_count int
+ min_filter Filter
+ mag_filter Filter
+ wrap_u Wrap
+ wrap_v Wrap
+ wrap_w Wrap
+ border_color BorderColor
+ max_anisotropy u32
+ min_lod f32
+ max_lod f32
+ data C.sg_image_data
+ label &char
+ // GL specific
+ gl_textures [2]u32
+ gl_texture_target u32
+ // Metal specific
+ mtl_textures [2]voidptr
+ // D3D11 specific
+ d3d11_texture voidptr
+ d3d11_shader_resource_view voidptr
+ // WebGPU specific
+ wgpu_texture voidptr
+ _end_canary u32
+}
+
+pub struct C.sg_image_info {
+pub mut:
+ slot C.sg_slot_info // resource pool slot info
+ upd_frame_index u32 // frame index of last sg_update_image()
+ num_slots int // number of renaming-slots for dynamically updated images
+ active_slot int // currently active write-slot for dynamically updated images
+}
+
+pub struct C.sg_image {
+pub:
+ id u32
+}
+
+pub fn (i C.sg_image) free() {
+ C.sg_destroy_image(i)
+}
+
+pub const sg_cubeface_num = 6
+
+pub const sg_max_mipmaps = 16
+
+pub struct C.sg_image_data {
+pub mut:
+ subimage [sg_cubeface_num][sg_max_mipmaps]C.sg_range
+}
+
+pub struct C.sg_features {
+pub:
+ instancing bool // hardware instancing supported
+ origin_top_left bool // framebuffer and texture origin is in top left corner
+ multiple_render_targets bool // offscreen render passes can have multiple render targets attached
+ msaa_render_targets bool // offscreen render passes support MSAA antialiasing
+ imagetype_3d bool // creation of SG_IMAGETYPE_3D images is supported
+ imagetype_array bool // creation of SG_IMAGETYPE_ARRAY images is supported
+ image_clamp_to_border bool // border color and clamp-to-border UV-wrap mode is supported
+ mrt_independent_blend_state bool // multiple-render-target rendering can use per-render-target blend state
+ mrt_independent_write_mask bool // multiple-render-target rendering can use per-render-target color write masks
+}
+
+pub struct C.sg_limits {
+pub:
+ max_image_size_2d u32 // max width/height of SG_IMAGETYPE_2D images
+ max_image_size_cube u32 // max width/height of SG_IMAGETYPE_CUBE images
+ max_image_size_3d u32 // max width/height/depth of SG_IMAGETYPE_3D images
+ max_image_size_array u32 // max width/height pf SG_IMAGETYPE_ARRAY images
+ max_image_array_layers u32 // max number of layers in SG_IMAGETYPE_ARRAY images
+ max_vertex_attrs u32 // <= SG_MAX_VERTEX_ATTRIBUTES (only on some GLES2 impls)
+}
+
+pub struct C.sg_layout_desc {
+pub mut:
+ buffers [8]C.sg_buffer_layout_desc
+ attrs [16]C.sg_vertex_attr_desc
+}
+
+pub struct C.sg_buffer_layout_desc {
+pub mut:
+ stride int
+ step_func VertexStep
+ step_rate int
+}
+
+pub struct C.sg_vertex_attr_desc {
+pub mut:
+ buffer_index int
+ offset int
+ format VertexFormat
+}
+
+pub struct C.sg_stencil_state {
+ enabled bool
+ front C.sg_stencil_face_state
+ back C.sg_stencil_face_state
+ read_mask byte
+ write_mask byte
+ ref byte
+}
+
+pub struct C.sg_depth_state {
+ pixel_format PixelFormat
+ compare CompareFunc
+ write_enabled bool
+ bias f32
+ bias_slope_scale f32
+ bias_clamp f32
+}
+
+pub struct C.sg_stencil_face_state {
+ fail_op StencilOp
+ depth_fail_op StencilOp
+ pass_op StencilOp
+ compare_func CompareFunc
+}
+
+pub struct C.sg_blend_state {
+pub mut:
+ enabled bool
+ src_factor_rgb BlendFactor
+ dst_factor_rgb BlendFactor
+ op_rgb BlendOp
+ src_factor_alpha BlendFactor
+ dst_factor_alpha BlendFactor
+ op_alpha BlendOp
+}
+
+pub struct C.sg_color_attachment_action {
+pub mut:
+ action Action
+ value C.sg_color
+}
+
+/*
+pub fn (mut action C.sg_color_attachment_action) set_color_values(r, g, b, a f32) {
+ action.val[0] = r
+ action.val[1] = g
+ action.val[2] = b
+ action.val[3] = a
+}
+*/
+pub struct C.sg_depth_attachment_action {
+pub mut:
+ action Action
+ value f32
+}
+
+pub struct C.sg_stencil_attachment_action {
+pub mut:
+ action Action
+ value byte
+}
+
+pub struct C.sg_pixelformat_info {
+pub:
+ sample bool // pixel format can be sampled in shaders
+ filter bool // pixel format can be sampled with filtering
+ render bool // pixel format can be used as render target
+ blend bool // alpha-blending is supported
+ msaa bool // pixel format can be used as MSAA render target
+ depth bool // pixel format is a depth format
+}
+
+pub struct C.sg_pass_attachment_desc {
+pub mut:
+ image C.sg_image
+ mip_level int
+ face int
+ // image sg_image
+ // mip_level int
+ // union {
+ // face int
+ // layer int
+ // slice int
+ // }
+}
diff --git a/v_windows/v/old/vlib/sokol/gfx/gfx_utils.v b/v_windows/v/old/vlib/sokol/gfx/gfx_utils.v
new file mode 100644
index 0000000..c95ff69
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/gfx/gfx_utils.v
@@ -0,0 +1,17 @@
+module gfx
+
+pub fn create_clear_pass(r f32, g f32, b f32, a f32) C.sg_pass_action {
+ mut color_action := C.sg_color_attachment_action{
+ action: Action(C.SG_ACTION_CLEAR)
+ value: C.sg_color{
+ r: r
+ g: g
+ b: b
+ a: a
+ }
+ }
+ // color_action.set_color_values(r, g, b, a)
+ mut pass_action := C.sg_pass_action{}
+ pass_action.colors[0] = color_action
+ return pass_action
+}
diff --git a/v_windows/v/old/vlib/sokol/sapp/enums.v b/v_windows/v/old/vlib/sokol/sapp/enums.v
new file mode 100644
index 0000000..8e0efd7
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/sapp/enums.v
@@ -0,0 +1,165 @@
+module sapp
+
+pub enum EventType {
+ invalid
+ key_down
+ key_up
+ char
+ mouse_down
+ mouse_up
+ mouse_scroll
+ mouse_move
+ mouse_enter
+ mouse_leave
+ touches_began
+ touches_moved
+ touches_ended
+ touches_cancelled
+ resized
+ iconified
+ restored
+ suspended
+ resumed
+ update_cursor
+ quit_requested
+ clipboard_pasted
+ num
+}
+
+pub enum MouseButton {
+ invalid = -1
+ left = 0
+ right = 1
+ middle = 2
+}
+
+pub enum Modifier {
+ shift = 1 //(1<<0)
+ ctrl = 2 //(1<<1)
+ alt = 4 //(1<<2)
+ super = 8 //(1<<3)
+}
+
+pub enum KeyCode {
+ invalid = 0
+ space = 32
+ apostrophe = 39 //'
+ comma = 44 //,
+ minus = 45 //-
+ period = 46 //.
+ slash = 47 ///
+ _0 = 48
+ _1 = 49
+ _2 = 50
+ _3 = 51
+ _4 = 52
+ _5 = 53
+ _6 = 54
+ _7 = 55
+ _8 = 56
+ _9 = 57
+ semicolon = 59 //;
+ equal = 61 //=
+ a = 65
+ b = 66
+ c = 67
+ d = 68
+ e = 69
+ f = 70
+ g = 71
+ h = 72
+ i = 73
+ j = 74
+ k = 75
+ l = 76
+ m = 77
+ n = 78
+ o = 79
+ p = 80
+ q = 81
+ r = 82
+ s = 83
+ t = 84
+ u = 85
+ v = 86
+ w = 87
+ x = 88
+ y = 89
+ z = 90
+ left_bracket = 91 //[
+ backslash = 92 //\
+ right_bracket = 93 //]
+ grave_accent = 96 //`
+ world_1 = 161 // non-us #1
+ world_2 = 162 // non-us #2
+ escape = 256
+ enter = 257
+ tab = 258
+ backspace = 259
+ insert = 260
+ delete = 261
+ right = 262
+ left = 263
+ down = 264
+ up = 265
+ page_up = 266
+ page_down = 267
+ home = 268
+ end = 269
+ caps_lock = 280
+ scroll_lock = 281
+ num_lock = 282
+ print_screen = 283
+ pause = 284
+ f1 = 290
+ f2 = 291
+ f3 = 292
+ f4 = 293
+ f5 = 294
+ f6 = 295
+ f7 = 296
+ f8 = 297
+ f9 = 298
+ f10 = 299
+ f11 = 300
+ f12 = 301
+ f13 = 302
+ f14 = 303
+ f15 = 304
+ f16 = 305
+ f17 = 306
+ f18 = 307
+ f19 = 308
+ f20 = 309
+ f21 = 310
+ f22 = 311
+ f23 = 312
+ f24 = 313
+ f25 = 314
+ kp_0 = 320
+ kp_1 = 321
+ kp_2 = 322
+ kp_3 = 323
+ kp_4 = 324
+ kp_5 = 325
+ kp_6 = 326
+ kp_7 = 327
+ kp_8 = 328
+ kp_9 = 329
+ kp_decimal = 330
+ kp_divide = 331
+ kp_multiply = 332
+ kp_subtract = 333
+ kp_add = 334
+ kp_enter = 335
+ kp_equal = 336
+ left_shift = 340
+ left_control = 341
+ left_alt = 342
+ left_super = 343
+ right_shift = 344
+ right_control = 345
+ right_alt = 346
+ right_super = 347
+ menu = 348
+}
diff --git a/v_windows/v/old/vlib/sokol/sapp/sapp.v b/v_windows/v/old/vlib/sokol/sapp/sapp.v
new file mode 100644
index 0000000..7f60dc7
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/sapp/sapp.v
@@ -0,0 +1,237 @@
+module sapp
+
+import sokol.gfx
+
+pub const (
+ used_import = gfx.used_import
+)
+
+// Android needs a global reference to `g_desc`
+__global (
+ g_desc C.sapp_desc
+)
+
+pub fn create_desc() C.sg_desc {
+ metal_desc := C.sg_metal_context_desc{
+ device: metal_get_device()
+ renderpass_descriptor_cb: metal_get_renderpass_descriptor
+ drawable_cb: metal_get_drawable
+ }
+ d3d11_desc := C.sg_d3d11_context_desc{
+ device: d3d11_get_device()
+ device_context: d3d11_get_device_context()
+ render_target_view_cb: d3d11_get_render_target_view
+ depth_stencil_view_cb: d3d11_get_depth_stencil_view
+ }
+ return C.sg_desc{
+ context: C.sg_context_desc{
+ metal: metal_desc
+ d3d11: d3d11_desc
+ color_format: .bgra8
+ }
+ image_pool_size: 1000
+ }
+}
+
+// returns true after sokol-app has been initialized
+[inline]
+pub fn isvalid() bool {
+ return C.sapp_isvalid()
+}
+
+// returns the current framebuffer width in pixels
+[inline]
+pub fn width() int {
+ return C.sapp_width()
+}
+
+// returns the current framebuffer height in pixels
+[inline]
+pub fn height() int {
+ return C.sapp_height()
+}
+
+// returns true when high_dpi was requested and actually running in a high-dpi scenario
+[inline]
+pub fn high_dpi() bool {
+ return C.sapp_high_dpi()
+}
+
+// returns the dpi scaling factor (window pixels to framebuffer pixels)
+[inline]
+pub fn dpi_scale() f32 {
+ return C.sapp_dpi_scale()
+}
+
+// show or hide the mobile device onscreen keyboard
+[inline]
+pub fn show_keyboard(visible bool) {
+ C.sapp_show_keyboard(visible)
+}
+
+// return true if the mobile device onscreen keyboard is currently shown
+[inline]
+pub fn keyboard_shown() bool {
+ return C.sapp_keyboard_shown()
+}
+
+// show or hide the mouse cursor
+[inline]
+pub fn show_mouse(visible bool) {
+ C.sapp_show_mouse(visible)
+}
+
+// show or hide the mouse cursor
+[inline]
+pub fn mouse_shown() bool {
+ return C.sapp_mouse_shown()
+}
+
+[inline]
+pub fn lock_mouse(locked bool) {
+ C.sapp_lock_mouse(locked)
+}
+
+[inline]
+pub fn mouse_locked() bool {
+ return C.sapp_mouse_locked()
+}
+
+// return the userdata pointer optionally provided in sapp_desc
+[inline]
+pub fn userdata() voidptr {
+ return C.sapp_userdata()
+}
+
+// return a copy of the sapp_desc structure
+[inline]
+pub fn query_desc() C.sapp_desc {
+ return C.sapp_query_desc()
+}
+
+// initiate a "soft quit" (sends SAPP_EVENTTYPE_QUIT_REQUESTED)
+[inline]
+pub fn request_quit() {
+ C.sapp_request_quit()
+}
+
+// cancel a pending quit (when SAPP_EVENTTYPE_QUIT_REQUESTED has been received)
+[inline]
+pub fn cancel_quit() {
+ C.sapp_cancel_quit()
+}
+
+// intiate a "hard quit" (quit application without sending SAPP_EVENTTYPE_QUIT_REQUSTED)
+[inline]
+pub fn quit() {
+ C.sapp_quit()
+}
+
+// call from inside event callback to consume the current event (don't forward to platform)
+[inline]
+pub fn consume_event() {
+ C.sapp_consume_event()
+}
+
+// get the current frame counter (for comparison with sapp_event.frame_count)
+[inline]
+pub fn frame_count() u64 {
+ return C.sapp_frame_count()
+}
+
+// write string into clipboard
+[inline]
+pub fn set_clipboard_string(str &char) {
+ C.sapp_set_clipboard_string(str)
+}
+
+// read string from clipboard (usually during SAPP_EVENTTYPE_CLIPBOARD_PASTED)
+[inline]
+pub fn get_clipboard_string() &char {
+ return &char(C.sapp_get_clipboard_string())
+}
+
+// special run-function for SOKOL_NO_ENTRY (in standard mode this is an empty stub)
+[inline]
+pub fn run(desc &C.sapp_desc) {
+ g_desc = desc
+ C.sapp_run(desc)
+}
+
+// GL: return true when GLES2 fallback is active (to detect fallback from GLES3)
+[inline]
+pub fn gles2() bool {
+ return C.sapp_gles2()
+}
+
+// HTML5: enable or disable the hardwired "Leave Site?" dialog box
+[inline]
+pub fn html5_ask_leave_site(ask bool) {
+ C.sapp_html5_ask_leave_site(ask)
+}
+
+// Metal: get ARC-bridged pointer to Metal device object
+[inline]
+pub fn metal_get_device() voidptr {
+ return voidptr(C.sapp_metal_get_device())
+}
+
+// Metal: get ARC-bridged pointer to this frame's renderpass descriptor
+[inline]
+pub fn metal_get_renderpass_descriptor() voidptr {
+ return voidptr(C.sapp_metal_get_renderpass_descriptor())
+}
+
+// Metal: get ARC-bridged pointer to current drawable
+[inline]
+pub fn metal_get_drawable() voidptr {
+ return voidptr(C.sapp_metal_get_drawable())
+}
+
+// macOS: get ARC-bridged pointer to macOS NSWindow
+[inline]
+pub fn macos_get_window() voidptr {
+ return voidptr(C.sapp_macos_get_window())
+}
+
+// iOS: get ARC-bridged pointer to iOS UIWindow
+[inline]
+pub fn ios_get_window() voidptr {
+ return voidptr(C.sapp_ios_get_window())
+}
+
+// D3D11: get pointer to ID3D11Device object
+[inline]
+pub fn d3d11_get_device() voidptr {
+ return voidptr(C.sapp_d3d11_get_device())
+}
+
+// D3D11: get pointer to ID3D11DeviceContext object
+[inline]
+pub fn d3d11_get_device_context() voidptr {
+ return voidptr(C.sapp_d3d11_get_device_context())
+}
+
+// D3D11: get pointer to ID3D11RenderTargetView object
+[inline]
+pub fn d3d11_get_render_target_view() voidptr {
+ return voidptr(C.sapp_d3d11_get_render_target_view())
+}
+
+// D3D11: get pointer to ID3D11DepthStencilView
+[inline]
+pub fn d3d11_get_depth_stencil_view() voidptr {
+ return voidptr(C.sapp_d3d11_get_depth_stencil_view())
+}
+
+// Win32: get the HWND window handle
+[inline]
+pub fn win32_get_hwnd() voidptr {
+ return voidptr(C.sapp_win32_get_hwnd())
+}
+
+// Android: get native activity handle
+[inline]
+pub fn android_get_native_activity() voidptr {
+ return voidptr(C.sapp_android_get_native_activity())
+}
diff --git a/v_windows/v/old/vlib/sokol/sapp/sapp_funcs.v b/v_windows/v/old/vlib/sokol/sapp/sapp_funcs.v
new file mode 100644
index 0000000..aae95c8
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/sapp/sapp_funcs.v
@@ -0,0 +1,105 @@
+module sapp
+
+// returns true after sokol-app has been initialized
+fn C.sapp_isvalid() bool
+
+// returns the current framebuffer width in pixels
+fn C.sapp_width() int
+fn C.sapp_widthf() f32
+
+// returns the current framebuffer height in pixels
+fn C.sapp_height() int
+fn C.sapp_heightf() f32
+
+// returns true when high_dpi was requested and actually running in a high-dpi scenario
+fn C.sapp_high_dpi() bool
+
+// returns the dpi scaling factor (window pixels to framebuffer pixels)
+fn C.sapp_dpi_scale() f32
+
+// show or hide the mobile device onscreen keyboard
+fn C.sapp_show_keyboard(visible bool)
+
+// return true if the mobile device onscreen keyboard is currently shown
+fn C.sapp_keyboard_shown() bool
+
+// show or hide the mouse cursor
+fn C.sapp_show_mouse(visible bool)
+
+// return true if the mouse cursor is shown
+fn C.sapp_mouse_shown() bool
+
+// lock or unlock the mouse cursor
+fn C.sapp_lock_mouse(locked bool)
+
+// return true if the mouse cursor is locked
+fn C.sapp_mouse_locked() bool
+
+// return the userdata pointer optionally provided in sapp_desc
+fn C.sapp_userdata() voidptr
+
+// return a copy of the sapp_desc structure
+fn C.sapp_query_desc() C.sapp_desc
+
+// initiate a "soft quit" (sends SAPP_EVENTTYPE_QUIT_REQUESTED)
+fn C.sapp_request_quit()
+
+// cancel a pending quit (when SAPP_EVENTTYPE_QUIT_REQUESTED has been received)
+fn C.sapp_cancel_quit()
+
+// intiate a "hard quit" (quit application without sending SAPP_EVENTTYPE_QUIT_REQUSTED)
+fn C.sapp_quit()
+
+// call from inside event callback to consume the current event (don't forward to platform)
+fn C.sapp_consume_event()
+
+// get the current frame counter (for comparison with sapp_event.frame_count)
+fn C.sapp_frame_count() u64
+
+// write string into clipboard
+fn C.sapp_set_clipboard_string(str &byte)
+
+// read string from clipboard (usually during SAPP_EVENTTYPE_CLIPBOARD_PASTED)
+fn C.sapp_get_clipboard_string() &byte
+
+// special run-function for SOKOL_NO_ENTRY (in standard mode this is an empty stub)
+fn C.sapp_run(desc &C.sapp_desc) int
+
+// GL: return true when GLES2 fallback is active (to detect fallback from GLES3)
+fn C.sapp_gles2() bool
+
+// HTML5: enable or disable the hardwired "Leave Site?" dialog box
+fn C.sapp_html5_ask_leave_site(ask bool)
+
+// Metal: get ARC-bridged pointer to Metal device object
+fn C.sapp_metal_get_device() voidptr
+
+// Metal: get ARC-bridged pointer to this frame's renderpass descriptor
+fn C.sapp_metal_get_renderpass_descriptor() voidptr
+
+// Metal: get ARC-bridged pointer to current drawable
+fn C.sapp_metal_get_drawable() voidptr
+
+// macOS: get ARC-bridged pointer to macOS NSWindow
+fn C.sapp_macos_get_window() voidptr
+
+// iOS: get ARC-bridged pointer to iOS UIWindow
+fn C.sapp_ios_get_window() voidptr
+
+// D3D11: get pointer to ID3D11Device object
+fn C.sapp_d3d11_get_device() voidptr
+
+// D3D11: get pointer to ID3D11DeviceContext object
+fn C.sapp_d3d11_get_device_context() voidptr
+
+// D3D11: get pointer to ID3D11RenderTargetView object
+fn C.sapp_d3d11_get_render_target_view() voidptr
+
+// D3D11: get pointer to ID3D11DepthStencilView
+fn C.sapp_d3d11_get_depth_stencil_view() voidptr
+
+// Win32: get the HWND window handle
+fn C.sapp_win32_get_hwnd() voidptr
+
+// Android: get native activity handle
+fn C.sapp_android_get_native_activity() voidptr
diff --git a/v_windows/v/old/vlib/sokol/sapp/sapp_structs.v b/v_windows/v/old/vlib/sokol/sapp/sapp_structs.v
new file mode 100644
index 0000000..a8ff8b1
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/sapp/sapp_structs.v
@@ -0,0 +1,104 @@
+module sapp
+
+pub struct C.sapp_desc {
+pub:
+ init_cb fn () // these are the user-provided callbacks without user data
+ frame_cb fn ()
+ cleanup_cb fn ()
+ event_cb fn (&C.sapp_event) //&sapp_event)
+ fail_cb fn (&byte)
+
+ user_data voidptr // these are the user-provided callbacks with user data
+ init_userdata_cb fn (voidptr)
+ frame_userdata_cb fn (voidptr)
+ cleanup_userdata_cb fn (voidptr)
+ event_userdata_cb fn (&C.sapp_event, voidptr)
+ fail_userdata_cb fn (&char, voidptr)
+
+ width int // the preferred width of the window / canvas
+ height int // the preferred height of the window / canvas
+ sample_count int // MSAA sample count
+ swap_interval int // the preferred swap interval (ignored on some platforms)
+ high_dpi bool // whether the rendering canvas is full-resolution on HighDPI displays
+ fullscreen bool // whether the window should be created in fullscreen mode
+ alpha bool // whether the framebuffer should have an alpha channel (ignored on some platforms)
+ window_title &char // the window title as UTF-8 encoded string
+ user_cursor bool // if true, user is expected to manage cursor image in SAPP_EVENTTYPE_UPDATE_CURSOR
+ enable_clipboard bool // enable clipboard access, default is false
+ clipboard_size int // max size of clipboard content in bytes
+ enable_dragndrop bool // enable file dropping (drag'n'drop), default is false
+ max_dropped_files int // max number of dropped files to process (default: 1)
+ max_dropped_file_path_length int // max length in bytes of a dropped UTF-8 file path (default: 2048)
+ // backend-specific options
+ gl_force_gles2 bool // if true, setup GLES2/WebGL even if GLES3/WebGL2 is available
+ win32_console_utf8 bool // if true, set the output console codepage to UTF-8
+ win32_console_create bool // if true, attach stdout/stderr to a new console window
+ win32_console_attach bool // if true, attach stdout/stderr to parent process
+ html5_canvas_name &char // the name (id) of the HTML5 canvas element, default is "canvas"
+ html5_canvas_resize bool // if true, the HTML5 canvas size is set to sapp_desc.width/height, otherwise canvas size is tracked
+ html5_preserve_drawing_buffer bool // HTML5 only: whether to preserve default framebuffer content between frames
+ html5_premultiplied_alpha bool // HTML5 only: whether the rendered pixels use premultiplied alpha convention
+ html5_ask_leave_site bool // initial state of the internal html5_ask_leave_site flag (see sapp_html5_ask_leave_site())
+ ios_keyboard_resizes_canvas bool // if true, showing the iOS keyboard shrinks the canvas
+ // V patches
+ __v_native_render bool // V patch to allow for native rendering
+}
+
+pub struct Event {
+pub:
+ frame_count u64
+ typ EventType
+ key_code KeyCode
+ char_code u32
+ key_repeat bool
+ modifiers u32
+ mouse_button MouseButton
+ mouse_x f32
+ mouse_y f32
+ mouse_dx f32
+ mouse_dy f32
+ scroll_x f32
+ scroll_y f32
+ num_touches int
+ touches [8]C.sapp_touchpoint
+ window_width int
+ window_height int
+ framebuffer_width int
+ framebuffer_height int
+}
+
+pub struct C.sapp_event {
+pub:
+ frame_count u64
+ @type EventType
+ key_code KeyCode
+ char_code u32
+ key_repeat bool
+ modifiers u32
+ mouse_button MouseButton
+ mouse_x f32
+ mouse_y f32
+ mouse_dx f32
+ mouse_dy f32
+ scroll_x f32
+ scroll_y f32
+ num_touches int
+ touches [8]C.sapp_touchpoint
+ window_width int
+ window_height int
+ framebuffer_width int
+ framebuffer_height int
+}
+
+pub fn (e &C.sapp_event) str() string {
+ t := e.@type
+ return 'evt: frame_count=$e.frame_count, type=$t'
+}
+
+pub struct C.sapp_touchpoint {
+pub:
+ identifier u64
+ pos_x f32
+ pos_y f32
+ changed bool
+}
diff --git a/v_windows/v/old/vlib/sokol/sfons/sfons.v b/v_windows/v/old/vlib/sokol/sfons/sfons.v
new file mode 100644
index 0000000..08d2dc6
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/sfons/sfons.v
@@ -0,0 +1,28 @@
+module sfons
+
+import fontstash
+
+const (
+ // keep v from warning about unused imports
+ used_import = fontstash.used_import + 1
+)
+
+[inline]
+pub fn create(width int, height int, flags int) &C.FONScontext {
+ return C.sfons_create(width, height, flags)
+}
+
+[inline]
+pub fn destroy(ctx &C.FONScontext) {
+ C.sfons_destroy(ctx)
+}
+
+[inline]
+pub fn rgba(r byte, g byte, b byte, a byte) u32 {
+ return C.sfons_rgba(r, g, b, a)
+}
+
+[inline]
+pub fn flush(ctx &C.FONScontext) {
+ C.sfons_flush(ctx)
+}
diff --git a/v_windows/v/old/vlib/sokol/sfons/sfons_funcs.v b/v_windows/v/old/vlib/sokol/sfons/sfons_funcs.v
new file mode 100644
index 0000000..cec30d6
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/sfons/sfons_funcs.v
@@ -0,0 +1,6 @@
+module sfons
+
+fn C.sfons_create(width int, height int, flags int) &C.FONScontext
+fn C.sfons_destroy(ctx &C.FONScontext)
+fn C.sfons_rgba(r byte, g byte, b byte, a byte) u32
+fn C.sfons_flush(ctx &C.FONScontext)
diff --git a/v_windows/v/old/vlib/sokol/sgl/sgl.v b/v_windows/v/old/vlib/sokol/sgl/sgl.v
new file mode 100644
index 0000000..0129cbf
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/sgl/sgl.v
@@ -0,0 +1,375 @@
+module sgl
+
+import sokol.gfx
+
+pub const (
+ version = gfx.version + 1
+)
+
+// setup/shutdown/misc
+[inline]
+pub fn setup(desc &C.sgl_desc_t) {
+ C.sgl_setup(desc)
+}
+
+[inline]
+pub fn shutdown() {
+ C.sgl_shutdown()
+}
+
+[inline]
+pub fn error() C.sgl_error_t {
+ return C.sgl_error()
+}
+
+[inline]
+pub fn defaults() {
+ C.sgl_defaults()
+}
+
+[inline]
+pub fn rad(deg f32) f32 {
+ return C.sgl_rad(deg)
+}
+
+[inline]
+pub fn deg(rad f32) f32 {
+ return C.sgl_deg(rad)
+}
+
+// create and destroy pipeline objects
+[inline]
+pub fn make_pipeline(desc &C.sg_pipeline_desc) C.sgl_pipeline {
+ return C.sgl_make_pipeline(desc)
+}
+
+[inline]
+pub fn destroy_pipeline(pip C.sgl_pipeline) {
+ C.sgl_destroy_pipeline(pip)
+}
+
+// render state functions
+[inline]
+pub fn viewport(x int, y int, w int, h int, origin_top_left bool) {
+ C.sgl_viewport(x, y, w, h, origin_top_left)
+}
+
+[inline]
+pub fn scissor_rect(x int, y int, w int, h int, origin_top_left bool) {
+ C.sgl_scissor_rect(x, y, w, h, origin_top_left)
+}
+
+[inline]
+pub fn enable_texture() {
+ C.sgl_enable_texture()
+}
+
+[inline]
+pub fn disable_texture() {
+ C.sgl_disable_texture()
+}
+
+[inline]
+pub fn texture(img C.sg_image) {
+ C.sgl_texture(img)
+}
+
+// pipeline stack functions
+[inline]
+pub fn default_pipeline() {
+ C.sgl_default_pipeline()
+}
+
+[inline]
+pub fn load_pipeline(pip C.sgl_pipeline) {
+ C.sgl_load_pipeline(pip)
+}
+
+[inline]
+pub fn push_pipeline() {
+ C.sgl_push_pipeline()
+}
+
+[inline]
+pub fn pop_pipeline() {
+ C.sgl_pop_pipeline()
+}
+
+// matrix stack functions
+[inline]
+pub fn matrix_mode_modelview() {
+ C.sgl_matrix_mode_modelview()
+}
+
+[inline]
+pub fn matrix_mode_projection() {
+ C.sgl_matrix_mode_projection()
+}
+
+[inline]
+pub fn matrix_mode_texture() {
+ C.sgl_matrix_mode_texture()
+}
+
+[inline]
+pub fn load_identity() {
+ C.sgl_load_identity()
+}
+
+[inline]
+pub fn load_matrix(m []f32) {
+ C.sgl_load_matrix(m.data)
+}
+
+[inline]
+pub fn load_transpose_matrix(m []f32) {
+ C.sgl_load_transpose_matrix(m.data)
+}
+
+[inline]
+pub fn mult_matrix(m []f32) {
+ C.sgl_mult_matrix(m.data)
+}
+
+[inline]
+pub fn mult_transpose_matrix(m []f32) {
+ C.sgl_mult_transpose_matrix(m.data)
+}
+
+[inline]
+pub fn rotate(angle_rad f32, x f32, y f32, z f32) {
+ C.sgl_rotate(angle_rad, x, y, z)
+}
+
+[inline]
+pub fn scale(x f32, y f32, z f32) {
+ C.sgl_scale(x, y, z)
+}
+
+[inline]
+pub fn translate(x f32, y f32, z f32) {
+ C.sgl_translate(x, y, z)
+}
+
+[inline]
+pub fn frustum(l f32, r f32, b f32, t f32, n f32, f f32) {
+ C.sgl_frustum(l, r, b, t, n, f)
+}
+
+[inline]
+pub fn ortho(l f32, r f32, b f32, t f32, n f32, f f32) {
+ C.sgl_ortho(l, r, b, t, n, f)
+}
+
+[inline]
+pub fn perspective(fov_y f32, aspect f32, z_near f32, z_far f32) {
+ C.sgl_perspective(fov_y, aspect, z_near, z_far)
+}
+
+[inline]
+pub fn lookat(eye_x f32, eye_y f32, eye_z f32, center_x f32, center_y f32, center_z f32, up_x f32, up_y f32, up_z f32) {
+ C.sgl_lookat(eye_x, eye_y, eye_z, center_x, center_y, center_z, up_x, up_y, up_z)
+}
+
+[inline]
+pub fn push_matrix() {
+ C.sgl_push_matrix()
+}
+
+[inline]
+pub fn pop_matrix() {
+ C.sgl_pop_matrix()
+}
+
+// these functions only set the internal 'current texcoord / color' (valid inside or outside begin/end)
+[inline]
+pub fn t2f(u f32, v f32) {
+ C.sgl_t2f(u, v)
+}
+
+[inline]
+pub fn c3f(r f32, g f32, b f32) {
+ C.sgl_c3f(r, g, b)
+}
+
+[inline]
+pub fn c4f(r f32, g f32, b f32, a f32) {
+ C.sgl_c4f(r, g, b, a)
+}
+
+[inline]
+pub fn c3b(r byte, g byte, b byte) {
+ C.sgl_c3b(r, g, b)
+}
+
+[inline]
+pub fn c4b(r byte, g byte, b byte, a byte) {
+ C.sgl_c4b(r, g, b, a)
+}
+
+[inline]
+pub fn c1i(rgba u32) {
+ C.sgl_c1i(rgba)
+}
+
+// define primitives, each begin/end is one draw command
+[inline]
+pub fn begin_points() {
+ C.sgl_begin_points()
+}
+
+[inline]
+pub fn begin_lines() {
+ C.sgl_begin_lines()
+}
+
+[inline]
+pub fn begin_line_strip() {
+ C.sgl_begin_line_strip()
+}
+
+[inline]
+pub fn begin_triangles() {
+ C.sgl_begin_triangles()
+}
+
+[inline]
+pub fn begin_triangle_strip() {
+ C.sgl_begin_triangle_strip()
+}
+
+[inline]
+pub fn begin_quads() {
+ C.sgl_begin_quads()
+}
+
+[inline]
+pub fn v2f(x f32, y f32) {
+ C.sgl_v2f(x, y)
+}
+
+[inline]
+pub fn v3f(x f32, y f32, z f32) {
+ C.sgl_v3f(x, y, z)
+}
+
+[inline]
+pub fn v2f_t2f(x f32, y f32, u f32, v f32) {
+ C.sgl_v2f_t2f(x, y, u, v)
+}
+
+[inline]
+pub fn v3f_t2f(x f32, y f32, z f32, u f32, v f32) {
+ C.sgl_v3f_t2f(x, y, z, u, v)
+}
+
+[inline]
+pub fn v2f_c3f(x f32, y f32, r f32, g f32, b f32) {
+ C.sgl_v2f_c3f(x, y, r, g, b)
+}
+
+[inline]
+pub fn v2f_c3b(x f32, y f32, r byte, g byte, b byte) {
+ C.sgl_v2f_c3b(x, y, r, g, b)
+}
+
+[inline]
+pub fn v2f_c4f(x f32, y f32, r f32, g f32, b f32, a f32) {
+ C.sgl_v2f_c4f(x, y, r, g, b, a)
+}
+
+[inline]
+pub fn v2f_c4b(x f32, y f32, r byte, g byte, b byte, a byte) {
+ C.sgl_v2f_c4b(x, y, r, g, b, a)
+}
+
+[inline]
+pub fn v2f_c1i(x f32, y f32, rgba u32) {
+ C.sgl_v2f_c1i(x, y, rgba)
+}
+
+[inline]
+pub fn v3f_c3f(x f32, y f32, z f32, r f32, g f32, b f32) {
+ C.sgl_v3f_c3f(x, y, z, r, g, b)
+}
+
+[inline]
+pub fn v3f_c3b(x f32, y f32, z f32, r byte, g byte, b byte) {
+ C.sgl_v3f_c3b(x, y, z, r, g, b)
+}
+
+[inline]
+pub fn v3f_c4f(x f32, y f32, z f32, r f32, g f32, b f32, a f32) {
+ C.sgl_v3f_c4f(x, y, z, r, g, b, a)
+}
+
+[inline]
+pub fn v3f_c4b(x f32, y f32, z f32, r byte, g byte, b byte, a byte) {
+ C.sgl_v3f_c4b(x, y, z, r, g, b, a)
+}
+
+[inline]
+pub fn v3f_c1i(x f32, y f32, z f32, rgba u32) {
+ C.sgl_v3f_c1i(x, y, z, rgba)
+}
+
+[inline]
+pub fn v2f_t2f_c3f(x f32, y f32, u f32, v f32, r f32, g f32, b f32) {
+ C.sgl_v2f_t2f_c3f(x, y, u, v, r, g, b)
+}
+
+[inline]
+pub fn v2f_t2f_c3b(x f32, y f32, u f32, v f32, r byte, g byte, b byte) {
+ C.sgl_v2f_t2f_c3b(x, y, u, v, r, g, b)
+}
+
+[inline]
+pub fn v2f_t2f_c4f(x f32, y f32, u f32, v f32, r f32, g f32, b f32, a f32) {
+ C.sgl_v2f_t2f_c4f(x, y, u, v, r, g, b, a)
+}
+
+[inline]
+pub fn v2f_t2f_c4b(x f32, y f32, u f32, v f32, r byte, g byte, b byte, a byte) {
+ C.sgl_v2f_t2f_c4b(x, y, u, v, r, g, b, a)
+}
+
+[inline]
+pub fn v2f_t2f_c1i(x f32, y f32, u f32, v f32, rgba u32) {
+ C.sgl_v2f_t2f_c1i(x, y, u, v, rgba)
+}
+
+[inline]
+pub fn v3f_t2f_c3f(x f32, y f32, z f32, u f32, v f32, r f32, g f32, b f32) {
+ C.sgl_v3f_t2f_c3f(x, y, z, u, v, r, g, b)
+}
+
+[inline]
+pub fn v3f_t2f_c3b(x f32, y f32, z f32, u f32, v f32, r byte, g byte, b byte) {
+ C.sgl_v3f_t2f_c3b(x, y, z, u, v, r, g, b)
+}
+
+[inline]
+pub fn v3f_t2f_c4f(x f32, y f32, z f32, u f32, v f32, r f32, g f32, b f32, a f32) {
+ C.sgl_v3f_t2f_c4f(x, y, z, u, v, r, g, b, a)
+}
+
+[inline]
+pub fn v3f_t2f_c4b(x f32, y f32, z f32, u f32, v f32, r byte, g byte, b byte, a byte) {
+ C.sgl_v3f_t2f_c4b(x, y, z, u, v, r, g, b, a)
+}
+
+[inline]
+pub fn v3f_t2f_c1i(x f32, y f32, z f32, u f32, v f32, rgba u32) {
+ C.sgl_v3f_t2f_c1i(x, y, z, u, v, rgba)
+}
+
+[inline]
+pub fn end() {
+ C.sgl_end()
+}
+
+// render everything
+[inline]
+pub fn draw() {
+ C.sgl_draw()
+}
diff --git a/v_windows/v/old/vlib/sokol/sgl/sgl_funcs.v b/v_windows/v/old/vlib/sokol/sgl/sgl_funcs.v
new file mode 100644
index 0000000..16e980d
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/sgl/sgl_funcs.v
@@ -0,0 +1,91 @@
+module sgl
+
+// setup/shutdown/misc
+fn C.sgl_setup(desc &C.sgl_desc_t)
+fn C.sgl_shutdown()
+fn C.sgl_error() C.sgl_error_t
+fn C.sgl_defaults()
+fn C.sgl_rad(deg f32) f32
+fn C.sgl_deg(rad f32) f32
+
+// create and destroy pipeline objects
+fn C.sgl_make_pipeline(desc &C.sg_pipeline_desc) C.sgl_pipeline
+fn C.sgl_destroy_pipeline(pip C.sgl_pipeline)
+
+// render state functions
+fn C.sgl_viewport(x int, y int, w int, h int, origin_top_left bool)
+fn C.sgl_viewportf(x f32, y f32, w f32, h f32, origin_top_left bool)
+fn C.sgl_scissor_rect(x int, y int, w int, h int, origin_top_left bool)
+fn C.sgl_scissor_rectf(x f32, y f32, w f32, h f32, origin_top_left bool)
+fn C.sgl_enable_texture()
+fn C.sgl_disable_texture()
+fn C.sgl_texture(img C.sg_image)
+
+// pipeline stack functions
+fn C.sgl_default_pipeline()
+fn C.sgl_load_pipeline(pip C.sgl_pipeline)
+fn C.sgl_push_pipeline()
+fn C.sgl_pop_pipeline()
+
+// matrix stack functions
+fn C.sgl_matrix_mode_modelview()
+fn C.sgl_matrix_mode_projection()
+fn C.sgl_matrix_mode_texture()
+fn C.sgl_load_identity()
+fn C.sgl_load_matrix(m [16]f32)
+fn C.sgl_load_transpose_matrix(m [16]f32)
+fn C.sgl_mult_matrix(m [16]f32)
+fn C.sgl_mult_transpose_matrix(m [16]f32)
+fn C.sgl_rotate(angle_rad f32, x f32, y f32, z f32)
+fn C.sgl_scale(x f32, y f32, z f32)
+fn C.sgl_translate(x f32, y f32, z f32)
+fn C.sgl_frustum(l f32, r f32, b f32, t f32, n f32, f f32)
+fn C.sgl_ortho(l f32, r f32, b f32, t f32, n f32, f f32)
+fn C.sgl_perspective(fov_y f32, aspect f32, z_near f32, z_far f32)
+fn C.sgl_lookat(eye_x f32, eye_y f32, eye_z f32, center_x f32, center_y f32, center_z f32, up_x f32, up_y f32, up_z f32)
+fn C.sgl_push_matrix()
+fn C.sgl_pop_matrix()
+
+// these functions only set the internal 'current texcoord / color' (valid inside or outside begin/end)
+fn C.sgl_t2f(u f32, v f32)
+fn C.sgl_c3f(r f32, g f32, b f32)
+fn C.sgl_c4f(r f32, g f32, b f32, a f32)
+fn C.sgl_c3b(r byte, g byte, b byte)
+fn C.sgl_c4b(r byte, g byte, b byte, a byte)
+fn C.sgl_c1i(rgba u32)
+
+// define primitives, each begin/end is one draw command
+fn C.sgl_begin_points()
+fn C.sgl_begin_lines()
+fn C.sgl_begin_line_strip()
+fn C.sgl_begin_triangles()
+fn C.sgl_begin_triangle_strip()
+fn C.sgl_begin_quads()
+fn C.sgl_v2f(x f32, y f32)
+fn C.sgl_v3f(x f32, y f32, z f32)
+fn C.sgl_v2f_t2f(x f32, y f32, u f32, v f32)
+fn C.sgl_v3f_t2f(x f32, y f32, z f32, u f32, v f32)
+fn C.sgl_v2f_c3f(x f32, y f32, r f32, g f32, b f32)
+fn C.sgl_v2f_c3b(x f32, y f32, r byte, g byte, b byte)
+fn C.sgl_v2f_c4f(x f32, y f32, r f32, g f32, b f32, a f32)
+fn C.sgl_v2f_c4b(x f32, y f32, r byte, g byte, b byte, a byte)
+fn C.sgl_v2f_c1i(x f32, y f32, rgba u32)
+fn C.sgl_v3f_c3f(x f32, y f32, z f32, r f32, g f32, b f32)
+fn C.sgl_v3f_c3b(x f32, y f32, z f32, r byte, g byte, b byte)
+fn C.sgl_v3f_c4f(x f32, y f32, z f32, r f32, g f32, b f32, a f32)
+fn C.sgl_v3f_c4b(x f32, y f32, z f32, r byte, g byte, b byte, a byte)
+fn C.sgl_v3f_c1i(x f32, y f32, z f32, rgba u32)
+fn C.sgl_v2f_t2f_c3f(x f32, y f32, u f32, v f32, r f32, g f32, b f32)
+fn C.sgl_v2f_t2f_c3b(x f32, y f32, u f32, v f32, r byte, g byte, b byte)
+fn C.sgl_v2f_t2f_c4f(x f32, y f32, u f32, v f32, r f32, g f32, b f32, a f32)
+fn C.sgl_v2f_t2f_c4b(x f32, y f32, u f32, v f32, r byte, g byte, b byte, a byte)
+fn C.sgl_v2f_t2f_c1i(x f32, y f32, u f32, v f32, rgba u32)
+fn C.sgl_v3f_t2f_c3f(x f32, y f32, z f32, u f32, v f32, r f32, g f32, b f32)
+fn C.sgl_v3f_t2f_c3b(x f32, y f32, z f32, u f32, v f32, r byte, g byte, b byte)
+fn C.sgl_v3f_t2f_c4f(x f32, y f32, z f32, u f32, v f32, r f32, g f32, b f32, a f32)
+fn C.sgl_v3f_t2f_c4b(x f32, y f32, z f32, u f32, v f32, r byte, g byte, b byte, a byte)
+fn C.sgl_v3f_t2f_c1i(x f32, y f32, z f32, u f32, v f32, rgba u32)
+fn C.sgl_end()
+
+// render everything
+fn C.sgl_draw()
diff --git a/v_windows/v/old/vlib/sokol/sgl/sgl_structs.v b/v_windows/v/old/vlib/sokol/sgl/sgl_structs.v
new file mode 100644
index 0000000..25753c4
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/sgl/sgl_structs.v
@@ -0,0 +1,24 @@
+module sgl
+
+// should be in a proper module
+pub enum SglError {
+ no_error
+ vertices_full
+ commands_full
+ stack_overflow
+ stack_underfloat
+}
+
+pub struct C.sgl_pipeline {
+ id u32
+}
+
+pub struct C.sgl_desc_t {
+ max_vertices int // size for vertex buffer
+ max_commands int // size of uniform- and command-buffers
+ pipeline_pool_size int // size of the internal pipeline pool, default is 64
+ color_format C.sg_pixel_format
+ depth_format C.sg_pixel_format
+ sample_count int
+ face_winding C.sg_face_winding // default front face winding is CCW
+}
diff --git a/v_windows/v/old/vlib/sokol/sokol.v b/v_windows/v/old/vlib/sokol/sokol.v
new file mode 100644
index 0000000..8c9a632
--- /dev/null
+++ b/v_windows/v/old/vlib/sokol/sokol.v
@@ -0,0 +1,19 @@
+module sokol
+
+import sokol.c
+import sokol.f
+
+pub const (
+ used_import = c.used_import + f.used_import
+)
+
+/*
+pub enum Key {
+ up=C.SAPP_KEYCODE_UP
+ left = C.SAPP_KEYCODE_LEFT
+ right =C.SAPP_KEYCODE_RIGHT
+ down = C.SAPP_KEYCODE_DOWN
+ escape = C.SAPP_KEYCODE_ESCAPE
+ space = C.SAPP_KEYCODE_SPACE
+}
+*/