| 1 | // Copyright (c) 2019-2024 Alexander Medvednikov. All rights reserved. |
| 2 | // Use of this source code is governed by an MIT license that can be found in the LICENSE file. |
| 3 | |
| 4 | module gg |
| 5 | |
| 6 | pub type FNCb = fn (data voidptr) |
| 7 | |
| 8 | // FNEvent defines the type of a function that will be called for every event |
| 9 | pub type FNEvent = fn (e &Event, data voidptr) |
| 10 | |
| 11 | // FNEvent2 same as FNEvent with inverted arguments TODO: deprecate this, in favor of event_fn |
| 12 | pub type FNEvent2 = fn (data voidptr, e &Event) |
| 13 | |
| 14 | // FNFail defines the type of a function that will be called when there is a fail |
| 15 | pub type FNFail = fn (msg string, data voidptr) |
| 16 | |
| 17 | // FNKeyDown defines the type of a function that will be called for every key pressed down |
| 18 | pub type FNKeyDown = fn (c KeyCode, m Modifier, data voidptr) |
| 19 | |
| 20 | // FNKeyUp defines the type of a function that will be called for every release of a pressed key |
| 21 | pub type FNKeyUp = fn (c KeyCode, m Modifier, data voidptr) |
| 22 | |
| 23 | // FNMove defines the type of a function that will be called for every mouse move on the screen |
| 24 | pub type FNMove = fn (x f32, y f32, data voidptr) |
| 25 | |
| 26 | // FNClick defines the type of a function that will be called for every mouse click |
| 27 | pub type FNClick = fn (x f32, y f32, button MouseButton, data voidptr) |
| 28 | |
| 29 | // FNUnClick defines the type of a function that will be called every time a mouse button is released |
| 30 | pub type FNUnClick = fn (x f32, y f32, button MouseButton, data voidptr) |
| 31 | |
| 32 | // FNChar defines the type of a function that will be called once per character |
| 33 | pub type FNChar = fn (c u32, data voidptr) |
| 34 | |
| 35 | // FNUpdate defines the type of a function, that will be called at the start of each frame |
| 36 | // with an argument `dt`, that has the passed time in seconds, since the previous update. |
| 37 | pub type FNUpdate = fn (dt f32, data voidptr) |
| 38 | |
| 39 | pub struct PenConfig { |
| 40 | pub: |
| 41 | color Color |
| 42 | line_type PenLineType = .solid |
| 43 | thickness f32 = 1 |
| 44 | } |
| 45 | |
| 46 | @[markused] |
| 47 | pub struct Size { |
| 48 | pub mut: |
| 49 | width int |
| 50 | height int |
| 51 | } |
| 52 | |