Map put

From Bennu Wiki
Jump to: navigation, search


Syntax

INT map_put ( <INT fileID> , <INT destinationGraphID> , <INT originGraphID> , <INT x> , <INT y> )

Description

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.

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.

Returns

INT : true

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.

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.

Example

import "mod_video"
import "mod_map"
import "mod_wm"

Process Main()
Private
    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(exit_status)

End

Used in example: set_mode(), new_map(), map_clear(), map_put(), put(), key(), exit_status

This will result in something like:

Map put.png
A blue square and a green square drawn on a red square


Mod_map
Globals None
Imported:
FullscreenGraphmodeM7ScalemodeScaleresolutionScaleresolutionaspectratioScaleresolutionorientation
Constants BCLEARCHARSETCP850CHARSETISO8859GANIMATIONSPEEDGANIMATIONSTEPGANIMATIONSTEPSGCENTERXGCENTERYGDEPTHGFRAMESGHEIGHTGPITCHGWIDEGWIDTHGXCENTERGYCENTERNFBFIXEDWIDTHNFBVARIABLEWIDTH
Imported:
BABLENDBALPHABHMIRRORBNOCOLORKEYBSBLENDBTRANSLUCENTBVMIRRORDOUBLEBUFFERHWSURFACEM1024X768M1280X1024M320X200M320X240M320X400M360X240M376X282M400X300M512X384M640X400M640X480M800X600MODE16BITSMODE16BPPMODE2XSCALEMODE8BITSMODE8BPPMODEDOUBLEBUFFERMODEFRAMELESSMODEFULLSCREENMODEHARDWAREMODEMODALMODEWAITVSYNCMODEWINDOW
Functions Bdfload()Centerset()Colorfind()Colorsget()Colorsset()Fade()Fadeoff()Fadeon()Fntload()Fntnew()Fntsave()Fntunload()Fpgadd()Fpgdel()Fpgexists()Fpgload()Fpgnew()Fpgsave()Fpgunload()Getpixel()Glyphget()Glyphset()Graphicinfo()Graphicset()Mapblockcopy()Mapbuffer()Mapclear()Mapclone()Mapdel()Mapexists()Mapgetpixel()Mapinfo()Mapinfoget()Mapinfoset()Mapload()Mapname()Mapnew()Mapput()Mapputpixel()Mapsave()Mapsetname()Mapunload()Mapxput()Mapxputnp()Palclone()Paldel()Palget()Palload()Palmapassign()Palmapgetid()Palmapremove()Palnew()Palrefresh()Palsave()Palset()Palunload()Paletteconvert()Paletteroll()Pcxload()Pngload()Pngsave()Pointget()Pointset()Putpixel()Rgb()Rgbget()Rgba()Rgbaget()