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

Save png

From FenixWiki

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

← Previous diff
Revision as of 23:58, 25 April 2007 (edit) (undo)
Sandman (Talk | contribs)

Next diff →
Line 3: Line 3:
==Definition== ==Definition==
 +'''INT''' save_png ( <'''INT''' fileID> , <'''INT''' graphID> , <'''STRING''' file> )
-'''INT''' save_png ( <'''INT''' file> , <'''INT''' graph> , <'''STRING''' path> )+Saves an in-game [[graphic]] as a [[PNG]] file somewhere.
- +
-Saves an in-game graphic as a PNG file somewhere.+
- +
== Parameters == == Parameters ==
- 
{| {|
-| '''INT''' file || - The FPG your graphic is in, or 0 if it isn't in one.+| '''INT''' fileID || - The [[FPG]] your graphic is in, or 0 if it isn't in one.
|- |-
-| '''INT''' graph || - The graphic to save.+| '''INT''' graphID || - The graphic to save.
|- |-
-| '''STRING''' path || - Where on the hard drive to save it as a relative file path.+| '''STRING''' file || - The name of the [[file]] to be saved, including a possible [[path]].
|} |}
- 
== Returns == == Returns ==
- +'''INT''' : Returns [[true]] if successful and [[false]] if failed.
-'''INT''' : Returns [[true|1]] if successful and [[false|0]] if failed.+
- +
== Example == == Example ==
- 
<pre> <pre>
//here's a cool thing to save a screenshot //here's a cool thing to save a screenshot
Line 52: Line 45:
End End
</pre> </pre>
 +Used in example: [[key]](), [[get_screen]](), [[unload_map]]()

Revision as of 23:58, 25 April 2007


Contents

Definition

INT save_png ( <INT fileID> , <INT graphID> , <STRING file> )

Saves an in-game graphic as a PNG file somewhere.

Parameters

INT fileID - The FPG your graphic is in, or 0 if it isn't in one.
INT graphID - The graphic to save.
STRING file - The name of the file to be saved, including a possible path.

Returns

INT : Returns true if successful and false if failed.

Example

//here's a cool thing to save a screenshot
Program save_those_pngs;
Global
    takingscreenshot;

Begin

    Loop
        
        If (key(_f12)) 
            If (takingscreenshot==0)
                takingscreenshot=1;
                graph=get_screen(); // grabs the screen and sets it as the program graphic
                save_png(0,graph,"shot"+rand(0,9999)+".png");  // saves the graphic as a png with a random number in the filename to prevent overwriting 
                unload_map(0,graph);  //frees the graphic
            Else
                takingscreenshot=0;
            End
        End

        frame;
    End
End

Used in example: key(), get_screen(), unload_map()

Personal tools