gg #

fn new_context #

fn new_context(cfg Config) &Context

fn screen_size #

fn screen_size() Size

fn system_font_path #

fn system_font_path() string

type FNCb #

type FNCb = fn (x voidptr)

import time

type FNChar #

type FNChar = fn (c u32, x voidptr)

type FNEvent #

type FNEvent = fn (e voidptr, x voidptr)

type FNFail #

type FNFail = fn (msg string, x voidptr)

type FNKeyDown #

type FNKeyDown = fn (c sapp.KeyCode, m sapp.Modifier, x voidptr)

type FNMove #

type FNMove = fn (x f32, y f32, z voidptr)

fn (FT) flush #

fn (ft &FT) flush()

struct Config #

struct Config {
pub:
	width         int
	height        int
	use_ortho     bool
	retina        bool
	resizable     bool
	user_data     voidptr
	font_size     int
	create_window bool
	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)
	keydown_fn        FNKeyDown = voidptr(0)
	char_fn FNChar = voidptr(0)
	move_fn FNMove = voidptr(0)
	click_fn FNMove = voidptr(0)
	fullscreen   bool
	scale        f32 = 1.0
	sample_count int
	font_path             string
	custom_bold_font_path string
	ui_mode               bool
	font_bytes_normal []byte
	font_bytes_bold   []byte
	font_bytes_mono   []byte
	font_bytes_italic []byte
	native_rendering  bool
}

struct Context #

struct Context {
	render_text bool
mut:
	image_cache   []Image
	needs_refresh bool = true
	ticks         int
pub:
	native_rendering bool
pub mut:
	scale f32 = 1.0
	width       int
	height      int
	clear_pass  C.sg_pass_action
	window      C.sapp_desc
	timage_pip  C.sgl_pipeline
	config      Config
	ft          &FT
	font_inited bool
	ui_mode     bool
}

fn (Context) begin #

fn (gg &Context) begin()

fn (Context) create_image #

fn (mut ctx Context) create_image(file string) Image

fn (Context) create_image_from_byte_array #

fn (mut ctx Context) create_image_from_byte_array(b []byte) Image

fn (Context) create_image_from_memory #

fn (mut ctx Context) create_image_from_memory(buf byteptr, bufsize int) Image

fn (Context) create_image_with_size #

fn (mut ctx Context) create_image_with_size(file string, width int, height int) Image

TODO copypasta

fn (Context) draw_arc #

fn (ctx &Context) draw_arc(x f32, y f32, r int, start_angle f32, arc_angle f32, segments int, c gx.Color)

fn (Context) draw_arc_line #

fn (ctx &Context) draw_arc_line(x f32, y f32, r int, start_angle f32, arc_angle f32, segments int, c gx.Color)

fn (Context) draw_circle #

fn (ctx &Context) draw_circle(x f32, y f32, r f32, c gx.Color)

fn (Context) draw_circle_line #

fn (ctx &Context) draw_circle_line(x f32, y f32, r int, segments int, c gx.Color)

fn (Context) draw_circle_with_segments #

fn (ctx &Context) draw_circle_with_segments(x f32, y f32, r f32, segments int, c gx.Color)

fn (Context) draw_empty_rect #

fn (ctx &Context) draw_empty_rect(x f32, y f32, w f32, h f32, c gx.Color)

fn (Context) draw_empty_rounded_rect #

fn (ctx &Context) draw_empty_rounded_rect(x f32, y f32, w f32, h f32, radius f32, border_color gx.Color)

fn (Context) draw_empty_square #

fn (ctx &Context) draw_empty_square(x f32, y f32, s f32, c gx.Color)

fn (Context) draw_image #

fn (ctx &Context) draw_image(x f32, y f32, width f32, height f32, img_ &Image)

fn (Context) draw_image_3d #

fn (ctx &Context) draw_image_3d(x f32, y f32, z f32, width f32, height f32, img_ &Image)

fn (Context) draw_image_by_id #

fn (ctx &Context) draw_image_by_id(x f32, y f32, width f32, height f32, id int)

fn (Context) draw_image_flipped #

fn (ctx &Context) draw_image_flipped(x f32, y f32, width f32, height f32, img_ &Image)

TODO remove copy pasta, merge the functions

fn (Context) draw_line #

fn (ctx &Context) draw_line(x f32, y f32, x2 f32, y2 f32, c gx.Color)

fn (Context) draw_rect #

fn (ctx &Context) draw_rect(x f32, y f32, w f32, h f32, c gx.Color)

TODO: Fix alpha

fn (Context) draw_rounded_rect #

fn (ctx &Context) draw_rounded_rect(x f32, y f32, w f32, h f32, radius f32, color gx.Color)

fn (Context) draw_square #

fn (ctx &Context) draw_square(x f32, y f32, s f32, c gx.Color)

fn (Context) draw_text #

fn (ctx &Context) draw_text(x int, y int, text_ string, cfg gx.TextCfg)

fn (Context) draw_text_def #

fn (ctx &Context) draw_text_def(x int, y int, text string)

fn (Context) draw_triangle #

fn (ctx &Context) draw_triangle(x f32, y f32, x2 f32, y2 f32, x3 f32, y3 f32, c gx.Color)

fn (Context) end #

fn (gg &Context) end()

fn (Context) refresh_ui #

fn (mut ctx Context) refresh_ui()

fn (Context) resize #

fn (mut ctx Context) resize(width int, height int)

fn (Context) run #

fn (gg &Context) run()

fn (Context) set_bg_color #

fn (mut ctx Context) set_bg_color(c gx.Color)

fn (Context) set_pixel #

fn (ctx &Context) set_pixel(x f32, y f32, c gx.Color)

fn (Context) text_height #

fn (ctx &Context) text_height(s string) int

fn (Context) text_size #

fn (ctx &Context) text_size(s string) (int, int)

fn (Context) text_width #

fn (ctx &Context) text_width(s string) int

struct Image #

struct Image {
pub mut:
	id          int
	width       int
	height      int
	nr_channels int
	ok          bool
	data        voidptr
	ext         string
	simg_ok     bool
	simg        C.sg_image
	path        string
}

fn (Image) init_sokol_image #

fn (mut img Image) init_sokol_image() &Image

struct Size #

struct Size {
pub:
	width  int
	height int
}