Documentation ¶
Overview ¶
Package video takes care on the game display. It also creates the window using GLFW. It exports the Refresh callback used by the libretro implementation.
Index ¶
- func NewImage(file string) uint32
- func XYWHTo4points(x, y, w, h, fbh float32) (x1, y1, x2, y2, x3, y3, x4, y4 float32)
- type Color
- type Video
- func (video *Video) Configure(fullscreen bool)
- func (video *Video) DrawBorder(x, y, w, h, borderWidth float32, c Color)
- func (video *Video) DrawCircle(x, y, r float32, c Color)
- func (video *Video) DrawImage(image uint32, x, y, w, h float32, scale float32, c Color)
- func (video *Video) DrawRect(x, y, w, h, r float32, c Color)
- func (video *Video) Reconfigure(fullscreen bool)
- func (video *Video) Refresh(data unsafe.Pointer, width int32, height int32, pitch int32)
- func (video *Video) Render()
- func (video *Video) ResetPitch()
- func (video *Video) ResetRot()
- func (video *Video) ResizeViewport()
- func (video *Video) ScissorEnd()
- func (video *Video) ScissorStart(x, y, w, h int32)
- func (video *Video) SetPixelFormat(format uint32) bool
- func (video *Video) SetRotation(rot uint) bool
- func (video *Video) TakeScreenshot(name string) error
- func (video *Video) UpdateFilter(filter string)
- type WindowInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func XYWHTo4points ¶
XYWHTo4points converts coordinates from (x, y, width, height) to (x1, y1, x2, y2, x3, y3, x4, y4)
Types ¶
type Video ¶
type Video struct { Window WindowInterface Geom libretro.GameGeometry Font *glfont.Font // contains filtered or unexported fields }
Video holds the state of the video package
func (*Video) DrawBorder ¶
DrawBorder draws a colored rectangle border
func (*Video) DrawCircle ¶
DrawCircle draws a circle
func (*Video) Reconfigure ¶
Reconfigure destroys and recreates the window with new attributes
func (*Video) ResetPitch ¶ added in v0.7.1
func (video *Video) ResetPitch()
ResetPitch should be called when unloading a game so that the next game won't be rendered with the wrong pitch
func (*Video) ResetRot ¶ added in v0.10.3
func (video *Video) ResetRot()
ResetRot should be called when unloading a game so that the next game won't be rendered with the wrong rotation
func (*Video) ResizeViewport ¶ added in v0.5.0
func (video *Video) ResizeViewport()
ResizeViewport resizes the GL viewport to the framebuffer size
func (*Video) ScissorEnd ¶ added in v0.8.6
func (video *Video) ScissorEnd()
ScissorEnd closes a GL scissor box
func (*Video) ScissorStart ¶ added in v0.8.6
ScissorStart starts a GL scissor box, don't forget to call ScissorEnd
func (*Video) SetPixelFormat ¶
SetPixelFormat is a callback passed to the libretro implementation. It allows the core or the game to tell us which pixel format should be used for the display.
func (*Video) SetRotation ¶ added in v0.10.3
SetRotation rotates the game image as requested by the core
func (*Video) TakeScreenshot ¶
TakeScreenshot captures the ouput of video.Render and writes it to a file
func (*Video) UpdateFilter ¶ added in v0.5.2
UpdateFilter configures the game texture filter and shader. We currently support 4 modes: Raw: nearest Smooth: linear Pixel Perfect: sharp-bilinear CRT: zfast-crt
type WindowInterface ¶
type WindowInterface interface { GetFramebufferSize() (width, height int) Destroy() MakeContextCurrent() SetSizeLimits(minw, minh, maxw, maxh int) SetInputMode(mode glfw.InputMode, value int) GetKey(key glfw.Key) glfw.Action SetShouldClose(bool) ShouldClose() bool SetTitle(string) SwapBuffers() }
WindowInterface lists all the methods from glfw.Window that we are using. It is there only to allow mocking during tests.