Dark Bit Factory & Gravity
PROGRAMMING => C / C++ /C# => Topic started by: Stonemonkey on September 28, 2007
-
I'm trying to re organise things in my code a bit and thought this may (or may not) be useful. It's the basic window and gfx buffer setup I'm using based on Jims code. It's been modified quite a bit though and if anyone that knows any better thinks that something could/should be done differently I'd be grateful of any input.
You'll need to create an empty win32 project and put these files into it (I think they're all there).
-
Looks OK to me :)
I see one tiny bug
if (!GetMessage(&msg, fetch_project()->window, 0, 0))
break;
should be
if (GetMessage(&msg, fetch_project()->window, 0, 0)>0)
break;
since GetMessage returns < 0 on error, 0 for exit, and > 0 for success. I can't imagine any situation where that would happen on a stable system though.
Jim
-
Heh, cheers Jim. I am surprised that's all tbh. I'll fix that and uplaod again.
EDIT: sorted.
-
Might be more in there, but the structure looks OK, which is far more important. :)
Jim
-
Yeah, I hadn't expected you'd gone through it all but if that's about the worst that stands out I'll be quite happy.
-
Thanks for posting :) K+
-
Hmmm. Jim, I've just been looking back at something and made the change you suggested and now the windows aren't working at all right, they can't be dragged, the buttons don't work and I don't get feedback from the mouse. Should it have been:
if (GetMessage(&msg, fetch_project()->window, 0, 0)<0)
break;
as that appears to get everything working.
EDIT:
Sorry to anyone trying to run that code as it would've just given a blank screen :(
-
strange i use GetMessage()>0 in my code and it works fine although i use NULL where you youse fetch_project is the fetch project window needed?
edit sorry just went through your code, you do things diffrent to me so maybe < 0 is more correct in your case.
-
Should be <=. Just check the docs for GetMessage. It returns 0 when WM_QUIT comes through and -ve on error. So just "if (GetMessage())" isn't right, but then again, I got the check wrong too :(
Jim
-
Thanks Jim.
-
That gfx mode doesn't work on my pc :(
anything i could do to make it work?
-
Hi paul, what's happening exactly? are the results the same whether it's fullscreen or windowed?
stonemonkey.
-
hehe. I most have had more than 1 tab going, I was supposed to post that in Shockwaves 32b topic :P
sry
-
lol, no problem.
Fryer.