|
DrawMap | |
DrawMap MapIndex, LevelIndex, Xpos, Ypos | |
Parameters: MapIndex = The Index Identifier of the Map you wish to draw a level from. LevelIndex = The index of the level you wish to draw. Xpos = The X coordinate to draw the level at Ypos = The Y coordinate to draw the level at |
|
Returns: NONE | |
DrawMap will draw a level to current surface (the screen or an image). When map levels are drawn, they are treated like huge sprites, with the drawing location being the top left hand coordinate of the level. Just like drawing a large image to the screen, PlayBASIC automatically calculates visible portion of the level and only renders that, anything outside of the screen is ignored. FACTS: * DrawMap automatically handles all clipping when rendering the map to the current surface for you. * Certain combinations of the map rendering can be quite slow due to excessive video memory access. For example attempting to render an AFX formatted map to the main screen, forces the render engine to read pixel data over the video bus, which is very slow on the PC. The recommended approach for drawing AFX is to draw the scene to an FX formatted screen sized image, then transfer that to the screen. It's the same rules as image rendering, so we highly recommend reading the images tutorial for the best practices. * DrawMap will draw the rects over the blocks when MapDebug is enabled. Example #1: This example creates a map, containing a set of randomly coloured blocks and level. It draws the map at the mouse pointers current position, as if the map was a sprite.
Example #2: The attached example is basically the samem except we're now loading a set of grass blocks. |
|
Example Source: Download This Example
|
Related Info: | CreateLevel | CreateMap | LoadMapGfx | Maps | NewLevel | NewMap : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |