Squirrel/Script Types/VectorScreen

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Example)
 
Line 12: Line 12:
  
 
== Example ==
 
== Example ==
 +
VectorScreens originate in the top-left corner. This code makes a VectorScreen that starts 10 pixels down and 10 pixels to the right.
  
{{Squirrel/NeedsExample}}
+
<code lang="squirrel">
Some explanation here
+
local screen = VectorSceen( 10, 10 );
 +
</code>
 +
 
 +
This code makes a VectorScreen about 10 pixels down and 20 pixels from the right.
 +
<code lang="squirrel">
 +
local screen = VectorScreen( ScreenWidth - 20, 10 );
 +
</code>
  
 +
This code creates a VectorScreen approximately in the middle of the screen.
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
local screen = VectorScreen( ScreenWidth / 2, ScreenHeight / 2 );
 
</code>
 
</code>
  

Latest revision as of 12:30, 2 August 2011

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

The VectorScreen type is a 2-dimensional vector used to indicate positions on screen. The origin is at the top-left corner of the screen.

[edit] Constructor

  1. VectorScreen( int x, int y )

[edit] Values

  • x - The X coordinate of the vector
  • y - The Y coordinate of the vector

[edit] Example

VectorScreens originate in the top-left corner. This code makes a VectorScreen that starts 10 pixels down and 10 pixels to the right.

  1.  
  2. local screen = VectorSceen( 10, 10 );
  3.  

This code makes a VectorScreen about 10 pixels down and 20 pixels from the right.

  1.  
  2. local screen = VectorScreen( ScreenWidth - 20, 10 );
  3.  

This code creates a VectorScreen approximately in the middle of the screen.

  1.  
  2. local screen = VectorScreen( ScreenWidth / 2, ScreenHeight / 2 );
  3.  

[edit] Types

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox