View
Info
Dependencies:
- PermMem
- Interface
Implementation:
View.d on GitHub
This package can create textures on the screen and work with them in an extended manner.
Initialization
Initialize with LeGo_View
flag.
Functions
View_Create
View_Create
Creates a zCView
with virtual coordinates.
var int x1
/var int y1
Top-left corner coordinates (virtual)var int x2
/var int y2
Bottom-right corner coordinates (virtual)
Return value
The function returns a PermMem handle to a zCView
.
View_CreatePxl
View_CreatePxl
Alias for View_Create
using pixel coordinates.
var int x1
/var int y1
Top-left corner coordinates (pixel)var int x2
/var int y2
Bottom-right corner coordinates (pixel)
Return value
The function returns a PermMem handle to a zCView
.
View_CreateCenter
View_CreateCenter
Creates a zCView
with virtual coordinates centered.
var int x
Horizontal positionvar int y
Vertical positionvar int width
Width of the viewvar int height
Height of the view
Return value
The function returns a PermMem handle to a zCView
.
View_CreateCenterPxl
View_CreateCenterPxl
Alias for View_CreateCenter
using pixel coordinates.
var int x
Horizontal positionvar int y
Vertical positionvar int width
Width of the viewvar int height
Height of the view
Return value
The function returns a PermMem handle to a zCView
.
View_Get
View_GetPtr
View_Render
View_Render
Renders a zCView
. Should be used sparingly, as it works only in specific cases.
var int hndl
Handle created withView_Create
View_SetTexture
View_SetTexture
Assigns a texture to a view. The key function of this package.
var int hndl
Handle created withView_Create
var string texture
Filename of a texture
View_GetTexture
View_GetTexture
Gets the name of a previously assigned texture.
var int hndl
Handle created withView_Create
Return value
The function returns the previously assigned texture.
View_SetColor
View_SetColor
Sets the color of a view.
var int hndl
Handle created withView_Create
var int color
zColor, can be created with RGBA
View_GetColor
View_GetColor
Gets the color of a view.
var int hndl
Handle created withView_Create
Return value
The function returns the full zColor.
View_Open
View_Open
Opens a view. It will be displayed on the screen.
var int hndl
Handle created withView_Create
View_Close
View_Close
Closes a view. It disappears from the screen but can still be used.
var int hndl
Handle created withView_Create
View_Delete
View_Resize
View_Resize
Scales a view to a virtual size. The top-left position of the view remains fixed.
var int hndl
Handle created withView_Create
var int width
New width of the viewvar int height
New height of the view
View_ResizePxl
View_ResizePxl
Alias for View_Resize
using pixel coordinates.
var int hndl
Handle created withView_Create
var int width
New width of the viewvar int height
New height of the view
View_Move
View_Move
Moves the view by virtual units.
var int hndl
Handle created withView_Create
var int x
Shift left/rightvar int y
Shift up/down
View_MovePxl
View_MovePxl
Alias for View_Move
using pixel coordinates.
var int hndl
Handle created withView_Create
var int x
Shift left/rightvar int y
Shift up/down
View_MoveTo
View_MoveTo
Moves the top-left corner of the view to a virtual position.
var int hndl
Handle created withView_Create
var int x
New horizontal position (-1 for no change)var int y
New vertical position (-1 for no change)
View_MoveToPxl
View_MoveToPxl
Alias for View_MoveTo
using pixel coordinates.
var int hndl
Handle created withView_Create
var int x
New horizontal position (-1 for no change)var int y
New vertical position (-1 for no change)
View_AddText
View_AddText
Adds a text line to the view. The position is virtual and relative to the view's position. If the view is moved, the text moves as well.
var int hndl
Handle created withView_Create
var int x
Horizontal positionvar int y
Vertical positionvar string text
Added textvar string font
Used Font
View_DeleteText
View_DeleteText
Removes all text added with View_AddText
.
var int hndl
Handle created withView_Create
View_Top
Examples
Display a texture on the screen
Here a texture should be displayed over the entire screen:
This would mean that the texture would be permanently visible on the screen (even after loading/saving/restarting). If we want it to disappear we have to use either View_Delete
or View_Close
.
Display a texture with pixel coordinates
Now a texture should be displayed at the top right and be 256 x 256 pixels in size:
To get the size of the screen we use the interface package.