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
Raw Normal View History

// Copyright (c) 2019-2021 Alexander Medvednikov. All rights reserved.
2020-07-06 21:29:05 +03:00
// Use of this source code is governed by an MIT license that can be found in the LICENSE file.
2019-06-22 21:20:28 +03:00
module gg
import gx
2019-06-22 21:20:28 +03:00
pub type FNCb = fn (data voidptr)
pub type FNEvent = fn (e &Event, data voidptr)
pub type FNFail = fn (msg string, data voidptr)
2020-08-02 00:40:25 +03:00
pub type FNKeyDown = fn (c KeyCode, m Modifier, data voidptr)
2020-08-02 00:40:25 +03:00
pub type FNKeyUp = fn (c KeyCode, m Modifier, data voidptr)
2020-08-02 00:40:25 +03:00
pub type FNMove = fn (x f32, y f32, data voidptr)
2020-08-02 00:40:25 +03:00
pub type FNClick = fn (x f32, y f32, button MouseButton, data voidptr)
2020-09-21 03:42:28 +03:00
pub type FNUnClick = fn (x f32, y f32, button MouseButton, data voidptr)
pub type FNChar = fn (c u32, data voidptr)
2019-06-22 21:20:28 +03:00
pub struct Config {
2019-08-23 00:00:31 +03:00
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)
2020-11-21 02:04:29 +03:00
// 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
2020-08-02 00:40:25 +03:00
// init_text bool
2020-12-01 18:30:22 +03:00
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
2021-01-23 12:25:40 +03:00
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)
2019-06-22 21:20:28 +03:00
}
pub struct PenConfig {
color gx.Color
line_type PenLineType = .solid
thickness int = 1
}
2020-08-02 00:40:25 +03:00
pub struct Size {
pub:
width int
height int
}