Awesomeness. Let me know if you need anything else graphical done for it.
I have map editing done up to skin selecting and the actual map editing. Unfortunately, I am at an impasse as to how to actually edit the map. Submission to a repository and Help/About windows also need coded yet.

@Kllrnohj: I was hoping for it to be able to be a wxGrid and have the tile sprites embedded into the grid cells for easy editing and such, but I have not yet found a way to do so. My backup plan was to make a wxGridBagSizer derivative class with bitmaps embedded, but that would be make inserting/deleting rows not on the edges of the map more difficult. If you have any ideas as how to do the first, it would be greatly appreciated, but I think I'll start on the backup a while.
What are you trying to do? I haven't used the calc one, so I'm not sure what your goal is. If you need some sort of click-able grid that you can draw on, you can always just do a wxScrolledWindow and handle the drawing and mouse events yourself. If you need to see how thats done, just wait a day or two for the new Sprite2Hex Studio by yours truly Wink
Kllrnohj wrote:
What are you trying to do? I haven't used the calc one, so I'm not sure what your goal is. If you need some sort of click-able grid that you can draw on, you can always just do a wxScrolledWindow and handle the drawing and mouse events yourself. If you need to see how thats done, just wait a day or two for the new Sprite2Hex Studio by yours truly Wink

I was planning on having a huge grid with the sprites of the tiles within each block. Right clicking would open a context menu with Edit tile, insert row/col, delete row/col, add/clear effects/trainers/warps, plus maybe a few other things. Double clicking would open an Edit Tile dialog. With this, I need to know the position of where the user clicked so I can determine which tile was clicked. So, does the mouse event return the position of the click within the window (ignoring where the wxScrolledWindow is viewing), or does it show from the top-left of the window?

Also, is there a way to draw one bitmap to another?
Thats actually quite easy to do yourself with wxScrolledWindow, as I was pleasantly surprised to find out. There already functions to convert the client (viewable) area to be relative to the virtual area (the client area scrolls over the virtual area).

For example:


Code:
void draw_window::OnPaint( wxPaintEvent& event )
{
   wxPaintDC dc(this);
   PrepareDC( dc );
   
   int v_w = (sprite_w * s_zoom + sprite_w);
   int v_h = (sprite_h * s_zoom + sprite_h);
   
   this->SetVirtualSize( v_w + 1, v_h + 1);
   
   wxSize client_area = this->GetClientSize();
   
   dc.SetPen(wxPen(wxT("WHITE")));
   dc.SetBrush(wxBrush(wxT("WHITE")));
   
   //Erase "background" areas
   dc.DrawRectangle(0, v_h + 1, client_area.x, client_area.y - v_h);
   dc.DrawRectangle(v_w + 1, 0, client_area.x - v_w, client_area.y);
   
   //Draw grid
   dc.SetPen(wxPen(sb_gd.GetColour()));
   
   for (int i_w = 0; i_w <= v_w; i_w += s_zoom + 1) {
      dc.DrawLine( i_w, 0, i_w, v_h);
   }
   for (int i_h = 0; i_h <= v_h; i_h += s_zoom + 1) {
      dc.DrawLine( 0, i_h, v_w, i_h);
   }
}


Will simply draw a grid, but scrolling the window will scroll the grid as well, without any extra code (aside from PrepareDC() - which translates DC client units to logical (virtual) units) - NOTE! wxPaintDC ONLY WORKS IN A PAINT EVENT!!! (use wxClientDC otherwise, like below for the mouse)

A mouse event is somewhat similar


Code:
void draw_window::OnMouse( wxMouseEvent& event )
{
   wxClientDC dc(this);
   PrepareDC(dc);
   wxPoint mloc = event.GetLogicalPosition(dc);
}


mloc will be relative to the virtual area. Then all you have to do is check the mloc.x and mloc.y values to see if they are inside one of the grid squares (I used 2 for loops for this, lemme know if you need that) You don't have to compensate for scrolling at all (beyound PrepareDC() of course)

I know this is in C++ and you need it in Python, but seeing as the wxWidgets API is dang near the same in both, it shouldn't be hard to convert it Wink

Edit: As for drawing one bitmap to another, I think you can draw bitmaps to a wxMemoryDC, and then convert that back to a bitmap - but I'm not 100% sure as to how thats done...
I may have the bitmap drawing down, but right now, Python is yelling that:

Code:
dc=wx.BufferedDC(None, xrc.XRCCTRL(self.frame, "ID_MAP_BUFFER"))


Code:
 File "D:\Python24\Lib\site-packages\wx-2.6-msw-unicode\wx\_gdi.py", line 4326, in __init__
newobj = _gdi_.new_BufferedDC(*args)
NotImplementedError: No matching function for overloaded 'new_BufferedDC'
Script terminated.

I did help(wx.BufferedDC), but nothing stuck out that I was doing something wrong.
Its wx.MemoryDC for bitmap drawing. You then associate the MemoryDC with a bitmap using dc.SelectObject()

Don't use BufferedDC directly, use ClientDC for drawing to the control, and MemoryDC for bitmap drawing.
I see now. Thanks for the help. I think I should be able to get most of the rest of the program (up to music and submission) done today. Hopefully it will be bug-free soon as well.
Update: Map editing works now, but I am in need of more graphics. I need overlays for the map so that users can see where effects, trainers, and warps are. The user should be able to see what is behind it, but also that there is something there. I was thinking of 100% transparent background with a 50%-75% transparent letter (E, T, and W). I tried to make these, but I just can't get the GIMP to get the transparency I need.
Make sure you save as .png - no other image format, including gif - can handle alpha transparency.
Yes I know (everything in the program is png), it's just that I don't know how to make color A transparent to 80% and color B to 100%.
I got the PokéMod submission complete. Now there is a shorter list of things to do yet:
Add a few more global options for a PokéMod
Fix up music selection, add special skin selection
Allow custom ability creation (will take the longest out of this list)
Add a few more move and item effects
Other little things

After all that, it should be ready for a beta release.
I have completed all of the features that I could think of. This means that the beta testing is ready to begin. If you would like to help out with the beta testing, you can pick up either of the two files below. The sources need ClientForm from here if you plan to test out submission of the PokéMods. It is not needed other than that and will ignore the error and disable submission if it isn't found. Validation could probably use some more fine-tune checking, but it checks for duplicates and invalid references to items, moves and such (i.e. it doesn't exist) and some other things that would cause bigger errors that would probably be show-stoppers or be a flat out error. If you use the executable, please send me an email with pokemodrpc.exe.log as well as a description telling what you did that caused it, but if you're not sure, that's fine, the log file should have everything necessary. That will help the most with debugging.

Also, if anyone would like to make skins for trainers and effects, it would be greatly appreciated. They are 192x32 sprites with 6 32x32 sprites within it. The order goes as such:
up, up animation, down, down animation, left, left animation
Please submit them as PNG with a transparent background.
Tiles would also be highly appreciated (32x32 PNG without transparency)

But enough with the details:
Sources
Windows executable (7z archive) (run pmpc/pokemodrpc.exe)
zip format is available upon request, but it is over a megabyte larger than the 7z.
Feature request - allow resizing Smile (of the PMPC window, I mean)
Kllrnohj wrote:
Feature request - allow resizing Smile (of the PMPC window, I mean)

I thought about it, but the size of the elements would be the same, leaving lots of empty space. I'm also going to change sort bag and split day into lists where the user can choose which items are sorted and what times of the day are available as well as start times of each.
One of the tab sections forces you to "scroll" through the tabs to see them all. So either make it slightly wider so that you don't ever need to scroll, or allow resizing. Resizing allows more freedom, even if things don't scale Smile
Resizing would force it to be almost twice as wide and would be uber ugly and take up unnecessary real estate. I'll put those tabs into a multiline so that the screen doesn't need to scroll. I also found a few others that scrolled and they're going to be muiltilined as well. I'll also try to play around with the sizes a bit to see if I can stop some of the pages from touching the edges and looking ugly. It'll be up by 2:30 if you want to update (which also has other numerous bugfixes).
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement