This wiki is out of date, use the continuation of this wiki instead

Set center

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 14:07, 22 May 2007 (edit)
G105b (Talk | contribs)

← Previous diff
Current revision (16:08, 25 February 2008) (edit) (undo)
85.144.194.29 (Talk)
(Category changed to "controlpoints".)
 
(5 intermediate revisions not shown.)
Line 1: Line 1:
[[Category:functions]] [[Category:functions]]
-[[Category:maps]]+[[Category:controlpoints]]
==Definition== ==Definition==
Line 7: Line 7:
Allows you to change the centre [[pixel]] of a graph. 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.+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 == == Parameters ==
Line 24: Line 24:
== Notes == == 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.+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. 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.
Line 34: Line 34:
Program example; Program example;
Begin Begin
- graph=load_png("example.png"); //Loads a 128x128 image as the graphic+ graph=load_png("set_center.png"); //Loads a 128x128 image as the graphic
x=160; x=160;
y=100; //Places the graphic in the centre of the screen y=100; //Places the graphic in the centre of the screen
Line 51: Line 51:
End End
</pre> </pre>
 +Used in example: [[load_png]](), [[write]]()
 +
 +File(s) used in example: [http://wwwhome.cs.utwente.nl/~bergfi/fenix/wiki/set_center.PNG set_center.png]
 +
 +{{Funcbox
 + | category = Controlpoints
 +}}

Current revision


Contents

[edit] 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.

[edit] 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.

[edit] Returns

INT : Always returns 1 (?).

[edit] 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.

[edit] 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


Controlpoints Functions
Get_point() • Set_center() •
Personal tools