Advertisement Jump to content
  • Advertisement

argonaut

Member
  • Content Count

    143
  • Joined

  • Last visited

Community Reputation

100 Neutral

About argonaut

  • Rank
    Member
  1. argonaut

    How often you drink?

    I'll drink if I'm just slinging code (except at work, of course, boss :) If I'm doing design, I prefer an enhancement with more flammable qualities.
  2. argonaut

    RegisterClassEx problem

    It was my bad. I'm not sure, but I think I was putting an object on the global heap before I should have.
  3. argonaut

    confusing pointers

    std::vector is nice, but it's also valuable to learn what goes on behind vector, which is essentially what AddCar is trying to accomplish.
  4. argonaut

    confusing pointers

    I'm lost on this one so far. Can you post the Car class code?
  5. Heya, I posted a similar issue a few days ago, but this one just started happening during a refactor and again MSDN isn't giving me any help. I don't think I changed anything affecting this part of the code, but I must have. I'm getting the error ERROR_FILE_NOT_FOUND when I try to register my class. This doesn't make sense to me, since I'm not trying to do any file stuff. Any Windows programmers know what's the poop here: #ifndef _WINMAIN_H_ #define _WINMAIN_H_ #include "Globals.h" #include "GameEngine.h" #include "debug.h" #include <windows.h> GLOBAL PGAMEENGINE g_Engine; GLOBAL HWND g_hWnd; BOOL BuildWindow(HINSTANCE hInstance); LRESULT CALLBACK WinProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCommandLine, int nCommandShow) { MSG msg; g_hWnd = (HWND)GlobalAlloc(NULL, sizeof(HWND)); if (!BuildWindow(hInstance)) { MsgBxLastError(26); return 0; } g_Engine = new GameEngine(g_hWnd); while (true) { if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } //if (!RunGame(g_hWnd)) return 0; } return 0; } BOOL BuildWindow(HINSTANCE hInstance) { WNDCLASSEX wc; memset(&wc, 0, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = (WNDPROC)WinProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = NULL; wc.hCursor = NULL; wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wc.lpszMenuName = L"NULL"; wc.lpszClassName = L"Slider32"; wc.hIconSm = NULL; ATOM am; am = RegisterClassEx(&wc); // Getting Error ERROR_FILE_NOT_FOUND if (GetLastError()) MsgBxLastError(70); g_hWnd = CreateWindowEx( NULL, L"Slider32", L"Slider32", WS_VISIBLE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, NULL, NULL, hInstance, NULL); if (GetLastError()) { MsgBxLastError(1); } if (!g_hWnd) return FALSE; return TRUE; } LRESULT CALLBACK WinProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam) { switch (uMessage) { case WM_DESTROY: break; case WM_LBUTTONDOWN: break; case WM_CHAR: break; default: break; } return DefWindowProc(hWnd, uMessage, wParam, lParam); } #endif As always, thanks in advance!
  6. argonaut

    Help with CreateWindowEx

    Quote:Original post by nobodynews You should only call GetLastError if the function previously called indicates there was an error. Aye, I did actually do that. Just copy/pasted it down the line some :)
  7. argonaut

    Help with CreateWindowEx

    Yep, that was it. Spot on! Man, I'm rusty ... None of my textbooks even show doing it that way and the oldest copyright is 2003. [EDIT] Actually, I was being really stupid and didn't see the relationship between those two members. Thanks guys ... You rock as always!
  8. Hi, I feel dumb posting this, but the usual suspects aren't working and MSDN hasn't been much help. I'm porting some code I wrote back in school with VS2003 to VS2008. I've narrowed the problem down to this code: [source code=cpp] #include &lt;windows.h&gt; HWND hWnd; int BuildWindow(HINSTANCE hInstance); LRESULT CALLBACK WinProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCommandLine, int nCommandShow) { MSG msg; if (!BuildWindow(hInstance)) { MessageBox(NULL, L"BuildWindow is FALSE", NULL, MB_OK); return 0; } } int BuildWindow(HINSTANCE hInstance) { WNDCLASSEX wc; memset(&wc, 0, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = (WNDPROC)WinProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = NULL; wc.hCursor = NULL; wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wc.lpszMenuName = L"NULL"; wc.lpszClassName = L"Slider32"; wc.hIconSm = NULL; if (!RegisterClassEx(&wc)) { MessageBox(NULL, L"false here", NULL, MB_OK); return FALSE; } hWnd = CreateWindowEx( NULL, L"Slider 1.0", L"Slider 1.0", WS_VISIBLE, 0, 0, 1024, 768, NULL, NULL, hInstance, NULL); if (GetLastError()) { WCHAR sz[206]; wsprintf(sz, L"le = %d", GetLastError()); MessageBox(NULL, sz, NULL, MB_OK); } if (!hWnd) return FALSE; return TRUE; } I'm getting GetLastError equal to 1407 or ERROR_CANNOT_FIND_WND_CLASS. It seems that this is mostly due to an improper registration, but RegisterClassEx is not failing and I haven't found any info as to why. Any ideas?
  9. Quote: Is there a situation were you would want to do an assignment within the () of an if? I can't think of an instance where you would do this in an "if" condition where the compiler wouldn't take care of the conditional before the branch. I could see, perhaps, in a do/while where this might matter (but not likely). I believe this is why C# and some modern languages don't allow assignment within the sentinel.
  10. argonaut

    a thing about classes..

    Quote: Multiple inheritance is frowned upon, however when multiple inheritance is applied to interface implementation it's a little bit better. I don't mean this in a bad way, but I would like to see some references to Multiple Inheritance being frowned upon.
  11. argonaut

    Transposing bits in a stream

    It's interesting, to say the least. Through all of my years of schooling the professors emphasized to not make assumptions on what the compiler would do. So we would do all these crazy unrolling schemes and whatever. However, once I got into the real world, almost everyone says, "meh, the compiler will take care of that".
  12. argonaut

    Transposing bits in a stream

    Hey! Thanks for posting the ASM on that. I've not gone to the extent to look at the ASM myself. Generally, these days I'm lazy and let the compiler do it for me :) One quick question in my mind though: I was working under the assumption that unrolling any sort of loop would be optimal, but I see you are using a loop for known values. I specifically avoided loops because of the comparison operations, so do you know something I don't about speed. If I get to it this weekend, I will post the ASM results from my algorithm. EDIT: I just installed Win 7 a couple of weeks ago, so it may take some time to get VC2008 up and running again. As soon as I do, I will post the flat ASM code.
  13. argonaut

    Transposing bits in a stream

    Ahh, OK. But I am talking about switching the bits in an entire byte. So, bit 7 of the byte becomes bit 0 (and visa verse). EDIT: Keep in mind this must be done in C.
  14. argonaut

    Transposing bits in a stream

    My initial thought is no. But maybe I'm not understanding what you mean. My brain is starting to get mushy. Doesn't that just get you your original byte back?!?
  15. argonaut

    APIs/libraries for a 2D online game

    As mmakrzem mentioned, SDL is about the best cross platform lib out there. As far as the specific questions you are asking concerning skewing and color transformations, I don't know if the current SDL has native support for that. I haven't used SDL in about 4 or 5 years. What I can tell you, in support of SDL, is that it gives you easy direct memory access to your images, meaning you can make whatever adjustments you need to on the textures themselves. This makes, for instance, applying a lighting layer on top of your original texture quite easy. This reminds me that I should go look up SDL again.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!