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

Flags

From FenixWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 07:31, 25 June 2007 (edit)
212.190.93.60 (Talk)

← Previous diff
Current revision (18:52, 3 April 2008) (edit) (undo)
Sandman (Talk | contribs)
m
 
(4 intermediate revisions not shown.)
Line 1: Line 1:
[[category:variables]] [[category:variables]]
 +[[category:predefined]]
[[category:local variables]] [[category:local variables]]
-== Definition ==+[[Local variables|'''Up to Local Variables''']]
-'''INT''' flags+
-Flags is a predefined [[local variable]] which is used to manipulate [[graphic|graphics]] in a [[process]].+----
-== List == 
-{| 
-| ''Value'' || - ''What it does'' 
-|- 
-| 0 || - Nothing happens 
-|- 
-| 1 || - Graphic is horizontally mirrored 
-|- 
-| 2 || - Graphic is vertically mirrored 
-|- 
-| 4 || - Graphic is translucent 
-|} 
-You can add up the numbers to combine the effects. A horizontally mirrored translucent graphic would need flags 4 and 1, so flags = 5 will do the trick!+== Definition ==
 +'''INT''' flags = 0
 + 
 +Flags is a predefined [[local variable]] which is used to manipulate how the [[graphic]] of a [[process]], assigned to its local variable [[graph]], is displayed.
 + 
 +To alter the effect, change the value of this local variable by assigning it [[blit flags]]. Like most [[bit flags]], constants can be added together to combine effects. A horizontally mirrored translucent graphic would need flags B_TRANSLUCENT (4) and B_HMIRROR (1), so flags = B_TRANSLUCENT|B_HMIRROR (5) will do the trick.
== Example == == Example ==
To make the graphic of a process spin: To make the graphic of a process spin:
<pre> <pre>
 +Program mirror
 +Begin
 + mirror_graphic();
 + Loop
 + frame;
 + End
 +End
Process mirror_graphic() Process mirror_graphic()
Begin Begin
- graph = load_png("image.png"); //load the graphic and assign it to the graph variable+ graph = new_map(50,50,8);
 + map_clear(0,graph,rgb(0,255,255));
x = 100; //Position the graphic 100 pixels x = 100; //Position the graphic 100 pixels
y = 100; //from the top and left of the screen y = 100; //from the top and left of the screen
Loop Loop
if (key(_l)) if (key(_l))
- flags = 1; //if you press the L key, your graphic is horizontally mirrored+ flags = B_HMIRROR; //if you press the L key, your graphic is horizontally mirrored
 + else
 + flags = 0;
end end
frame; frame;
Line 38: Line 41:
End End
</pre> </pre>
-This process will mirror its graphic as soon as you press L.+The process will mirror its graphic when the key L is held down.
 + 
 +{{Locals}}

Current revision

Up to Local Variables



[edit] Definition

INT flags = 0

Flags is a predefined local variable which is used to manipulate how the graphic of a process, assigned to its local variable graph, is displayed.

To alter the effect, change the value of this local variable by assigning it blit flags. Like most bit flags, constants can be added together to combine effects. A horizontally mirrored translucent graphic would need flags B_TRANSLUCENT (4) and B_HMIRROR (1), so flags = B_TRANSLUCENT|B_HMIRROR (5) will do the trick.

[edit] Example

To make the graphic of a process spin:

Program mirror
Begin
    mirror_graphic();
    Loop
        frame;
    End
End
Process mirror_graphic()
Begin
    graph = new_map(50,50,8);
    map_clear(0,graph,rgb(0,255,255));
    x = 100;     //Position the graphic 100 pixels
    y = 100;     //from the top and left of the screen
    Loop
        if (key(_l))
            flags = B_HMIRROR; //if you press the L key, your graphic is horizontally mirrored
        else
            flags = 0;
        end       
        frame;
    End
End

The process will mirror its graphic when the key L is held down.


Local variables
AngleBigbroFatherFileFlagsGraphIdRegionReservedResolutionSizeSize_xSize_ySmallbroSonXYZ
Personal tools