Documentation ¶
Index ¶
- type Display
- func (d *Display) CreateCanvas(innerWidth, innerHeight int32, bg api.Background, borders render.Directions) (c render.Canvas, content render.Rectangle)
- func (d *Display) Destroy()
- func (d *Display) DrawImage(image render.Image, t render.Transform, alpha uint8)
- func (d *Display) FillRect(t render.Transform, color api.RGBA)
- func (d *Display) FreeImage(i *render.Image)
- func (d *Display) Init(owner app.App, events Events, fullscreen bool, port uint16, ...) error
- func (d *Display) LoadImageFile(location *url.URL, scaleDownToOutput bool) (render.Image, error)
- func (d *Display) LoadImageMem(data []byte, scaleDownToOutput bool) (render.Image, error)
- func (d *Display) OutputSize() render.Rectangle
- func (d *Display) RenderLoop() int
- func (d *Display) RenderText(text string, font api.Font) render.Image
- func (d *Display) StartRequest(eventID uint32, eventCode int32) (Request, server.Error)
- func (d *Display) Unit() int32
- type Events
- type KeyAction
- type Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Display ¶
Display describes a display rendering scenes.
func (*Display) CreateCanvas ¶
func (d *Display) CreateCanvas(innerWidth, innerHeight int32, bg api.Background, borders render.Directions) (c render.Canvas, content render.Rectangle)
CreateCanvas creates a canvas to draw content into, and fills it with the given background.
func (*Display) DrawImage ¶
DrawImage renders the given image if it is not empty, using the given transformation. alpha modifies the image's opacity.
func (*Display) FillRect ¶
FillRect fills the rectangle with the specified dimensions with the specified color. The rectangle is positions via the given transformation.
func (*Display) FreeImage ¶
FreeImage destroys the texture associated with the image (if one exists) and sets i to be the empty image. Does nothing on empty images.
func (*Display) Init ¶
func (d *Display) Init( owner app.App, events Events, fullscreen bool, port uint16, actions []KeyAction, window *sdl.Window, debug bool) error
Init initializes the display. The renderer and window need to be generated before since the app needs to load fonts based on the window size.
func (*Display) LoadImageFile ¶
LoadImageFile loads an image file from the specified path. if an error is returned, the returned image is empty.
func (*Display) LoadImageMem ¶
LoadImageMem loads an image from data in memory. if an error is returned, the returned image is empty.
func (*Display) OutputSize ¶
OutputSize returns a rectangle that describes the dimensions in pixels of the current rendering area. X and Y are always 0.
func (*Display) RenderLoop ¶
RenderLoop implements the rendering loop for the display. This function MUST be called in the main thread
func (*Display) RenderText ¶
RenderText renders the given text with the given font into an image with transparent background. Returns an empty image if it wasn't able to create the texture.
func (*Display) StartRequest ¶
StartRequest starts a new request to the display thread. Returns an error if there is already a pending request.
type Events ¶
type Events struct { // issued for updates to the module state via transitioning ModuleUpdateID uint32 // issued for updates of module configuration ModuleConfigID uint32 // issued when changing the current scene SceneChangeID uint32 // issued when the list of heroes is edited HeroesChangedID uint32 // issued when the user leaves the current group // (resets display to welcome screen) LeaveGroupID uint32 }
Events lists the event IDs used with SDL's UserEvent
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request is a pending message to the display thread. Successful generation of a request leads to exclusive access to the display's communication channel. A Request must be either committed or closed.
func (*Request) Close ¶
func (r *Request) Close()
Close closes the request. If the request has not been committed, the queued data will be erased. This function is idempotent.
func (*Request) SendEnabledModulesList ¶
SendEnabledModulesList queues the list of enabled modules as part of the request.
func (*Request) SendModuleConfig ¶
func (r *Request) SendModuleConfig(index shared.ModuleIndex, config interface{}) error
SendModuleConfig queues the given config for the module at the given ID as part of the request.
func (*Request) SendRendererData ¶
func (r *Request) SendRendererData(index shared.ModuleIndex, data interface{}) error
SendRendererData queues the given data for the module at the given ID as part of the request. Whether the data is used for RebuiltState or InitTransition depends on the event ID of the request.