Difference between revisions of "Lua API:Renderer"

From The Powder Toy
Jump to: navigation, search
(renderer.grid)
(Add real function descriptions / usages)
Line 3: Line 3:
 
== Methods ==
 
== Methods ==
  
=== renderer.colorMode ===
+
=== renderer.renderModes ===
  type ren.colorMode()
+
  table ren.renderModes()
Does something
+
ren.renderModes(table newModes)
 +
If called with no arguments, returns a table containing the currently activated render modes. If called with a table argument, turns on all the render modes specified in the table. Render modes are typically used to change the way all particles render, display modes set extra added effects.
 +
 
 +
Print out all current render modes in hex:
 +
<syntaxhighlight lang="lua">
 +
for k,v in pairs(ren.renderModes()) do
 +
    print(k,"0x"..bit.tohex(v))
 +
end
 +
>>1, 0x00fff380; 2, 0xff00f270; 3, 0x0400f381
 +
</syntaxhighlight>
 +
 
 +
 
 +
Set the current render mode to a weird form of blob display
 +
<syntaxhighlight lang="lua">
 +
ren.renderModes({ren.RENDER_BLOB, ren.RENDER_EFFE})
 +
</syntaxhighlight>
 +
 
 +
=== renderer.displayModes ===
 +
table ren.displayModes()
 +
ren.displayModes(table newModes)
 +
Works exactly like rennder.renderModes(). If called with no arguments, returns a table containing the currently activated display modes. If called with a table argument, turns on all the display modes specified in the table. Render modes are typically used to change the way all particles render, display modes set extra added effects.
 +
 
 +
Print out all current display modes in hex:
 +
<syntaxhighlight lang="lua">
 +
for k,v in pairs(ren.displayModes()) do
 +
    print(k,"0x"..bit.tohex(v))
 +
end
 +
>>1, 0x00000002; 2, 0x00000010
 +
</syntaxhighlight>
 +
 
 +
 
 +
Set the current display mode to persistent with cracker velocity display
 +
<syntaxhighlight lang="lua">
 +
ren.displayModes({ren.DISPLAY_AIRC, ren.DISPLAY_PERS})
 +
</syntaxhighlight>
  
 
=== renderer.colourMode ===
 
=== renderer.colourMode ===
  type ren.colourMode()
+
  number ren.colourMode()
Does something
+
ren.colourMode(number colourMode)
 +
If called with no arguments, returns the current colour mode. If an argument is passed in, sets the colour mode. Available settings are:
 +
COLOUR_BASC
 +
COLOUR_HEAT
 +
COLOUR_GRAD
 +
COLOUR_LIFE
 +
COLOUR_DEFAULT
  
=== renderer.debugHUD ===
+
=== renderer.colorMode ===
  type ren.debugHUD()
+
  number ren.colorMode()
Does something
+
ren.colorMode(number colorMode)
 +
An alias for ren.colourMode.
  
 
=== renderer.decorations ===
 
=== renderer.decorations ===
  type ren.decorations()
+
  number ren.decorations()
Does something
+
ren.decorations(number decoSetting)
 +
If called with no arguments, returns a 0 or a 1 representing the current deco mode setting. If a number is passed in, turns decorations on or off.
  
=== renderer.displayModes ===
+
=== renderer.grid ===
  type ren.displayModes()
+
  number ren.grid()
Does something
+
ren.grid(number gridSize)
 +
If called with no arguments, returns the current grid size (normally set with 'g'). Grid sizes range from 0 (no grid) to 9. Each size increases the number of pixels between lines by 4.
  
=== renderer.grid ===
+
If an argument is passed in, sets the current grid size. There are no checks to make sure it is in the valid range, but if negative numbers are passed in it may cause strange behavior.
type ren.grid()
 
Draws grid
 
  
=== renderer.renderModes ===
+
=== renderer.debugHUD ===
  type ren.renderModes()
+
  number ren.debugHUD()
Does something
+
ren.debugHUD(number debugSetting)
 +
If called with no arguments, returns a 0 or a 1 representing whether the debug HUD (normally set with 'd') is on or off. If a number is passed in, turns the debug HUD on or off.
  
 
== Constants ==
 
== Constants ==

Revision as of 22:37, 14 March 2014

Description goes here.

Methods

renderer.renderModes

table ren.renderModes()
ren.renderModes(table newModes)

If called with no arguments, returns a table containing the currently activated render modes. If called with a table argument, turns on all the render modes specified in the table. Render modes are typically used to change the way all particles render, display modes set extra added effects.

Print out all current render modes in hex:

for k,v in pairs(ren.renderModes()) do
    print(k,"0x"..bit.tohex(v))
end
>>1, 0x00fff380; 2, 0xff00f270; 3, 0x0400f381


Set the current render mode to a weird form of blob display

ren.renderModes({ren.RENDER_BLOB, ren.RENDER_EFFE})

renderer.displayModes

table ren.displayModes()
ren.displayModes(table newModes)

Works exactly like rennder.renderModes(). If called with no arguments, returns a table containing the currently activated display modes. If called with a table argument, turns on all the display modes specified in the table. Render modes are typically used to change the way all particles render, display modes set extra added effects.

Print out all current display modes in hex:

for k,v in pairs(ren.displayModes()) do
    print(k,"0x"..bit.tohex(v))
end
>>1, 0x00000002; 2, 0x00000010


Set the current display mode to persistent with cracker velocity display

ren.displayModes({ren.DISPLAY_AIRC, ren.DISPLAY_PERS})

renderer.colourMode

number ren.colourMode()
ren.colourMode(number colourMode)

If called with no arguments, returns the current colour mode. If an argument is passed in, sets the colour mode. Available settings are:

COLOUR_BASC
COLOUR_HEAT
COLOUR_GRAD
COLOUR_LIFE
COLOUR_DEFAULT 

renderer.colorMode

number ren.colorMode()
ren.colorMode(number colorMode)

An alias for ren.colourMode.

renderer.decorations

number ren.decorations()
ren.decorations(number decoSetting)

If called with no arguments, returns a 0 or a 1 representing the current deco mode setting. If a number is passed in, turns decorations on or off.

renderer.grid

number ren.grid()
ren.grid(number gridSize)

If called with no arguments, returns the current grid size (normally set with 'g'). Grid sizes range from 0 (no grid) to 9. Each size increases the number of pixels between lines by 4.

If an argument is passed in, sets the current grid size. There are no checks to make sure it is in the valid range, but if negative numbers are passed in it may cause strange behavior.

renderer.debugHUD

number ren.debugHUD()
ren.debugHUD(number debugSetting)

If called with no arguments, returns a 0 or a 1 representing whether the debug HUD (normally set with 'd') is on or off. If a number is passed in, turns the debug HUD on or off.

Constants

Any of these constants can be accessed with renderer.<constant name here>

COLOUR

COLOUR_BASC
COLOUR_HEAT
COLOUR_GRAD
COLOUR_LIFE
COLOUR_DEFAULT

DECO

DECO_FIRE

DISPLAY

DISPLAY_PERS
DISPLAY_WARP
DISPLAY_AIRH
DISPLAY_AIRV
DISPLAY_EFFE
DISPLAY_AIRC
DISPLAY_AIR
DISPLAY_AIRP

EFFECT

EFFECT_LINES
EFFECT_GRAVOUT
EFFECT_GRAVIN
EFFECT_DBGLINES

FIRE

FIRE_ADD
FIRE_BLEND

NO

NO_DECO

PMODE

PMODE_BLUR
PMODE_FLAT
PMODE_LFLARE
PMODE_FLARE
PMODE_ADD
PMODE_NONE
PMODE_BLEND
PMODE_SPARK
PMODE_BLOB
PMODE_GLOW

PSPEC

PSPEC_STICKMAN

RENDER

RENDER_EFFE
RENDER_BLUR
RENDER_GLOW
RENDER_NONE
RENDER_FIRE
RENDER_BASC
RENDER_BLOB

Uncategorized

OPTIONS
FIREMODE
EFFECT
PMODE