Click to See Complete Forum and Search --> : How to make my layer not disapear when out of screen? (direct draw)
Ultimasnake
Sep 21st, 2002, 01:39 PM
i am creating a game with the use of direct draw i have a background a level on top of it and a character on top of that. the level moves , not the character , how to make sure the level does not disapear when it goes out of my screen? :S i just started learning Direct draw and starting to get it but need this fixed to test some things :S
Dude1
Sep 21st, 2002, 08:12 PM
I'm assuming you are loading in a backgroud that is bigger than the screen size right? Just download the DirectDraw Full screen tutorial from dx4vb and modify it like this:
'get the area of the screen where our window is
rBack.Left = Abs(sx1)
rBack.Right = Abs(800 - sx1)
rBack.Top = Abs(sy1)
rBack.Bottom = Abs(600 - sy1)
rBack is the rect of the background and sx1 and sy1 is the position of the backround. So here I have my screen set to 800 by 600 with a bigger background which scrolls without disappering.
Dude1
Sep 21st, 2002, 08:24 PM
Or better yet here is demo I made which is based of the Fullscreen tutorial from dx4vb. I couldn't upload the bg picture because it's too big. You'll need to create a bmp called "BacktestFinal2.bmp" with a size of 2000 by 1300 - or you can change the code to your needs.
Ultimasnake
Sep 22nd, 2002, 03:06 AM
aargh i cant seem to get it right i dont see why it keeps on the screen like you did, and keeps disapearing with my code , btw you got the code form the same place i did ;) it looks rather simular only mine is a bit more organised :p
here is my project , it isnt much yet so there is no trouble posting it :P http://www.xs4all.nl/~jleroy/tuxball.zip
please help me fix it , and comment what you changed :S
Ultimasnake
Sep 22nd, 2002, 11:05 AM
anybody got an solution for me? i looked at his example and at some others and cant seem to find what i am doing wrong/diffrent :S
Machaira
Sep 22nd, 2002, 07:16 PM
What you have is a clipping problem. Instead of trying to blit the whole surface, you need to blit the visible portion. Sorry, but I don't have the time to fix it for you. I'm not sure where you got the code from but if that code works, there should be some kind of clipping code in it.
Ultimasnake
Sep 23rd, 2002, 01:25 AM
Well the code example i had was just a picture on the screen i created the rest myself , and i really dont have a clue how i can have made a clipping thing .. :(
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.