|
-
Oct 12th, 2000, 07:41 PM
#1
Thread Starter
Addicted Member
I am having trouble with storing graphics. I created a new DC and BitBlted my tileset on it. Now I need to copy the tiles from there and paste them right below the tileset to make the actual map of the current area. All of the code is working except the part that BitBlts the tiles from the set to the map. I wanna do this all on the same DC but it doesn't work... What am I doing wroooong ohh someone TELL MEEEE I'M GOING INSANE!!!!!!!! ...er..sorry. :)
To understand recursion, one must first understand the concept of recursion.
-
Oct 12th, 2000, 08:08 PM
#2
transcendental analytic
YOu shouldn't have the map area and the tileset on the same DC, but if you just pasted your code here then we could understand what's not working?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 13th, 2000, 02:25 PM
#3
Thread Starter
Addicted Member
Why can't I use the same DC for map and tiles? I thought the whole idea of VB is to save space... :| Anywayz, let's forget about what DC I save it on for now. I just need to know how to BitBlt something to a DC. The way i got the tileset there was with this:
Code:
MyDC = CreateCompatibleDC(Form1.hdc)
TilePic = SelectObject(MyDC, LoadPicture(AppPath & TileSet & ".gif"))
BitBlt MyDC, 0, 0, 493, 493, TilePic, 0, 0, vbSrcCopy
This works ok. The tileset goes into the DC and is stored there. Now, I need to copy individual tiles from there and BitBlt them elsewhere to build the map. I currently have the code inside 2 for loops and it is like this:
Code:
BitBlt MyDC, ReadTilesX * 46, ReadTilesY * 46 + 493, 46, 46, MyDC, TileArray(ReadTilesX, ReadTilesY).TileSrcX, TileArray(ReadTilesX, ReadTilesY).TileSrcY, vbSrcCopy
So all that does is copy a tile from the DC and BitBlts it elsewhere, on the same DC. Well, I WANT it to do that anyway... I think I'm missing something here...do I need to use that select object thing again? Or is it because i'm blting to the same DC!? Someone tell me what iz wrong!!
To understand recursion, one must first understand the concept of recursion.
-
Oct 13th, 2000, 02:45 PM
#4
transcendental analytic
It may ofcourse be that you blt out of the contents of the bitmap, and that will automatically fall off without any errors. Now why don't you try to blit it to another DC that surely is empty and has the size you need to make a map? Use createcompatiblebitmap and you'll have another bitmap.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 13th, 2000, 03:23 PM
#5
Thread Starter
Addicted Member
Ok It still doesn't work but I'm not really sure if I'm doing it right. I tried this:
Code:
MapBitmap = CreateCompatibleBitmap(Form1.hdc,MapWidth,MapHeight)
Then I just substituted MyDC with MapBitmap in that piece of code in my last reply. Please tell me i'm doing something wrong here.
To understand recursion, one must first understand the concept of recursion.
-
Oct 13th, 2000, 03:29 PM
#6
transcendental analytic
did you use selectobject with thatone on the new DC?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 13th, 2000, 03:32 PM
#7
Thread Starter
Addicted Member
Ahh, I thought it might be because of that. I'm not really sure how or when to use SelectObject. can you quickly explain it and how i can use it in my situatioN?
To understand recursion, one must first understand the concept of recursion.
-
Oct 13th, 2000, 03:42 PM
#8
transcendental analytic
Code:
ahdc = CreateCompatibleDC(Form1.hdc)
SelectObject ahdc, MapBitmap
BitBlt hdc, 0, 0, MapWidth, MapHeight, ahdc, 0, 0, vbSrcCopy
Now you just use Selectobject the way you did before, attach the mapbitmap into your new dc, here called ahdc
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 13th, 2000, 03:57 PM
#9
Thread Starter
Addicted Member
KYAHAHAHAHAHAHA IT'S ALIIIIIVEEEE!!! Er... hi... ;D It works now, you rawk kedaman ;D
To understand recursion, one must first understand the concept of recursion.
-
Oct 13th, 2000, 04:21 PM
#10
transcendental analytic
hehe have fun!
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|