window

package
Version: v0.0.0-...-7296e18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

The window Pacakge creates and manages the window and gl context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(should_close bool)

Close prepares the window to shut down gracefully

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

func FromPixels(x float32) float32

FromPixels will convert from pixel units to window units

func FromPixelsPoint

func FromPixelsPoint(x, y float32) (float32, float32)

FromPixelsPoint will convert a point from pixels to window units

func GetDesktopDimensions

func GetDesktopDimensions(displayindex int) (int32, int32)

GetDesktopDimensions gets the dimensions of a display for the given index

func GetDisplayCount

func GetDisplayCount() int

GetDisplayCount gets the count of displays

func GetDisplayName

func GetDisplayName(displayindex int) string

GetDisplayName gets the display name given an index

func GetDrawableSize

func GetDrawableSize() (int32, int32)

GetDrawableSize gets the size of pixels in view

func GetFullscreenSizes

func GetFullscreenSizes(displayindex int) [][]int32

GetFullscreenSizes gets the size of the screen for the display index

func GetIcon

func GetIcon() string

GetIcon returns the path to the currently set icon

func GetMousePosition

func GetMousePosition() (float32, float32)

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

func GetPixelDimensions() (int32, int32)

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

func GetPosition() (int, int)

GetPosition will return the position of the window on the screen

func GetTitle

func GetTitle() string

GetTitle gets the current title of the window

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 IsVisible

func IsVisible() bool

IsVisible returns true if the window is not minimized

func Maximize

func Maximize()

Maximize unhides the program and sets it to max size

func Minimize

func Minimize()

Minimize hides the program in the task bar

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

func PixelToWindowCoords(x, y float32) (float32, float32)

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

func SetIcon(path string) error

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 SetPosition

func SetPosition(x, y int32)

SetPosition will set the window position on screen

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 ToPixels

func ToPixels(x float32) float32

ToPixels will convert window unit to pixel unit

func ToPixelsPoint

func ToPixelsPoint(x, y float32) (float32, float32)

ToPixelsPoint will convert window point to pixel point

func WindowToPixelCoords

func WindowToPixelCoords(x, y float32) (float32, float32)

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
)

Directories

Path Synopsis
A simple package meant to load sdl surfaces without sdl_image.
A simple package meant to load sdl surfaces without sdl_image.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL