Difference between revisions of "Screen"

From GiderosMobile
Line 7: Line 7:
 
=== Description ===
 
=== Description ===
 
The '''Screen''' class allows to access secondary displays or windows.
 
The '''Screen''' class allows to access secondary displays or windows.
 +
 +
=== Example ===
 +
<source lang="lua">
 +
local s = Sprite.new()
 +
local img = Bitmap.new(Texture.new("gfx/ui/rpgpp_lt_models_vgood.png"))
 +
s:addChild(img)
 +
 +
local ss = Screen.new(0)
 +
ss:setPosition(128, 128)
 +
ss:setSize(256, 256)
 +
ss:setTitle("my screen")
 +
ss:setState(Screen.STATE_NORMAL | Screen.STATE_ACTIVE)
 +
ss:setContent(s)
 +
</source>
  
 
{|-
 
{|-

Revision as of 20:33, 14 March 2023

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
Available since: Gideros 2017.8
Inherits from: Object

Description

The Screen class allows to access secondary displays or windows.

Example

local s = Sprite.new()
local img = Bitmap.new(Texture.new("gfx/ui/rpgpp_lt_models_vgood.png"))
s:addChild(img)

local ss = Screen.new(0)
ss:setPosition(128, 128)
ss:setSize(256, 256)
ss:setTitle("my screen")
ss:setState(Screen.STATE_NORMAL | Screen.STATE_ACTIVE)
ss:setContent(s)

Methods

Screen.new opens a new screen
Screen:clear sets the screen background color
Screen:getId returns the screen id
Screen:getMaxSize returns the maximum size the screen can have
Screen:getPosition returns the screen position
Screen:getSize returns the screen size
Screen:getState returns the screen state
Screen:setContent sets the screen content
Screen:setPosition sets the screen position (when possible)
Screen:setSize sets the screen size (when possible)
Screen:setState sets the screen state (when possible)
Screen:setTitle sets the screen title

Events

Constants