PlatformInterface.go 2.0 KB

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