- This wiki is out of date, use the continuation of this wiki instead
Set center
From FenixWiki
Revision as of 21:38, 22 May 2007 (edit) Sandman (Talk | contribs) m (→Example) ← Previous diff |
Revision as of 20:31, 30 November 2007 (edit) (undo) Sandman (Talk | contribs) m Next diff → |
||
Line 54: | Line 54: | ||
File(s) used in example: [http://wwwhome.cs.utwente.nl/~bergfi/fenix/wiki/set_center.PNG set_center.png] | File(s) used in example: [http://wwwhome.cs.utwente.nl/~bergfi/fenix/wiki/set_center.PNG set_center.png] | ||
+ | |||
+ | {{Funcbox | ||
+ | | category = Maps | ||
+ | }} |
Revision as of 20:31, 30 November 2007
Contents |
Definition
INT set_center ( <INT FileID> , <INT GraphID> , <INT x> , <INT y>)
Allows you to change the centre pixel of a graph.
This function changes a graphic's centre pixel, which is the pixel that is located on screen at the graph's x and y coordinates.
Parameters
INT FileID | - The FileID assigned to the archive. |
INT GraphID | - The GraphID who's centre to change. |
INT x | - The new horizontal centre coordinate of the graph. |
INT y | - The new vertical centre coordinate of the graph. |
Returns
INT : Always returns 1 (?).
Notes
You set the position of control point 0 in the graphic. This control point gives acts as the graphic's coordinate on screen. For example, if a graphic's centre is set to 0,0 , then the upper left pixel of the graphic will be placed on screen at the graphic's coordinates. If no centre is set, by default control point 0 is set to the graphics true geometric centre.
Another key feature is that the graphic will rotate around its centre, as set by this function, and any horizontal or vertical mirrors (set with flags) will flip at this point.
When a graphic is used as a mouse pointer, its centre point is used for the mouse tip. Most mouse cursors in Operating Systems have a mouse with the tip in the upper left of the image. Therefore, for a standard mouse pointer in Fenix, you will have to set the centre at 0,0 to enable mouse acuracy.
Example
Program example; Begin graph=load_png("set_center.png"); //Loads a 128x128 image as the graphic x=160; y=100; //Places the graphic in the centre of the screen write(0,0,0,0,"Press [1] to set centre to 0,0"); write(0,0,0,10,"Press [2] to set centre to 64,64"); Loop if(key(_1)) set_center(0,graph,0,0); end if(key(_2)) set_center(0,graph,64,64); end angle+=100; //Rotates the graphic constantly frame; End End
Used in example: load_png(), write()
File(s) used in example: set_center.png
Maps Functions | |
• Graphic_info() • Map_block_copy() • Map_clear() • Map_clone() • Map_put() • Map_put_pixel() • Map_xput() • Map_xputnp() • New_map() • Save_png() • Unload_map() • |