Documentation ¶
Overview ¶
The window Pacakge creates and manages the window and gl context.
Index ¶
- func Close(should_close bool)
- func Delegate(event *sdl.WindowEvent)
- func Destroy()
- func FromPixels(x float32) float32
- func FromPixelsPoint(x, y float32) (float32, float32)
- func GetDesktopDimensions(displayindex int) (int32, int32)
- func GetDisplayCount() int
- func GetDisplayName(displayindex int) string
- func GetDrawableSize() (int32, int32)
- func GetFullscreenSizes(displayindex int) [][]int32
- func GetIcon() string
- func GetMousePosition() (float32, float32)
- func GetMouseVisible() bool
- func GetPixelDimensions() (int32, int32)
- func GetPixelScale() float32
- func GetPosition() (int, int)
- func GetTitle() string
- func HasFocus() bool
- func HasMouseFocus() bool
- func IsMouseGrabbed() bool
- func IsOpen() bool
- func IsVisible() bool
- func Maximize()
- func Minimize()
- func NewWindow() (*window, error)
- func PixelToWindowCoords(x, y float32) (float32, float32)
- func RequestAttention(continuous bool)
- func SetIcon(path string) error
- func SetMinimumSize(w, h int32)
- func SetMouseGrab(grabbed bool)
- func SetMousePosition(x, y float32)
- func SetMouseVisible(visible bool)
- func SetPosition(x, y int32)
- func SetTitle(title string)
- func ShouldClose() bool
- func ShowMessageBox(title, message string, buttons []string, box_type MessageBoxType, ...) string
- func ShowSimpleMessageBox(title, message string, box_type MessageBoxType, attachtowindow bool) error
- func SwapBuffers()
- func ToPixels(x float32) float32
- func ToPixelsPoint(x, y float32) (float32, float32)
- func WindowToPixelCoords(x, y float32) (float32, float32)
- type MessageBoxType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delegate ¶
func Delegate(event *sdl.WindowEvent)
Delegate is used by amore/event to pass events to the window package. It may also be useful to stub or fake events
func Destroy ¶
func Destroy()
Destroy cleans up after the window has been closed. This is normally used by the game loop after the game loop has been stopped.
func FromPixels ¶
FromPixels will convert from pixel units to window units
func FromPixelsPoint ¶
FromPixelsPoint will convert a point from pixels to window units
func GetDesktopDimensions ¶
GetDesktopDimensions gets the dimensions of a display for the given index
func GetDisplayName ¶
GetDisplayName gets the display name given an index
func GetDrawableSize ¶
GetDrawableSize gets the size of pixels in view
func GetFullscreenSizes ¶
GetFullscreenSizes gets the size of the screen for the display index
func GetMousePosition ¶
GetMousePosition return the current position of the mouse
func GetMouseVisible ¶
func GetMouseVisible() bool
GetMouseVisible will return true if the mouse is not hidden and will return false otherwise
func GetPixelDimensions ¶
GetPixelDimensions will return the size of the window in pixels
func GetPixelScale ¶
func GetPixelScale() float32
GetPixelScale will return ratio of pixels in the window
func GetPosition ¶
GetPosition will return the position of the window on the screen
func HasFocus ¶
func HasFocus() bool
HasFocus will return true if the user has the program focused and return false if the user is focused on another program
func HasMouseFocus ¶
func HasMouseFocus() bool
HasMouseFocus will return true if the user has clicked on the application and has it focues. It will return false otherwise.
func IsMouseGrabbed ¶
func IsMouseGrabbed() bool
IsMouseGrabbed returns true if pointer lock is enabled and false otherwise
func IsOpen ¶
func IsOpen() bool
IsOpen will return true if the window and been initialized. It will return false if it has not.
func NewWindow ¶
func NewWindow() (*window, error)
NewWindow will create a new sdl window with a gl context. It will also destroy an old one if there is one already. Errors returned come straight from SDL so errors will be indicitive of SDL errors
func PixelToWindowCoords ¶
PixelToWindowCoords translates pixel coords to window coords
func RequestAttention ¶
func RequestAttention(continuous bool)
RequestAttention makes the application flash for attention to the user. If continuous is true, it will continue to do so until the user focuses the program.
func SetIcon ¶
SetIcon sets the small icon on the display bar as well as the large icon on the task bar and icon on the dock in osx
func SetMinimumSize ¶
func SetMinimumSize(w, h int32)
SetMinimumSize sets the minimim size on the window when resizable
func SetMouseGrab ¶
func SetMouseGrab(grabbed bool)
SetMouseGrab enables or disables pointer lock on the window
func SetMousePosition ¶
func SetMousePosition(x, y float32)
SetMousePosition warps the mouse position to a new position x, y in the window
func SetMouseVisible ¶
func SetMouseVisible(visible bool)
SetMouseVisible will hide the mouse if passed false, and show the mouse cursor if passed true
func SetTitle ¶
func SetTitle(title string)
SetTitle sets the title of the window displayed on the display bar and task bar
func ShouldClose ¶
func ShouldClose() bool
ShouldClose returns if the window has beed told to close and is in the process of shutting down
func ShowMessageBox ¶
func ShowMessageBox(title, message string, buttons []string, box_type MessageBoxType, attachtowindow bool) string
ShowMessageBox will present a message box at the top of the screen. if attached to the window it will be attached to the top bar. the box type will style the message box and icon. The first button will be the primary enter action, and the last button will be the escape/cancel action
func ShowSimpleMessageBox ¶
func ShowSimpleMessageBox(title, message string, box_type MessageBoxType, attachtowindow bool) error
ShowSimpleMessageBox will present a confirm style message box at the top of the screen. if attached to the window it will be attached to the top bar. the box type will style the message box and icon
func SwapBuffers ¶
func SwapBuffers()
SwapBuffers swaps the current frame buffer in the window. This is generally only used by the engine but you could use it to roll your own game loop.
func ToPixelsPoint ¶
ToPixelsPoint will convert window point to pixel point
func WindowToPixelCoords ¶
WindowToPixelCoords translates window coords to pixel coords for pixel perfect operations
Types ¶
type MessageBoxType ¶
type MessageBoxType uint32
MessageBoxType specifies the types of Message box to create
const ( MESSAGEBOX_ERROR MessageBoxType = sdl.MESSAGEBOX_ERROR MESSAGEBOX_WARNING MessageBoxType = sdl.MESSAGEBOX_WARNING MESSAGEBOX_INFO MessageBoxType = sdl.MESSAGEBOX_INFORMATION )