Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - Drawing quickly in VB | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
Squash Monster New Age Retro Hippie Togateiru Fohku Kohgeki!! GRUNGE no HAMSTER otona bite Peace love and turnpike! Level: 40 Posts: 97/677 EXP: 430507 For next: 10802 Since: 03-15-04 From: Maryland (of the Country Between Canada and Mexico) Since last post: 5 hours Last activity: 5 hours |
| ||
I'm making a simple game in VB as practice for colision detection and such. When the game starts, it randomly generates some terrain. In it, the player puts in some numbers, hits a button, and watches his tank fire a shell in a manner according to the numbers. Once it hits the ground, it blows up, and takes some ground with it. Everything works fine, but there are a few things I'd like to know if I could do. I fill in the terrain by making a number of vertical lines, as you can probably see since I randomly vary their color. My original plan was to section off the bottom with lines and then use a fill function to fill the area, but I coudn't find a function to fill the area. Question one: does a fill function exist? (I'm perfectly willing to call outside libraries and such, I'd just need to know what to call exactly). Anyway, I quite like the color variation I've implemented, except for the fact that it's only vertical. I tried filling each line pixel by pixel, but even before adding a varied color (which would need another extra bit of processing to check the pixel next to it) it would start taking quite a while to proccess. So that brings up a second question. Question two: is there a faster way to draw in individual pixels? The only fast drawing technique I know is bitblt, and I don't really think that helps in any manner here. |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 692/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Are you using SetPixel for that? I used this to draw the gridlines in Hack-O-Matic's map editor: Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, lpPoint As POINTAPI) As Long Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long Type POINTAPI x As Long y As Long End Type Dim PAPI As POINTAPI PAPI.x = 0 PAPI.y = 0 For i = 1 To MaxOnScreenTiles 'Vertical MoveToEx BackBuffer, 64 * i, 0, PAPI LineTo BackBuffer, 64 * i, 64 * MaxOnScreenTiles 'Horizontal MoveToEx BackBuffer, 0, 64 * i, PAPI LineTo BackBuffer, 64 * MaxOnScreenTiles, 64 * i Next i Of course the actual code is a bit different, but this would do the same thing. (Just not using constants and with the variables/functions declared in the same place. ) The lines are drawn on a buffer which I draw on the window using BitBlt. Only thing is, I draw them in black which is the default colour, so I'm not sure how to change the colour. |
|||
DJ Bouche Level: 11 Posts: 10/35 EXP: 5060 For next: 925 Since: 03-15-04 From: Bligh Park, NSW, Australia Since last post: 108 days Last activity: 14 days |
| ||
Declare Function FloodFill Lib "gdi32" Alias "FloodFill" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long Declare Function ExtFloodFill Lib "gdi32" Alias "ExtFloodFill" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long, ByVal wFillType As Long) As Long Handy fill routines |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - Drawing quickly in VB | | | |