I use OpenIL for all my image reading and writing. OpenIL supports writing .jpgs and .gifs (and many other formats), though it really helps to be familiar with some OpenGL since OpenIL is sturctured very similarly. There are quite a few image libraries out there that can handle what you want, so you shouldn't have to reinvent the wheel.
jfugate
Posts
-
Gdiplus and Jpeg save -
Combination of an OpenGL CView, an OpenGL CWnd, and GDII've got an open source game that's a port of the board game Settlers of Catan, and it uses OpenGL in a CView for the game rendering and GDI over that for information display and user interaction. The game is available at http://www.settlers3d.net and the source is all at SourceForge.net under the project 'settlers3d'. I am now in the process of adding a brand-new expansion to the game and I want to have a separate 3D rendering of the progress of a certain ship piece over a certain tile (called the 'barbarian attack' in the game). This rendering will be informational only and totally static, meaning the users can't interact with it like they do the main CView OpenGL window. I'm trying to create a new CWnd based OpenGL window for this barbarian attack that is displayed in its own area that overlays the OpenGL CView. (It actually slides in and out from the side of the game window, but that's extemperaneous to the problem.) I have created the new OpenGL CWnd and gotten it to display what I want, however, all of the Windows GDI drawing is now very messed up. Here is a screenshot. It seems that with the OpenGL CWnd turned on, something is messed up with the display contexts for all of the GDI drawing. If I comment out the Create() call for the OpenGL CWnd, everything works properly again. If I move the application window around with the mouse, the GDI snaps back into correct drawing, but as soon as I do something in the game that changes the GDI information displays, nothing updates properly. Does anyone have any idea what would cause this? I don't want to clutter up the question with massive source code pastes, but I can post some links to the files on SourceForge if it would help.
-
Parsing the results of an .ASP page from within VC++Great, thanks. That's exactly what I was looking for. I should have dug around in MFC a little more before posting.
-
Parsing the results of an .ASP page from within VC++I'm working on a kind of off-the-wall idea with a guy to setup a homegrown game finder for my software (http://www.settlers3d.net). What I'd like to do is be able to get to an .ASP page, which will have only text on it, from within the program and then parse the text. Basically, the way we're doing this is that the host player's version of the game will hit a separate.ASP page that will add the game to an Access database on the site. Then the client's game will hit the .ASP page I'm mentioning, the page will query the database and return all open games in text format so that it can be read by the client game and displayed to select from. Does anyone have any ideas where to start looking on how to parse an .ASP file from within the program?
-
WM_MOUSELEAVE madnessYeah, thanks, that's exactly what I ended up doing last night, execpt I used GetCursorPos(), GetWindowRect(), and the PtInRect() function of CRect to check if the cursor position was inside the client rectangle. Thanks for the help. I got it to work without flicker by overriding the OnEraseBackground() method and immediately returning TRUE, which I should have done a while ago, anyway.
-
WM_MOUSELEAVE madnessYes, I can do that. The problem is that I then have to call _TrackMouseEvent again immediately to set up the mouse handler and it causes some bad flickering in the control. I might look into that a little more, though.
-
WM_MOUSELEAVE madnessI'm working on putting some animated goodness into my Settlers of Catan freeware port (http://www.settlers3d.net). Specifically, I'm trying to hide player information until the mouse passes over it, at which point the player info zooms out from the right and stays there until the button gets the WM_MOUSELEAVE message and then it zooms back left. The problem is that I have a couple of owner draw buttons inside my main player info button. Whenever the mouse cursor moves over these buttons, even though it is still within the player button client area, Windows sends a WM_MOUSELEAVE message and my control zooms back to the left. I've tried commenting out all mouse-handling messages within these child owner-draw buttons to no avail. I still get the WM_MOUSELEAVE message. Anyone know how to prevent this from happening? I suspect that I'm screwed, but maybe there are some decent workarounds.
-
Anyone with experience in out-of-proc COM servers?Ahhh, thank you very much. I believe this is the answer I was looking for. I had started to suspect that it had something to do with the [oleautomation] tag, but I'm not knowledgeable yet enough to know what I'm doing. Thanks a lot!
-
Anyone with experience in out-of-proc COM servers?I just tried creating a wholly other .exe server in a new directory with a new interface CLSID and IID. Still has the same methods as the previous attempts and the application still gave the E_NOINTERFACE error. For some reason it will not find the interface requested for an .exe server. I searched through the messages and there's one other one back in the annals describing the same exact problem (search for NOINTERFACE).
-
Anyone with experience in out-of-proc COM servers?I'm trying to write a COM .exe server that creates a small modeless dialog box when properly called. Unfortunately, when I call the COM object from my application, it always returns E_NOINTERFACE from CoCreateInstance when given the correct IID of my COM interface (ICObject in this case, for test purposes). According to MFC documentation, this error occurs when the QueryInterface call does not support the requested interface. However, if I create the same exact COM project using an in-proc .dll file, without changing a single line of code in the calling application (except the CLSCTX_ string in CoCreateInstance), it works fine. I am using MFC's ATL/COM wizard to create both the .exe and the .dll projects. Both settings are for apartment model threading, custom interface, no aggregation and connection points. Here's my application code: ////////////////////////////////////////////// #include "..\COMObject\COMObject.h" #include "..\COMObject\COMObject_i.c" ... HRESULT hr; //instantiate it hr = CoCreateInstance(CLSID_CObject, NULL, CLSCTX_LOCAL_SERVER /*CLSCTX_INPROC_SERVER for DLL*/, IID_ICObject, (void **) &m_pObject); //do something with it if(SUCCEEDED(hr)) { m_pObject->StartDialog(); } ////////////////////////////////////////////// Does anyone have any idea why it works with an in-proc .dll and not an out-of-proc .exe?
-
ATL CLSCTX_LOCAL_SERVER get E_NOINTERFACE error...I just started messing around with COM and am having this same exact problem. Are there extra settings for an out-of-process .exe server that I don't know about? Anyone?
-
CRichEditCtrl in a COM object... possible?Thanks for the quick reply! I was thinking about it a little more after writing it and I thought of two ways that are probably better fixes: 1) Write an actual mini-dialog app that is just the CRichEditCtrl chat dialog and have one COM interface that talks between the main app and the chat dialog. Running two different .exe files would guarantee two different windows. 2) Fix the main app (like you suggest) so that it doesn't steal the focus on game events. Honestly, I didn't actually consider it at first because I figured it would be too complex to try and find every instance where it happened, but I may look at this again. Thanks for the compliment on the game. If you go to the main site, you can download the current BETA version (0.8.8). The game itself is complete, I'm just working on some remaining UI issues and cleanup before a 1.0 release.
-
string compareI believe the way those string compare functions work is to go character by character through the string until one character in the first string is greater or less than the corresponding character in the comparison string. Each character corresponds to an ASCII integer value, which is what the comparison is based on. In your example, both strings are the same up to the 6. At that point, it compares the '_' against the '0'. '0' has a lower ASCII value than '_', so it returns "Vicki 46_p.txt" as greater than "Vicki 460_p.txt". I'm not sure why Explorer sorts them differently. Microsoft probably wrote their own sorting method that parses the strings differently.
-
CRichEditCtrl in a COM object... possible?Hello all, I am brand new to COM/ATL programming and am trying to figure out if what I want to do is doable. I've gone through the great DCOM tutorial by Brian Hart and it's given me a good start. Here's my situation. I've written a (free) port of the boardgame Settlers of Catan using OpenGL for 3D graphics. I recently added networking capability to it and have been cleaning up things according to user's desires. The biggest problem they all have is that my chat window, which is currently a modeless dialog box, loses the focus anytime there is an in-game event, which causes their typing to suddenly disappear in mid-sentence as the focus suddenly gets set to the main window. A screenshot of the game w/ chat window is is here. My brilliant idea was to rewrite the chat window as a COM object, which would solve the problem of it losing focus since it would be its own window. I've got the basic COM object figured out with a dialog box in it, and a connection point back to the main app for wanting to chat. However, I can't figure out how to connect a CRichEditCtrl to the dialog box, because I don't really understand how CWindow and CWnd work, and do your controls have to be CWindow classes to be used in ATL? The current chat window is a CRichEditCtrl and I'd really like to avoid creating my own control for chatting via the COM object. Can anyone explain this a little better or point me to some resources that do? Thanks. Jason