forked from HACKERALERT/imgui-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlatformInterface.go
77 lines (53 loc) · 1.92 KB
/
PlatformInterface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package imgui
import (
"image"
"github.com/Picocrypt/glfw/v3.3/glfw"
)
type Platform interface {
// ShouldStop is regularly called as the abort condition for the program loop.
ShouldStop() bool
// SetShouldStop sets whether window should be closed
SetShouldStop(bool)
// ProcessEvents is called once per render loop to dispatch any pending events.
ProcessEvents()
// DisplaySize returns the dimension of the display.
DisplaySize() [2]float32
// FramebufferSize returns the dimension of the framebuffer.
FramebufferSize() [2]float32
// NewFrame marks the begin of a render pass. It must update the imgui IO state according to user input (mouse, keyboard, ...)
NewFrame()
// PostRender marks the completion of one render pass. Typically this causes the display buffer to be swapped.
PostRender()
// Dispose
Dispose()
// Set size change callback
SetSizeChangeCallback(func(width, height int))
// Set pos change callback
SetPosChangeCallback(func(x, y int))
// Set drop callback
SetDropCallback(func(names []string))
// Set input callback
SetInputCallback(func(key glfw.Key, mods glfw.ModifierKey, action glfw.Action))
// Set close callback, returned value will be used to close or cancel the window
SetCloseCallback(func() bool)
// Force Update
Update()
// GetContentScale function retrieves the content scale for the specified monitor.
GetContentScale() float32
// Get content from system clipboard
GetClipboard() string
// Set content to system clipboard
SetClipboard(content string)
// Get the event pulling ticks per second
GetTPS() int
// Set the event pulling ticks per second
SetTPS(tps int)
// Set icon to master window
SetIcon(icons []image.Image)
// SetSizeLimits sets the size limits of the client area of the specified window.
SetSizeLimits(minw, minh, maxw, maxh int)
// SetTitle sets the title of platform window.
SetTitle(title string)
// Get window position
GetPos() (x, y int)
}