Search found 99 matches

by Disch
Fri Feb 06, 2009 3:11 pm
Forum: C++ Development
Topic: Best way to do picking?
Replies: 5
Views: 796

Most likely a reference counting problem. Now that I tried it I get the same problem with SelectObjectAsSource -- which I thought would prevent this problem. Oh well. wxBitmap bmppicker(bmp); <-- doesn't make a direct copy right away, it simply increases the reference count. So the solution here is ...
by Disch
Fri Feb 06, 2009 3:01 pm
Forum: C++ Development
Topic: Wait for event - Need help
Replies: 3
Views: 1397

But in this case we are not waiting for a specific event, right? I want my process to wait for a particular custom event. That's pretty much exactly what this does -- unless I'm misunderstanding you. This code would wait until the custom event is triggered. The reason why is because it waits for th...
by Disch
Fri Feb 06, 2009 5:10 am
Forum: C++ Development
Topic: Wait for event - Need help
Replies: 3
Views: 1397

This seems like a strange design... but you might be able to accomplish this by sleeping with periodic calls to wxApp::Yield to keep the event pump moving. void MyProcess::test() { loadfile(); // wait for event eventreceived = false; while(!eventreceived) { wxMilliSleep(100); wxGetApp().Yield(); } /...
by Disch
Fri Feb 06, 2009 2:07 am
Forum: C++ Development
Topic: draw transparent image over another image
Replies: 12
Views: 1898

The only mention I noticed in the reference docs is a short blurb in wxDC: Support for Transparency / Alpha Channel On Mac OS X when using Core Graphics (wx_MAC_USE_CORE_GRAPHICS set to 1) colors with alpha are supported, so instances wxPen or wxBrush that are built from wxColour use the color's alp...
by Disch
Thu Feb 05, 2009 11:22 pm
Forum: General Development
Topic: Simple 2D game making with WxWidgets - a narrative in parts
Replies: 10
Views: 2039

I am a little concerned that if I'm not careful dealing with everything on screen (actors and interactive objects) may become unmanageable if I don't design the actor, object and image building classes well at this early stage I have some experience in game programming, and I can say without a doub...
by Disch
Thu Feb 05, 2009 9:56 pm
Forum: C++ Development
Topic: draw transparent image over another image
Replies: 12
Views: 1898

I'm not 100% sure of this, but I don't think alpha blending is supported by DC blit functions or bitmap drawing functions. Only solutions I can think of would be to do the blitting by hand (ew -- especilly since you can't access raw pixel data in wxBitmaps, so you'd have to do wxImage conversions). ...
by Disch
Thu Feb 05, 2009 9:30 pm
Forum: C++ Development
Topic: Best way to do picking?
Replies: 5
Views: 796

Glad I can help :) Just a question about your code, why are you creating a new bitmap everytime, shouldn't you pass by reference? I am passing the original bitmap by reference (wxBitmap & ), but I'm creating a copy for the 'picker' image because I'd assume you wouldn't want this code to clear your o...
by Disch
Thu Feb 05, 2009 6:51 pm
Forum: Compiler / Linking / IDE Related
Topic: C++ Precompiled Headers in VS2002
Replies: 6
Views: 935

I use that precompiled header also and you can find it in your intermediate files folder. It is by default in the DEBUG or RELEASE folder under the project folder. I just checked again to be sure and there are no pch files in any of my project's folders. Do you mean *my* project folder? Or the wx p...
by Disch
Thu Feb 05, 2009 6:35 pm
Forum: C++ Development
Topic: Best way to do picking?
Replies: 5
Views: 796

void MyClass::DrawBitmapToPickerDC(const wxBitmap& bmp,const wxColour& pickercolor,int x,int y) { // duplicate the bitmap wxBitmap pickerbmp(bmp); // slap it in a DC wxMemoryDC dc; dc.SelectObjectAsSource(pickerbmp); // clear the image to be a solid color -- but this retains // the selected mask. d...
by Disch
Thu Feb 05, 2009 3:31 pm
Forum: C++ Development
Topic: Mouse Events on Rectangles?
Replies: 5
Views: 699

Re: Mouse Events on Rectangles?

I know the obvious way is to make one mouse event callback and then have it search through the rectangles and see which one was pressed, but that would be very dirty and slow. This isn't really slow... this is essentially what the OS does anyway (how else can it figure out which window of which pro...
by Disch
Thu Feb 05, 2009 3:02 pm
Forum: C++ Development
Topic: RTTI, dynamic casting, wxClientData questions
Replies: 6
Views: 874

I don't think you have to derive your class from wxObject. (wxClientData is already derived from wxObject) The docs make no mention of that. Parent classes are usually listed in the docs in a "derived from" section, I see no such section on wxClientData 's page. This can only lead me to assume wxCl...
by Disch
Wed Feb 04, 2009 10:26 pm
Forum: C++ Development
Topic: wxArrayString and simple crash. Need some help!
Replies: 3
Views: 1082

Re: wxArrayString and simple memory leak. Need some help!

What's the problem here in saving arraytemp3??? arraytemp3 is of type wxArrayString, not of type wxString. If you look at wxFFile::Write, there isn't a version of the function which takes wxArrayString, only one that takes wxString (and another which takes const void* -- but that's not what you wan...
by Disch
Wed Feb 04, 2009 8:30 pm
Forum: C++ Development
Topic: Generic way to intercept an event before processing ?
Replies: 9
Views: 1188

It's ashame, in wxwidgets manual, it clearly says "This function is called before processing any event and allows the application to preempt the processing of some events". But the frame is iconize before FilterEvent() catches it. This makes sense to me. Remeber that the iconizing triggers the even...
by Disch
Wed Feb 04, 2009 4:00 pm
Forum: C++ Development
Topic: wxScrolledWindow not working with my custom controls..
Replies: 2
Views: 522

You need to call SetVirtualSize with the size that the scrolled window is to scroll around (this would be greater than the client size of the wxScrolledWindow if there is to be a scroll bar) pMyScrolled->SetVirtualSize(pScrolledSizer->GetMinSize()); Do this after adding all your controls. You'll nee...
by Disch
Wed Feb 04, 2009 3:28 pm
Forum: C++ Development
Topic: Generic way to intercept an event before processing ?
Replies: 9
Views: 1188

Here's a hackish idea that seems to work on Windows: int MyApp::FilterEvent(wxEvent& evt) { if( evt.GetEventType() == wxEVT_ICONIZE && ((wxIconizeEvent&)evt).Iconized() ) { myframe->Iconize(false); } return -1; } If you experience flickering on other platforms you could try wrapping a freeze/thaw ar...