- This wiki is out of date, use the continuation of this wiki instead
Map put
From FenixWiki
(Difference between revisions)
Revision as of 13:50, 22 May 2007 (edit) Sandman (Talk | contribs) ← Previous diff |
Current revision (20:30, 30 November 2007) (edit) (undo) Sandman (Talk | contribs) m |
||
(2 intermediate revisions not shown.) | |||
Line 11: | Line 11: | ||
== Parameters == | == Parameters == | ||
{| | {| | ||
- | | '''INT''' fileID || - The [[file]] that holds the | + | | '''INT''' fileID || - The [[fileID]] of the [[file]] that holds the graphics. |
|- | |- | ||
- | | '''INT''' destinationGraphID || - The [[ | + | | '''INT''' destinationGraphID || - The [[graphID]] of the [[graphic]] to draw on. |
|- | |- | ||
- | | '''INT''' originGraphID || - The [[ | + | | '''INT''' originGraphID || - The [[graphID]] of the [[graphic]] to draw with. |
|- | |- | ||
- | | '''INT''' x || - Where on the destination | + | | '''INT''' x || - Where on the destination graphic's x-axis to put the graph. |
|- | |- | ||
- | | '''INT''' y || - Where on the destination | + | | '''INT''' y || - Where on the destination graphic's y-axis to put the graph. |
|} | |} | ||
Line 61: | Line 61: | ||
map_clear(0,origgraph2,rgb(0,0,255)); | map_clear(0,origgraph2,rgb(0,0,255)); | ||
- | // Draws the blue | + | // Draws the blue and green squares at a random position on the red square |
- | + | ||
map_put(0,destgraph,origgraph1,rand(0,100),rand(0,100)); | map_put(0,destgraph,origgraph1,rand(0,100),rand(0,100)); | ||
map_put(0,destgraph,origgraph2,rand(0,100),rand(0,100)); | map_put(0,destgraph,origgraph2,rand(0,100),rand(0,100)); | ||
Line 79: | Line 78: | ||
This will result in something like:<br /> | This will result in something like:<br /> | ||
http://wwwhome.cs.utwente.nl/~bergfi/fenix/wiki/map_put.PNG | http://wwwhome.cs.utwente.nl/~bergfi/fenix/wiki/map_put.PNG | ||
+ | |||
+ | {{Funcbox | ||
+ | | category = Maps | ||
+ | }} |
Current revision
Contents |
[edit] Definition
INT map_put ( <INT fileID> , <INT destinationGraphID> , <INT originGraphID> , <INT x> , <INT y> )
Draws (blits) a graph onto another graph.
If more advanced parameters are needed, map_xput() can be used. If a graph from one file needs to be drawn onto another graph in a different file, or a separate width and height scaling is needed, map_xputnp() can be used.
[edit] Parameters
INT fileID | - The fileID of the file that holds the graphics. |
INT destinationGraphID | - The graphID of the graphic to draw on. |
INT originGraphID | - The graphID of the graphic to draw with. |
INT x | - Where on the destination graphic's x-axis to put the graph. |
INT y | - Where on the destination graphic's y-axis to put the graph. |
[edit] Returns
INT : true
[edit] Notes
The x and y parameters denote where to draw the graph, that is, where the center of the to be drawn graph will be.
[edit] Errors
Invalid origin graph | - The origin graph is invalid. |
Invalid destination graph | - The destination graph is invalid. |
Unsupported color depth | - The origin graph's color depth is greater than the destination graph's. |
[edit] Example
Program watskeburt; Global int destgraph; int origgraph1; int origgraph2; Begin // Set the mode to 16bit and some resolution set_mode(320,200,16); // Makes the destination graphic a red square destgraph=new_map(100,100,16); map_clear(0,destgraph,rgb(255,0,0)); // Makes the first origin graphic a green square origgraph1=new_map(100,100,16); map_clear(0,origgraph1,rgb(0,255,0)); // Makes the second origin graphic a blue square origgraph2=new_map(100,100,16); map_clear(0,origgraph2,rgb(0,0,255)); // Draws the blue and green squares at a random position on the red square map_put(0,destgraph,origgraph1,rand(0,100),rand(0,100)); map_put(0,destgraph,origgraph2,rand(0,100),rand(0,100)); // Shows the final graph put(0,destgraph,160,100); Repeat frame; Until(key(_esc)) End
Used in example: set_mode(), new_map(), map_clear(), put(), key()
This will result in something like:
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() • |