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

Graphic info

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 15:10, 22 April 2007 (edit)
Woody (Talk | contribs)

← Previous diff
Revision as of 01:16, 26 April 2007 (edit) (undo)
Sandman (Talk | contribs)

Next diff →
Line 3: Line 3:
==Definition== ==Definition==
- +'''INT''' graphic_info ( <'''INT''' fileID> , <'''INT''' graphID> , <'''INT''' infotype> )
-'''INT''' graphic_info ( <'''INT''' file> , <'''INT''' graph> , <'''INT''' info> )+
Gets some information about the [[graph]] specified. Gets some information about the [[graph]] specified.
- 
== Parameters == == Parameters ==
- 
{| {|
-| '''INT''' file || - The FPG that holds the graph, or 0 for no FPG.+| '''INT''' fileID || - The [[file]] that holds the graph.
|- |-
-| '''INT''' graph || - The graph to get information from.+| '''INT''' graphID || - The [[graph]] to get information from.
|- |-
-| '''INT''' info || - What information you want. You can use the constants [[G_WIDE]] (or G_WIDTH for versions past 0.83) to get the graph's width, [[G_HEIGHT]] for its height, [[G_X_CENTER]] for its x-axis center, or [[G_Y_CENTER]] for its y-axis center.+| '''INT''' infotype || - What type of information you want.
|} |}
- 
== Returns == == Returns ==
 +'''INT''' : Returns the information you want.<br />
 +If the specified graph was invalid it returns 0.<br />
 +If the specified infotype was not recognized it returns 1.
-'''INT''' : Returns the information you want.+== Notes ==
- +You can use the following constants to get a certain type of information of the graph:
 +{|
 +| [[G_WIDTH]] || - width in [[pixels]] (G_WIDE for versions 0.83 and below).
 +|-
 +| [[G_HEIGHT]] || - height in pixels.
 +|-
 +| [[G_X_CENTER]] || - X-axis center.
 +|-
 +| [[G_Y_CENTER]] || - Y-axis center.
 +|-
 +| [[G_PITCH]] || - width in bytes.
 +|-
 +| [[G_DEPTH]] || - [[colordepth]] in bits per pixel.
 +|-
 +| [[G_FRAMES]] || - Number of frames. (''From a certain Fenix version and up'')
 +|-
 +| [[G_ANIMATION_STEP]] || - Current frame in animation. (''From a certain Fenix version and up'')
 +|-
 +| [[G_ANIMATION_STEPS]] || - Number of frames in animation. (''From a certain Fenix version and up'')
 +|-
 +| [[G_ANIMATION_SPEED]] || - Current speed of animation. (''From a certain Fenix version and up'')
 +|}
== Example == == Example ==
- 
<pre> <pre>
Program keuken; Program keuken;
Line 45: Line 64:
gyc=graphic_info(0,graph,G_Y_CENTER); //finds the graphic's center coordinates gyc=graphic_info(0,graph,G_Y_CENTER); //finds the graphic's center coordinates
- map_put_pixel(0,graph,gxc,gyc,rgb(255,255,255)); //puts a single white pixel in the center of the graphic+ map_put_pixel(0,graph,gxc,gyc,rgb(255,255,255)); //puts a white pixel in the center of the graphic
Loop Loop
Line 53: Line 72:
End End
</pre> </pre>
 +Used in example: [[set_mode]](), [[new_map]](), [[map_clear]](), [[map_put_pixel]]()

Revision as of 01:16, 26 April 2007


Contents

Definition

INT graphic_info ( <INT fileID> , <INT graphID> , <INT infotype> )

Gets some information about the graph specified.

Parameters

INT fileID - The file that holds the graph.
INT graphID - The graph to get information from.
INT infotype - What type of information you want.

Returns

INT : Returns the information you want.
If the specified graph was invalid it returns 0.
If the specified infotype was not recognized it returns 1.

Notes

You can use the following constants to get a certain type of information of the graph:

G_WIDTH - width in pixels (G_WIDE for versions 0.83 and below).
G_HEIGHT - height in pixels.
G_X_CENTER - X-axis center.
G_Y_CENTER - Y-axis center.
G_PITCH - width in bytes.
G_DEPTH - colordepth in bits per pixel.
G_FRAMES - Number of frames. (From a certain Fenix version and up)
G_ANIMATION_STEP - Current frame in animation. (From a certain Fenix version and up)
G_ANIMATION_STEPS - Number of frames in animation. (From a certain Fenix version and up)
G_ANIMATION_SPEED - Current speed of animation. (From a certain Fenix version and up)

Example

Program keuken;
Local
    gxc;
    gyc;

Begin

    set_mode(640,480,16);
    
    graph=new_map(rand(50,150),rand(50,150),16); //makes a randomly proportioned red rectangle
    map_clear(0,graph,rgb(255,0,0));
    x=320;
    y=240;

    gxc=graphic_info(0,graph,G_X_CENTER);
    gyc=graphic_info(0,graph,G_Y_CENTER);  //finds the graphic's center coordinates

    map_put_pixel(0,graph,gxc,gyc,rgb(255,255,255)); //puts a white pixel in the center of the graphic

    Loop
  
        frame;
    End
End

Used in example: set_mode(), new_map(), map_clear(), map_put_pixel()

Personal tools