Skip to main content
gamedev.net
🔒 Locked

Copy

Started by voip_888 Oct 4, 2002 at 3:51 AM 0 replies 200+ views
Original Post
voip_888
voip_888
I am new to directX, and I am going to make a moving map software, where it has 72 bitmaps (500 x 500 pixels). The questions is, would it be a good idea to use tiling for this type of application? and do I have to use the SetViewPort command? I noticed that if we use the copyRects, it won''t show the bitmaps, when the destination rect is smaller than the source. however, in my code, I already check if the image is clipped, if it is, I reduced the size, but it still doesn''t show up. can you tell me what have I done wrong. Here is the copyRects code: HRESULT CEngine:laceTile(IDirect3DSurface8* pBackBuffer, IDirect3DSurface8* pTileSurface, int TileNumber, int DstCol, int DstRow, int numTileCols, int numMapCols, int tileSize, int xOffset, int yOffset) { RECT SrcTileRect; POINT DstPoint; /* SrcTileRect.left = TileNumber2SourceX(TileNumber, numTileCols, tileSize); SrcTileRect.right = SrcTileRect.left + tileSize; SrcTileRect.top = TileNumber2SourceY(TileNumber, numTileCols, tileSize); SrcTileRect.bottom = SrcTileRect.top + tileSize; */ SrcTileRect.left = 0; SrcTileRect.right = tileSize; SrcTileRect.top = 0; SrcTileRect.bottom = tileSize; DstPoint.x = Column2X(DstCol, tileSize, numMapCols) + xOffset; DstPoint.y = Row2Y(DstRow,tileSize) + yOffset; // check for clipping if(DstPoint.x + 500 > 1024) { // reduce the rect size SrcTileRect.right = 1024 - DstPoint.x; } if(DstPoint.y + 500 > 768) { // Reduce the rect size SrcTileRect.bottom = 600 - DstPoint.y; } HRESULT hResult = m_Direct3D.GetDevice()->CopyRects(pTileSurface, &SrcTileRect, 1, pBackBuffer, &DstPoint); return hResult; And can you provide me a sample code which can centered the image in the viewport when we give a coordinate of a full map. thanks in advance Tony

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.