mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
sokol: upgrade to latest version, add program icon support (#11559)
* updated sokol_gfx.h to the last version: 16d7b2e * merged sokol_app and update enums.v * added missing icons structs * try to fixing Mac keyboard problems * added v patch marker to sokol_app.h * upgrade for sokol_gl.h, sokol_fontstash.h * manage sgl_load_default_pipeline * added load_default_pipeline() for sokol coherence * vfmt sapp_structs.c.v Co-authored-by: Delyan Angelov <delian66@gmail.com>
This commit is contained in:
@@ -18,6 +18,8 @@ pub enum EventType {
|
||||
resized
|
||||
iconified
|
||||
restored
|
||||
focused
|
||||
unfocused
|
||||
suspended
|
||||
resumed
|
||||
update_cursor
|
||||
@@ -39,6 +41,9 @@ pub enum Modifier {
|
||||
ctrl = 2 //(1<<1)
|
||||
alt = 4 //(1<<2)
|
||||
super = 8 //(1<<3)
|
||||
lmb = 0x100
|
||||
rmb = 0x200
|
||||
mmb = 0x400
|
||||
}
|
||||
|
||||
pub enum KeyCode {
|
||||
|
@@ -1,5 +1,30 @@
|
||||
module sapp
|
||||
|
||||
const (
|
||||
sapp_max_touchpoints = 8
|
||||
sapp_max_mousebuttons = 3
|
||||
sapp_max_keycodes = 512
|
||||
sapp_max_iconimages = 8
|
||||
)
|
||||
|
||||
pub struct C.sapp_range {
|
||||
pub:
|
||||
ptr voidptr
|
||||
size usize
|
||||
}
|
||||
|
||||
pub struct C.sapp_image_desc {
|
||||
pub:
|
||||
width int
|
||||
height int
|
||||
pixels C.spp_range
|
||||
}
|
||||
|
||||
pub struct C.sapp_icon_desc {
|
||||
sokol_default bool
|
||||
images [sapp_max_iconimages]C.sapp_image_desc
|
||||
}
|
||||
|
||||
pub struct C.sapp_desc {
|
||||
pub:
|
||||
init_cb fn () // these are the user-provided callbacks without user data
|
||||
@@ -29,6 +54,7 @@ pub:
|
||||
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)
|
||||
icon C.sapp_icon_desc
|
||||
// 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
|
||||
@@ -60,7 +86,7 @@ pub:
|
||||
scroll_x f32
|
||||
scroll_y f32
|
||||
num_touches int
|
||||
touches [8]C.sapp_touchpoint
|
||||
touches [sapp_max_touchpoints]C.sapp_touchpoint
|
||||
window_width int
|
||||
window_height int
|
||||
framebuffer_width int
|
||||
@@ -83,7 +109,7 @@ pub:
|
||||
scroll_x f32
|
||||
scroll_y f32
|
||||
num_touches int
|
||||
touches [8]C.sapp_touchpoint
|
||||
touches [sapp_max_touchpoints]C.sapp_touchpoint
|
||||
window_width int
|
||||
window_height int
|
||||
framebuffer_width int
|
||||
|
@@ -75,9 +75,14 @@ pub fn texture(img C.sg_image) {
|
||||
}
|
||||
|
||||
// pipeline stack functions
|
||||
[inline]
|
||||
pub fn load_default_pipeline() {
|
||||
C.sgl_load_default_pipeline()
|
||||
}
|
||||
|
||||
[inline]
|
||||
pub fn default_pipeline() {
|
||||
C.sgl_default_pipeline()
|
||||
C.sgl_load_default_pipeline()
|
||||
}
|
||||
|
||||
[inline]
|
||||
|
@@ -22,7 +22,7 @@ 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_default_pipeline()
|
||||
fn C.sgl_load_pipeline(pip C.sgl_pipeline)
|
||||
fn C.sgl_push_pipeline()
|
||||
fn C.sgl_pop_pipeline()
|
||||
|
Reference in New Issue
Block a user