Map new

From Bennu Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


Definition

INT map_new ( <INT width> , <INT height> , <INT depth>, [ <INT flags> ] )

Creates a new graphic, sets the color of all pixels to 0 (transparent) and puts it in the system file.

The previous name new_map() is deprecated.

Parameters

INT width - The width of the to be created graph in pixels.
INT height - The height of the to be created graph in pixels.
INT depth - The color depth of the to be created graph in bits
[INT flags] - can be: B_CLEAR (bitmap clear) or 0 (no clear new bitmap)

Returns

INT : GraphID

0 - There was an error.
>0 - The graphID of the newly created graphic.

Errors

Unsupported color depth - The specified color depth is not supported. (Console)
Insufficient memory - There is insufficient memory available. This error doesn't occur often. (Console)

Example

import "mod_map"
import "mod_screen"
import "mod_key"

Process Main()
Private
    int map;
Begin

    // Create a new graph of size 100x100 and color depth of 8bit
    map = map_new(100,100,8);
    
    // Clear the map red
    map_clear(0,map,rgb(255,0,0));

    // Put it in the center of the screen
    put(0,map,160,100);

    Repeat
        frame;
    Until(key(_ESC))

End

Used in example: map_new(), map_clear(), put(), key()

This will result in something like:

New map.png
Putting a new map


Mod_map
Constants
B'"`UNIQ--nowiki-00000004-QINU`"'CLEARCHARSET'"`UNIQ--nowiki-00000004-QINU`"'CP850CHARSET'"`UNIQ--nowiki-00000004-QINU`"'ISO8859G'"`UNIQ--nowiki-00000004-QINU`"'ANIMATION'"`UNIQ--nowiki-00000004-QINU`"'SPEEDG'"`UNIQ--nowiki-00000004-QINU`"'ANIMATION'"`UNIQ--nowiki-00000004-QINU`"'STEPG'"`UNIQ--nowiki-00000004-QINU`"'ANIMATION'"`UNIQ--nowiki-00000004-QINU`"'STEPSG'"`UNIQ--nowiki-00000004-QINU`"'CENTER'"`UNIQ--nowiki-00000004-QINU`"'XG'"`UNIQ--nowiki-00000004-QINU`"'CENTER'"`UNIQ--nowiki-00000004-QINU`"'YG'"`UNIQ--nowiki-00000004-QINU`"'DEPTHG'"`UNIQ--nowiki-00000004-QINU`"'FRAMESG'"`UNIQ--nowiki-00000004-QINU`"'HEIGHTG'"`UNIQ--nowiki-00000004-QINU`"'PITCHG'"`UNIQ--nowiki-00000004-QINU`"'WIDEG'"`UNIQ--nowiki-00000004-QINU`"'WIDTHG'"`UNIQ--nowiki-00000004-QINU`"'X'"`UNIQ--nowiki-00000004-QINU`"'CENTERG'"`UNIQ--nowiki-00000004-QINU`"'Y'"`UNIQ--nowiki-00000004-QINU`"'CENTERNFB'"`UNIQ--nowiki-00000004-QINU`"'FIXEDWIDTHNFB'"`UNIQ--nowiki-00000004-QINU`"'VARIABLEWIDTH
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()