1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/gg/gg.v

94 lines
2.7 KiB
V

// Copyright (c) 2019-2021 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license that can be found in the LICENSE file.
module gg
import gx
pub type FNCb = fn (data voidptr)
pub type FNEvent = fn (e &Event, data voidptr)
pub type FNFail = fn (msg string, data voidptr)
pub type FNKeyDown = fn (c KeyCode, m Modifier, data voidptr)
pub type FNKeyUp = fn (c KeyCode, m Modifier, data voidptr)
pub type FNMove = fn (x f32, y f32, data voidptr)
pub type FNClick = fn (x f32, y f32, button MouseButton, data voidptr)
pub type FNUnClick = fn (x f32, y f32, button MouseButton, data voidptr)
pub type FNChar = fn (c u32, data voidptr)
pub struct Config {
pub:
width int
height int
use_ortho bool // unused, still here just for backwards compatibility
retina bool
resizable bool
user_data voidptr
font_size int
create_window bool
// window_user_ptr voidptr
window_title string
borderless_window bool
always_on_top bool
bg_color gx.Color
init_fn FNCb = voidptr(0)
frame_fn FNCb = voidptr(0)
native_frame_fn FNCb = voidptr(0)
cleanup_fn FNCb = voidptr(0)
fail_fn FNFail = voidptr(0)
//
event_fn FNEvent = voidptr(0)
quit_fn FNEvent = voidptr(0)
//
keydown_fn FNKeyDown = voidptr(0)
keyup_fn FNKeyUp = voidptr(0)
char_fn FNChar = voidptr(0)
//
move_fn FNMove = voidptr(0)
click_fn FNClick = voidptr(0)
unclick_fn FNUnClick = voidptr(0)
leave_fn FNEvent = voidptr(0)
enter_fn FNEvent = voidptr(0)
resized_fn FNEvent = voidptr(0)
scroll_fn FNEvent = voidptr(0)
// wait_events bool // set this to true for UIs, to save power
fullscreen bool
scale f32 = 1.0
sample_count int
swap_interval int = 1 // 1 = 60fps, 2 = 30fps etc. The preferred swap interval (ignored on some platforms)
// ved needs this
// init_text bool
font_path string
custom_bold_font_path string
ui_mode bool // refreshes only on events to save CPU usage
// font bytes for embedding
font_bytes_normal []byte
font_bytes_bold []byte
font_bytes_mono []byte
font_bytes_italic []byte
native_rendering bool // Cocoa on macOS/iOS, GDI+ on Windows
// drag&drop
enable_dragndrop bool // enable file dropping (drag'n'drop), default is false
max_dropped_files int = 1 // max number of dropped files to process (default: 1)
max_dropped_file_path_length int = 2048 // max length in bytes of a dropped UTF-8 file path (default: 2048)
}
pub struct PenConfig {
color gx.Color
line_type PenLineType = .solid
thickness int = 1
}
pub struct Size {
pub:
width int
height int
}