PeoteView represents the main "view" that must be called in a Lime application at startup to initialize the OpenGL-context and the onRender and onResize events.
It contains a list of Display areas and the entire view can be moved and zoomed.

Constructor

@:value({ registerEvents : true, color : 0x000000FF })new(window:Window, color:Color = 0x000000FF, registerEvents:Bool = true)

Creates a new PeoteView instance.

Parameters:

window

the window property of the Lime Application

color

background color

registerEvents

automatically adds its onRender and onResize events to the Lime window

Variables

read onlywindow:Window

Correspond to the window property of the Lime Application

read onlygl:PeoteGL

Wrapper around the OpenGL-context (ES2/3) of the Lime Application

read onlywidth:Int

Should always correspond to the width of the window

read onlyheight:Int

Should always correspond to the height of the window

@:value(0x000000FF)color:Color = 0x000000FF

Background color.

@:value(0)xOffset:Float = 0

To shift the render content horizontal.

@:value(0)yOffset:Float = 0

To shift the render content vertical.

@:value(1.0)read onlyxz:Float = 1.0

Total horizontal zoom factor, calculated by zoom * xZoom.

@:value(1.0)read onlyyz:Float = 1.0

Total vertical zoom factor, calculated by zoom * yZoom.

@:value(1.0)zoom:Float = 1.0

To zoom the render content (value > 1.0 to expand and < 1.0 to shrink).

@:value(1.0)xZoom:Float = 1.0

Multiplicator for horizontal zoom.

@:value(1.0)yZoom:Float = 1.0

Multiplicator for vertical zoom.

@:value(false)read onlyisRun:Bool = false

Returns true if the time is started (for @anim tagged attributes into Elements).

time:Float

Sets the time value (for @anim tagged attributes into Elements).

onResize:(Int, Int) ‑> Void

To add a custom onResize eventhandler

Methods

start():Void

Starts the time-increasing (animate the @anim tagged attributes into Elements).

stop():Void

Stops the time-increasing (pause animation @anim tagged attributes into Elements).

inlinehasDisplay(display:Display):Bool

Returns true if the Display instance is added to the RenderList already.

Parameters:

display

Display instance

@:value({ addBefore : false })addDisplay(display:Display, ?atDisplay:Display, addBefore:Bool = false):Void

Adds a Display instance to the RenderList. Can be also used to change the order (relative to another display) if it's already added.

Parameters:

display

Display instance to add into the RenderList or to change it's order

atDisplay

(optional) to add or move the display before or after another display in the Renderlist (by default it adds at start or end)

addBefore

(optional) set to true to add the display before another display or at start of the Renderlist (by default it adds after atDisplay or at end of the list)

removeDisplay(display:Display):Void

Removes a Display instance from the RenderList.

Parameters:

display

Display instance

swapDisplays(display1:Display, display2:Display):Void

Swaps the order of two Display instances inside the RenderList.

Parameters:

display1

first display instance

display2

second display instance

@:value({ addBefore : false })addFramebufferDisplay(display:Display, ?atDisplay:Display, addBefore:Bool = false):Void

Adds an Display instance to the hidden framebuffer RenderList (what only render to textures). Can be also used to change the order (relative to another display) if it's already added.

Parameters:

display

Display instance to add into the RenderList or to change it's order

atDisplay

(optional) to add or move the display before or after another display in the Renderlist (by default it adds at start or end)

addBefore

(optional) set to true to add the display before another display or at start of the Renderlist (by default it adds after atDisplay or at end of the list)

removeFramebufferDisplay(display:Display):Void

Removes a Display instance from the hidden framebuffer RenderList (what only render to textures).

Parameters:

display

Display instance

setNewGLContext(newGl:PeoteGL):Void

Changes the gl-context of the View and all contained Displays (only need if using multiple Lime windows).

Parameters:

newGl

new OpenGL context

resize(width:Int, height:Int):Void

This function is need to call if the window-size is changed (automatically by registerEvents parameter into constructor)

Parameters:

width

new window width

height

new window height

inlineglobalX(localX:Float):Float

Converts a local x-position from view-coordinates to the correspondending global screen ones.

Parameters:

localX

x-position inside of the view

inlinelocalX(globalX:Float):Float

Converts a global x-position from screen-coordinates to the correspondending local view ones.

Parameters:

globalX

x-position at screen

inlineglobalY(localY:Float):Float

Converts a local y-position from view-coordinates to the correspondending global screen ones.

Parameters:

localY

y-position inside of the view

inlinelocalY(globalY:Float):Float

Converts a global y-position from screen-coordinates to the correspondending local view ones.

Parameters:

globalY

y-position at screen

getElementAt(posX:Float, posY:Float, display:Display, program:Program):Int

Gets the Element-Index at a defined position on screen

Parameters:

posX

x position in pixel

posY

y position in pixel

display

the Display instance that contains the program

program

the Program instance that contains the Buffer of Elements

getAllElementsAt(posX:Float, posY:Float, display:Display, program:Program):Array<Int>

Gets an array of Element-Indices at a defined position on screen.

Parameters:

posX

x position in pixel

posY

y position in pixel

display

the Display instance that contains the progam

program

the Program instance that contains the Buffer of Elements

setFramebuffer(display:Display, texture:Texture, ?textureSlot:Int):Void

Bind a texture to a display to use as a framebuffer for renderToTexture()

Parameters:

display

the Display instance

texture

thr Texture instance to render into

textureSlot

number of texture-slot to render into (can be changed by set the framebufferTextureSlot property)

renderToTexture(display:Display, ?textureSlot:Int):Void

Renders the content of a display into a texture.

Parameters:

display

the Display instance

textureSlot

number of texture-slot to render into (can be changed by set the framebufferTextureSlot display property)

@:value({ context : null })render(?context:RenderContext):Void

To render a single Frame. This can be called manually inside Lime's onRender-eventhandler if the parameter registerEvents is false during instancing. Can be also used to render only a single FramebufferDisplay.

Parameters:

context

limes OpenGL RenderContext instance

inlinerenderPart():Void

To render a single Frame without clearing the OpenGL viewport (e.g. to use it inside other frameworks).