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 - HPEN troubles | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
Lenophis Super Koopa Level: 44 Posts: 494/830 EXP: 584360 For next: 26925 Since: 03-15-04 From: Duluth, MN Since last post: 4 hours Last activity: 3 hours |
| ||
Last month, while still in the preparation stages for Jade's map editor, I was throwing in what it should be able to do (you know, besides edit the map.) FFHackster gives you the option to display what tile you have selected, like so: Well, now I'm trying to do so with Jade. The purpose, to make editing the map like so: easier on the user. Sounds simple so far? For the most part, but I always wind up making things complicated. About 3 weeks ago, I floated an idea to a friend of mine about letting the user customize the colors of those boxes, among other things related to this issue. After looking through MSDN, turns out that something called SetDCPenColor can, but is restricted to the 2k and XP users. At least it appears that way, so that's out. I think I found a way around the color changing, but I now have this problem: I don't know how to draw with them. They are declared and created (1 pixel wide) but beyond that I don't know what to do, and MSDN's example isn't the greatest. So my question is, how do I make the box dimensions and then draw that box afterwards? Bonus question: My method of getting around the color changing is making the pens local variables, but do they still need to be deleted when I'm done? |
|||
beneficii Lakitu Level: 36 Posts: 150/567 EXP: 299656 For next: 8454 Since: 06-27-04 From: Cordova, TN, USA Since last post: 14 hours Last activity: 6 hours |
| ||
Me, in my program, I'm doing it the hard way. Basically, my editor will draw all boxes onto the window, clears them off, etc., without consulting the Windows API. After getting the bitmap with all the settings I want, I'll finally draw it onto the screen. Maybe I'll do it the WInAPI way later, but I just want to do it my way for now. Maybe when people start writing better tutorials on the subject.... | |||
sloat Level: 16 Posts: 61/85 EXP: 18044 For next: 2212 Since: 05-21-04 From: South Central Delaware Since last post: 19 days Last activity: 5 hours |
| ||
use the CreatePen function if you need to specify a width. once you create it, you use SelectObject to set it to the DC you want to draw on. After that, use the Rectangle function to draw a rectangle. The shape is outlined with the pen and filled with the current brush. If you want it to just be the outline, you might have to use GetStockObject with the NULL_BRUSH value and select the object it returns in to the DC. I'm not sure if DCs use a null brush by default. If you only use SetDCPenColor, then you don't need to delete anything. You only need to delete objects that you create. There are exceptions, but usually MSDN will tell you if you need to delete an object from a function or not. In my editor, I used the PatBlt function to draw an inverse selection rectangle. There are two problems with that though. 1) it's a little more complicated, and 2) it doesn't show up on gray tiles. Feel free to check out the source to my project if you'd like. It's on my website. |
|||
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: 5118/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
If you're not sure whether something needs to be deleted, try deleting it anyway and check the return code. If the delete fails, it probably isn't necessary. |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - HPEN troubles | | | |