sdlbackend

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	SDLTrue  = SDLWindowFlags(1)
	SDLFalse = SDLWindowFlags(0)
)

SDL bool values

View Source
const (
	SDLWindowFlagsNone              = SDLWindowFlags(0) // Clear all flags
	SDLWindowFlagsFullScreen        = SDLWindowFlags(C.SDL_WINDOW_FULLSCREEN)
	SDLWindowFlagsOpengl            = SDLWindowFlags(C.SDL_WINDOW_OPENGL)
	SDLWindowFlagsDecorated         = SDLWindowFlags(C.SDL_WINDOW_SHOWN)
	SDLWindowFlagsTransparent       = SDLWindowFlags(C.SDL_WINDOW_HIDDEN)
	SDLWindowFlagsVisible           = SDLWindowFlags(C.SDL_WINDOW_BORDERLESS)
	SDLWindowFlagsResizable         = SDLWindowFlags(C.SDL_WINDOW_RESIZABLE)
	SDLWindowFlagsMinimized         = SDLWindowFlags(C.SDL_WINDOW_MINIMIZED)
	SDLWindowFlagsMaximized         = SDLWindowFlags(C.SDL_WINDOW_MAXIMIZED)
	SDLWindowFlagsMouseGrabbed      = SDLWindowFlags(C.SDL_WINDOW_MOUSE_GRABBED)
	SDLWindowFlagsInputFocus        = SDLWindowFlags(C.SDL_WINDOW_INPUT_FOCUS)
	SDLWindowFlagsMouseFocus        = SDLWindowFlags(C.SDL_WINDOW_MOUSE_FOCUS)
	SDLWindowFlagsFullscreenDesktop = SDLWindowFlags(C.SDL_WINDOW_FULLSCREEN_DESKTOP)
	SDLWindowFlagsWindowForeign     = SDLWindowFlags(C.SDL_WINDOW_FOREIGN)
	SDLWindowFlagsAllowHighDPI      = SDLWindowFlags(C.SDL_WINDOW_ALLOW_HIGHDPI)
	SDLWindowFlagsMouseCapture      = SDLWindowFlags(C.SDL_WINDOW_MOUSE_CAPTURE)
	SDLWindowFlagsAlwaysOnTop       = SDLWindowFlags(C.SDL_WINDOW_ALWAYS_ON_TOP)
	SDLWindowFlagsSkipTaskbar       = SDLWindowFlags(C.SDL_WINDOW_SKIP_TASKBAR)
	SDLWindowFlagsUtility           = SDLWindowFlags(C.SDL_WINDOW_UTILITY)
	SDLWindowFlagsTooltip           = SDLWindowFlags(C.SDL_WINDOW_TOOLTIP)
	SDLWindowFlagsPopupMenu         = SDLWindowFlags(C.SDL_WINDOW_POPUP_MENU)
	SDLWindowFlagsKeyboardGrabbed   = SDLWindowFlags(C.SDL_WINDOW_KEYBOARD_GRABBED)
	SDLWindowFlagsWindowVulkan      = SDLWindowFlags(C.SDL_WINDOW_VULKAN)
	SDLWindowFlagsWindowMetal       = SDLWindowFlags(C.SDL_WINDOW_METAL)
)

Window flags

View Source
const (
	SDLSwapIntervalImmediate    = SDLWindowFlags(0)
	SDLSwapIntervalVsync        = SDLWindowFlags(1)
	SDLSwapIntervalAdaptiveSync = SDLWindowFlags(-1)
)

Swap interval flags

View Source
const (
	SDLInputModeRelativeMouse = SDLWindowFlags(iota)
	SDLInputModeGrab
)

Input mode flags

Variables

This section is empty.

Functions

func SDLGetError

func SDLGetError() string

Types

type SDLBackend

type SDLBackend struct {
	// contains filtered or unexported fields
}

func NewSDLBackend

func NewSDLBackend() *SDLBackend

func (*SDLBackend) AfterCreateHook

func (b *SDLBackend) AfterCreateHook() func()

func (*SDLBackend) AfterRenderHook

func (b *SDLBackend) AfterRenderHook() func()

func (*SDLBackend) BeforeDestroyHook

func (b *SDLBackend) BeforeDestroyHook() func()

func (*SDLBackend) BeforeRenderHook

func (b *SDLBackend) BeforeRenderHook() func()

func (*SDLBackend) CloseCallback

func (b *SDLBackend) CloseCallback() func(wnd unsafe.Pointer)

func (*SDLBackend) ContentScale

func (b *SDLBackend) ContentScale() (width, height float32)

func (*SDLBackend) CreateTexture

func (b *SDLBackend) CreateTexture(pixels unsafe.Pointer, width, height int) imgui.TextureID

func (*SDLBackend) CreateTextureRgba

func (b *SDLBackend) CreateTextureRgba(img *image.RGBA, width, height int) imgui.TextureID

func (*SDLBackend) CreateWindow

func (b *SDLBackend) CreateWindow(title string, width, height int)

func (*SDLBackend) DeleteTexture

func (b *SDLBackend) DeleteTexture(id imgui.TextureID)

func (*SDLBackend) DisplaySize

func (b *SDLBackend) DisplaySize() (width int32, height int32)

func (*SDLBackend) DropCallback

func (b *SDLBackend) DropCallback() backend.DropCallback

func (*SDLBackend) GetWindowPos

func (b *SDLBackend) GetWindowPos() (x, y int32)

func (*SDLBackend) KeyCallback

func (b *SDLBackend) KeyCallback() backend.KeyCallback

func (*SDLBackend) LoopFunc

func (b *SDLBackend) LoopFunc() func()

func (*SDLBackend) Refresh

func (b *SDLBackend) Refresh()

func (*SDLBackend) Run

func (b *SDLBackend) Run(loop func())

func (*SDLBackend) SetAfterCreateContextHook

func (b *SDLBackend) SetAfterCreateContextHook(hook func())

func (*SDLBackend) SetAfterRenderHook

func (b *SDLBackend) SetAfterRenderHook(hook func())

func (*SDLBackend) SetBeforeDestroyContextHook

func (b *SDLBackend) SetBeforeDestroyContextHook(hook func())

func (*SDLBackend) SetBeforeRenderHook

func (b *SDLBackend) SetBeforeRenderHook(hook func())

func (*SDLBackend) SetBgColor

func (b *SDLBackend) SetBgColor(color imgui.Vec4)

func (*SDLBackend) SetCloseCallback

func (b *SDLBackend) SetCloseCallback(cbfun backend.WindowCloseCallback[SDLWindowFlags])

func (*SDLBackend) SetCursorPos

func (b *SDLBackend) SetCursorPos(x, y float64)

the SDL backend gives mouse positions in global coordinates, so to make it possible to "lock" the mouse in one place, SetCursorPos will set the mouse in global coordinates

func (*SDLBackend) SetDropCallback

func (b *SDLBackend) SetDropCallback(cbfun backend.DropCallback)

SetDropCallback sets the drop callback which is called when an object is dropped over the window.

func (*SDLBackend) SetIcons

func (b *SDLBackend) SetIcons(images ...image.Image)

SetIcons sets icons for the window. THIS CODE COMES FROM https://github.com/go-gl/glfw (BSD-3 clause) - Copyright (c) 2012 The glfw3-go Authors. All rights reserved.

func (*SDLBackend) SetInputMode

func (b *SDLBackend) SetInputMode(mode SDLWindowFlags, value SDLWindowFlags)

func (*SDLBackend) SetKeyCallback

func (b *SDLBackend) SetKeyCallback(cbfun backend.KeyCallback)

func (*SDLBackend) SetShouldClose

func (b *SDLBackend) SetShouldClose(value bool)

func (*SDLBackend) SetSizeChangeCallback

func (b *SDLBackend) SetSizeChangeCallback(cbfun backend.SizeChangeCallback)

func (*SDLBackend) SetSwapInterval

func (b *SDLBackend) SetSwapInterval(interval SDLWindowFlags) error

func (*SDLBackend) SetTargetFPS

func (b *SDLBackend) SetTargetFPS(fps uint)

func (*SDLBackend) SetWindowFlags

func (b *SDLBackend) SetWindowFlags(flag SDLWindowFlags, value int)

SetWindowHint applies to next CreateWindow call so use it before CreateWindow call ;-) default applied flags: SDLWindowFlagsOpengl | SDLWindowFlagsResizable | SDLWindowFlagsAllowHighDPI set flag if value is 1, clear flag if value is 0

func (*SDLBackend) SetWindowPos

func (b *SDLBackend) SetWindowPos(x, y int)

func (*SDLBackend) SetWindowSize

func (b *SDLBackend) SetWindowSize(width, height int)

func (*SDLBackend) SetWindowSizeLimits

func (b *SDLBackend) SetWindowSizeLimits(minWidth, minHeight, maxWidth, maxHeight int)

The minimum and maximum size of the content area of a windowed mode window. To specify only a minimum size or only a maximum one, set the other pair to -1 e.g. SetWindowSizeLimits(640, 480, -1, -1)

func (*SDLBackend) SetWindowTitle

func (b *SDLBackend) SetWindowTitle(title string)

func (*SDLBackend) SizeCallback

func (b *SDLBackend) SizeCallback() backend.SizeChangeCallback

type SDLWindowFlags

type SDLWindowFlags int

Jump to

Keyboard shortcuts

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