Difference between revisions of "GetCamera"

From King Arthur's Gold Wiki
Jump to: navigation, search
(Created page with "<onlyinclude> Returns a reference to the CCamera object. </onlyinclude> <syntaxhighlight lang="cpp"> CCamera@ getCamera() </syntaxhighlight> Category:Scripting [[Categor...")
 
 
Line 4: Line 4:
 
<syntaxhighlight lang="cpp">
 
<syntaxhighlight lang="cpp">
 
CCamera@ getCamera()
 
CCamera@ getCamera()
 +
</syntaxhighlight>
 +
 +
Example from Entities/Common/Scripts/StandardControls.as:
 +
<syntaxhighlight lang="cpp" highlight="6, 9, 12">
 +
f32 zoomSpeed = 0.25f;
 +
f32 maxZoom = 2.0f;
 +
switch (zoomLevel)
 +
{
 +
  case 1:
 +
    getCamera().targetDistance += zoomSpeed;
 +
    break;
 +
  case 2:
 +
    getCamera().targetDistance -= zoomSpeed;
 +
    break;
 +
  default:
 +
    getCamera().targetDistance = 1.0f;
 +
    break;
 +
}
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
[[Category:Scripting]]
 
[[Category:Scripting]]
 
[[Category:Global Functions]]
 
[[Category:Global Functions]]

Latest revision as of 19:19, 22 August 2012

Returns a reference to the CCamera object.

CCamera@ getCamera()

Example from Entities/Common/Scripts/StandardControls.as:

f32 zoomSpeed = 0.25f;
f32 maxZoom = 2.0f;
switch (zoomLevel)
{
  case 1:
    getCamera().targetDistance += zoomSpeed;    break;
  case 2:
    getCamera().targetDistance -= zoomSpeed;    break;
  default:
    getCamera().targetDistance = 1.0f;    break;
}