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

Get point

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 13:44, 1 May 2007 (edit)
FCR (Talk | contribs)

← Previous diff
Current revision (15:32, 25 February 2008) (edit) (undo)
85.144.194.29 (Talk)
(Category changed to "controlpoints".)
 
(2 intermediate revisions not shown.)
Line 1: Line 1:
[[Category:functions]] [[Category:functions]]
 +[[Category:controlpoints]]
==Definition== ==Definition==
-'''INT''' Get_point ( <'''INT''' library> , <'''INT''' graph>, <'''INT''' number>, <'''INT''' x>, <'''INT''' y>)+'''INT''' get_point ( <'''INT''' fileID> , <'''INT''' graphID> , <'''INT''' controlpointID> , <'''INT POINTER''' x>, <'''INT POINTER''' y>)
-This command allows you to obtain a control point of a particular graphic file.+Allows you to obtain a control point of a particular [[graph]].
-Any graph can contain an undetermined number of control points where control point 0 is the centre of the graphic, and the rest are available to the user. This function allows you to know the location of any control point belonging to any graph.+Any graph can contain an undetermined number of control points where control point 0 is the center of the graphic. This [[function]] allows you to know the location of any control point belonging to any graph.
 + 
 +To set a control point, use [[set_point]]() or, for only the center of a graph, [[set_center]]().
== Parameters == == Parameters ==
{| {|
-| '''INT''' library || - Number of the FPG library.+| '''INT''' fileID || - Number of the FPG library.
|- |-
-| '''INT''' graph|| - Number of the graph inside the library which you want to use.+| '''INT''' graphID || - Number of the graph inside the library which you want to use.
|- |-
-| '''INT''' number|| - Number of the control point (where control point 0 is the centre of the graphic).+| '''INT''' controlpointID || - Number of the control point.
|- |-
-| '''INT''' x|| - Offset of a variable of entire type (INT) which will hold the horizontal coordinate(X) of the control point.+| '''INT POINTER''' x || - Pointer to where the X-coordinate of the control point will be written.
|- |-
-| '''INT''' y|| - Offset of a variable of entire type (INT) which will hold the vertical coordinate(Y) of the control point.+| '''INT POINTER''' y || - Pointer to where the Y-coordinate of the control point will be written.
|} |}
== Returns == == Returns ==
-'''INT''' : If the number of the control points specified is out of range, the function returns -1 and the variables x and y will not be modified. But if the control point is in range, but not defined, x and y will have the value -1.+'''INT''' : Successrate
- +{|
-==Notes==+| [[false]] || - One of the following: specified graph is invalid, specified control point is invalid, specified control point is undefined.
-In the rest of the cases, x and y will have the coordinates of the control point, then (0, 0) will represent the pixel located in the top left corner of the graph.+|-
 +| [[true]] || - The control point was defined or the center was used.
 +|}
== Example == == Example ==
<pre> <pre>
-(no example yet)+Program cpoint;
 +Private
 + int map;
 + int cx,cy;
 +Begin
 + 
 + // Create a red graph
 + map = new_map(100,100,8);
 + map_clear(0,map,rgb(255,0,0));
 + 
 + // Set the center to a random point
 + set_center(0,map,rand(-10,110),rand(-10,110));
 + 
 + // Get the center
 + get_point(0,map,0,&cx,&cy);
 + 
 + // Show the center
 + say("Center-X: " + cx);
 + say("Center-Y: " + cy);
 + 
 + // Assign the map to the graph variable
 + graph = map;
 + 
 + // Set the location of this process to the center of the screen
 + x = 160;
 + y = 100;
 + 
 + Loop
 + frame;
 + End
 + 
 +End
</pre> </pre>
 +Used in example: [[new_map]](), [[map_clear]](), [[set_center]](), [[say]](), [[pointer]], [[graph]]
 +
 +Notice that setting the center influences the position of the graph:<br />
 +http://wwwhome.cs.utwente.nl/~bergfi/fenix/wiki/get_point.PNG
 +
 +{{Funcbox
 + | category = Controlpoints
 +}}

Current revision


Contents

[edit] Definition

INT get_point ( <INT fileID> , <INT graphID> , <INT controlpointID> , <INT POINTER x>, <INT POINTER y>)

Allows you to obtain a control point of a particular graph.

Any graph can contain an undetermined number of control points where control point 0 is the center of the graphic. This function allows you to know the location of any control point belonging to any graph.

To set a control point, use set_point() or, for only the center of a graph, set_center().

[edit] Parameters

INT fileID - Number of the FPG library.
INT graphID - Number of the graph inside the library which you want to use.
INT controlpointID - Number of the control point.
INT POINTER x - Pointer to where the X-coordinate of the control point will be written.
INT POINTER y - Pointer to where the Y-coordinate of the control point will be written.

[edit] Returns

INT : Successrate

false - One of the following: specified graph is invalid, specified control point is invalid, specified control point is undefined.
true - The control point was defined or the center was used.

[edit] Example

Program cpoint;
Private
    int map;
    int cx,cy;
Begin

    // Create a red graph
    map = new_map(100,100,8);
    map_clear(0,map,rgb(255,0,0));

    // Set the center to a random point
    set_center(0,map,rand(-10,110),rand(-10,110));

    // Get the center
    get_point(0,map,0,&cx,&cy);

    // Show the center
    say("Center-X: " + cx);
    say("Center-Y: " + cy);

    // Assign the map to the graph variable
    graph = map;

    // Set the location of this process to the center of the screen
    x = 160;
    y = 100;

    Loop
        frame;
    End

End

Used in example: new_map(), map_clear(), set_center(), say(), pointer, graph

Notice that setting the center influences the position of the graph:
get_point.PNG


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