- This wiki is out of date, use the continuation of this wiki instead
Save png
From FenixWiki
(Difference between revisions)
| Revision as of 12:04, 8 July 2007 (edit) Sandman (Talk | contribs) m ← Previous diff |
Current revision (16:05, 25 February 2008) (edit) (undo) 85.144.194.29 (Talk) (Spelling mistake.) |
||
| (5 intermediate revisions not shown.) | |||
| Line 3: | Line 3: | ||
| ==Definition== | ==Definition== | ||
| - | '''INT''' save_png ( <'''INT''' fileID> , <'''INT''' graphID> , <'''STRING''' | + | '''INT''' save_png ( <'''INT''' fileID> , <'''INT''' graphID> , <'''STRING''' filename> ) |
| Saves an in-game [[graphic]] as a [[PNG]] file somewhere. | Saves an in-game [[graphic]] as a [[PNG]] file somewhere. | ||
| Line 9: | Line 9: | ||
| == Parameters == | == Parameters == | ||
| {| | {| | ||
| - | | '''INT''' fileID || - The [[ | + | | '''INT''' fileID || - The [[fileID]] of the [[file]] that holds the graphic. |
| |- | |- | ||
| - | | '''INT''' graphID || - The graphic to save. | + | | '''INT''' graphID || - The [[graphID]] of the graphic to save. |
| |- | |- | ||
| - | | '''STRING''' | + | | '''STRING''' filename || - The name of the [[PNG]] file to be saved, including a possible [[path]]. |
| |} | |} | ||
| == Returns == | == Returns == | ||
| - | '''INT''' : | + | '''INT''' : Successrate |
| + | {| | ||
| + | | [[false]] || - Error. | ||
| + | |- | ||
| + | | [[true]] || - Success. | ||
| + | |} | ||
| == Example == | == Example == | ||
| Line 41: | Line 46: | ||
| takingscreenshot=0; | takingscreenshot=0; | ||
| End | End | ||
| - | + | While(key(_f12)) Frame; End | |
| + | End | ||
| frame; | frame; | ||
| Line 48: | Line 54: | ||
| </pre> | </pre> | ||
| Used in example: [[key]](), [[get_screen]](), [[unload_map]]() | Used in example: [[key]](), [[get_screen]](), [[unload_map]]() | ||
| + | |||
| + | {{Funcbox | ||
| + | | category = Maps | ||
| + | }} | ||
Current revision
Contents |
[edit] Definition
INT save_png ( <INT fileID> , <INT graphID> , <STRING filename> )
Saves an in-game graphic as a PNG file somewhere.
[edit] Parameters
| INT fileID | - The fileID of the file that holds the graphic. |
| INT graphID | - The graphID of the graphic to save. |
| STRING filename | - The name of the PNG file to be saved, including a possible path. |
[edit] Returns
INT : Successrate
| false | - Error. |
| true | - Success. |
[edit] 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
While(key(_f12)) Frame; End
End
frame;
End
End
Used in example: key(), get_screen(), unload_map()
| Maps Functions | |
| • Graphic_info() • Map_block_copy() • Map_clear() • Map_clone() • Map_put() • Map_put_pixel() • Map_xput() • Map_xputnp() • New_map() • Save_png() • Unload_map() • | |
