🔒 Locked
Displaying a single tile help
Advertisement
Original Post
Can anyone explain how to, or point me in the direction of something to help me, display a single 32*32 pixel tile on the screen?
I can display full screen bitmaps on the screen but when i try and get a single tile it goes wrong and exits the program without displaying anything.
a tiling tutorial form the ground up would be good.
Thanks for any help
"People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
You have to think about 3 main things:
Take a look at CDX''s map class to see how you can have smooth scrolling maps.
-------
Andrew
- Source location of the tile ( source RECT ).
- If you are trying to blt from the wrong place on the surface you won''t get anything. Make sure you give the right RECT location.
- Destination location of tile ( dest RECT )
- Same thing here. If you are trying to blt to an invalid location nothing will happen.
- Clipping.
- Some DX blt functions will NOT prefrom autoclipping so that if the tile is not totaly on the screen it won''t be displayed at all. Other blt functions do clip so read up on the ones you are using.
- Some DX blt functions will NOT prefrom autoclipping so that if the tile is not totaly on the screen it won''t be displayed at all. Other blt functions do clip so read up on the ones you are using.
Take a look at CDX''s map class to see how you can have smooth scrolling maps.
-------
Andrew
Thanks for the response guys.
I have no idea why it doesnt work. Im using the blt() function. the destination rect is 0,0 to 32,32 the source rectangle is 0,0 to 32,32. But when i execute this the program just exits. I put a messagebox function to display and error if the blt function fails and it does. So i know it is the blt function that is going wrong i just dont know why.
"People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
I have no idea why it doesnt work. Im using the blt() function. the destination rect is 0,0 to 32,32 the source rectangle is 0,0 to 32,32. But when i execute this the program just exits. I put a messagebox function to display and error if the blt function fails and it does. So i know it is the blt function that is going wrong i just dont know why.
"People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
A few things to check:
Could also try BltFast().
-------
Andrew
- Is the tile actually loaded correctly onto your source surface?
- What is the error from the blt?
- Make sure that the source and dest rects are in the right place in the function call.
- If it just exits ( unexpectantly ) then there may be problems elsewhere ( like null pointer )
Could also try BltFast().
-------
Andrew
i think i might have found the problem. is it possible to put a 32*32 pixel bitmap onto the primary surface from a file. i.e. i am loading the bitmap and then trying to put it straight onto the primary surface. is this the problem? I know how to create offscreen surfaces but i didnt want to bother setting any up until i could actually load and display a single tile.
"People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
"People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
quote:
Original post by Zeke
i am loading the bitmap and then trying to put it straight onto the primary surface. is this the problem?
I didn''t think that you can do that. I thought blt used two surfaces. How are you loading the bitmap?
I usually have the primary surface, the back buffer and a surface with all my tiles on it. I then blt from my tile surface to the back buffer and then flip().
-------
Andrew
I am using the function from tricks of the window game programming guru''s:
"People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
|
"People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement