help blting tiles
I was planning on using this code to blt my tiles
But as I look at it, it wont blt partial tiles like when I want to scroll right I want it to show less and less of the left tiles as I scroll more and more right anyone know how to do this? Please help me
firsttilex=camerax/TileWidth;
firsttiley=cameray/TileWidth;
int xcounter=0;
int ycounter=0;
for(int y=firsttiley;y<MAXYTILES;y++)
{
for(int x=firsttilex;x<MAXXTILES;x++)
{
map[y][x].dgraphic.right=xcounter+=TILEWIDTH;
map[y][x].dgraphic.left=xcounter;
map[y][x].dgraphic.top=ycounter;
map[y][x].dgraphic.bottom=ycounter+=TILEWIDTH;
BltTile(map[x][y].dgraphic);
xcounter++;
}
ycounter++;
}
OoMMMoO
Just right a function to clip a destination and source rectangle into a bounding box. Also, using nested loops can be optimized to a single while loop that increments a tile pointer until it is done with the last tile as long as the tiles are stored in a single connected block of memory.
"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
![Resist Windows XP''s Invasive Production Activation Technology!](http://www.crosswinds.net/~druidgames/resist.jpg)
http://www.gdarchive.net/druidgames/
"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
![Resist Windows XP''s Invasive Production Activation Technology!](http://www.crosswinds.net/~druidgames/resist.jpg)
http://www.gdarchive.net/druidgames/
That wasnt much help I know I need to do that but Im not sure how. The code I have will only scroll tile by tile and I want it to scrool pixel by pixel anyone have any help?
Well, have a camera object that stores the current x and y offset from the "center". Then use a function like the following (you could probably use quadtrees also, there was a tuturial on them a little while ago
):
"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
![Resist Windows XP''s Invasive Production Activation Technology!](http://www.crosswinds.net/~druidgames/resist.jpg)
http://www.gdarchive.net/druidgames/
![](smile.gif)
|
"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
![Resist Windows XP''s Invasive Production Activation Technology!](http://www.crosswinds.net/~druidgames/resist.jpg)
http://www.gdarchive.net/druidgames/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement