C++ Read .bmp write to Matrix by Srilthe20th Feb 2010 9:17
|
---|
Summary C++ reads a .bmp and slices tiles 19 across and 8 down then writes to matrix Description C++ Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com /* srilthe@yahoo.com reads a .bmp and slices tiles 19 across and 8 down then writes to matrix map editor http://tilemap.co.uk/zipfiles/mapwin1422.zip characters http://reinerstileset.4players.de/humansE.html take map tiles and put into matrix dbCreateAnimatedSprite reads tiles in top-down left to right dbSetMatrixTile co-ords are down-up left to right with first co-ords at 0,0 */ #include "DarkGDK.h" int i, ii, iA, iD, iLeft, iRight, iTop, iBottom; void DarkGDK ( void ) { dbSyncOn ( ); dbSyncRate ( 60 ); dbSetImageColorKey ( 255, 0, 255 ); dbCreateAnimatedSprite ( 1, "tiles.BMP", 19, 8, 1 ); //dbMakeMatrix ( int MatrixNumber, float Width, float Height, int Xsegments, int Zsegments ) dbMakeMatrix ( 1, 252, 126, 19, 8 ); //dbLoadImage ( char* szFilename, int iImage, int iFlag ) dbLoadImage ( "tiles.BMP", 1); //dbPrepareMatrixTexture ( int MatrixNumber, int ImageNumber, int Across, int Down ) dbPrepareMatrixTexture ( 1, 1, 19, 8 ); dbSetMatrixWireframeOff ( 1 ); i = 1; for (iD = 7; iD >= 0; iD--) { for (iA = 0; iA <= 18; iA++) { //dbSetMatrixTile ( int MatrixNumber, float Tilex, float Tilez, int TileNumber ) dbSetMatrixTile ( 1, iA, iD, i++ ); } } dbUpdateMatrix ( 1 ); dbMakeCamera ( 1 ); ii = 0; while ( LoopGDK ( ) ) { if (ii++ > 180) ii = 0; dbPositionCamera ( 1, 100, 300, 100 ); dbPointCamera ( 1, 100, 0, 100 ); dbUpdateMatrix ( 1 ); if ( dbEscapeKey ( ) ) break; dbSync ( ); } return; } |