Jump to content
  • Advertisement

Rodaxoleaux

Member
  • Content Count

    15
  • Joined

  • Last visited

Community Reputation

97 Neutral

About Rodaxoleaux

  • Rank
    Member
  1. Ah. It works rather well now. Thanks everyone.
  2. You should also try debugging to point out exactly where in your GSurface constructor this fault is happening. If it's the first line, then obviously (points to above post).
  3. I tried sending WM_ERASEBKGND and using FillRect() but that doesn't help. Although honestly, since this is my first time working with Win32, I thought it did it itself. case WM_PAINT: hDC = GetDC(hwnd); SetBkMode(hDC,OPAQUE); SetBkColor(hDC,RGB(253, 208, 23)); SetTextColor(hDC,RGB(255,255,255)); TextOut(hDC,10,30,(LPSTR)currentCommand.c_str(),currentCommand.length()); ReleaseDC(hwnd,hDC); RECT r; GetWindowRect(hwnd,&r); FillRect(hDC,&r,orangish); break;
  4. Didn't know that it just leaves the background. Thanks but it still produces the same result after changing to OPAQUE and setting the background color. What else could cause it? It always seems to work if I hide and reshow the window whenever backspace is pressed but... that seems rather inefficient..
  5. Basically, I'm creating a sort-of terminal window with user input for typing commands, etc. the current user-inputted data is stored in a string, and the string is drawn to the window as so in the message handling function: LRESULT CALLBACK Messages(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) { HDC hDC; switch (Msg) { case WM_CLOSE: DestroyWindow(hwnd); break; case WM_DESTROY: PostQuitMessage(0); break; case WM_HOTKEY: WindowState = !WindowState; ToChangeWindow = true; break; case WM_PAINT: hDC = GetDC(hwnd); SetBkMode(hDC,TRANSPARENT); SetTextColor(hDC,RGB(255,255,255)); TextOut(hDC,10,30,(LPSTR)currentCommand.c_str(),currentCommand.length()); ReleaseDC(hwnd,hDC); break; default: return DefWindowProc(hwnd, Msg, wParam, lParam); } return 0; } I can type it just fine and it will output what I want, but when I delete a character from the string (Backspace), it deletes a character fine, but it doesn't update the window and instead draws behind the already outputted text.
  6. Rodaxoleaux

    Beginner... and I mean BEGINNER... HELP! please

    Oh, Python. The great memories. Instead of asking for a certain person's games. How about checking their site: Pygame Also don't use the shell... what? Google Pyscripter. I don't know if it has a Mac extension.
  7. Ok, that works, but if I erase some of the string and try to type more, it'll keep the string that's already there, and write behind it.
  8. Is there any way to update a window after sending WM_PAINT besides ShowWindow(hwnd, NULL) then ShowWindow(hwnd,SW_SHOW)?
  9. Rodaxoleaux

    Bouncing Ball in Pong

    No. Changing the dx,dy (Destination X, Y) coordinates or the speed of the ball in terms of X and Y by multiplying by negative one would change the speed of the ball to the opposite direction. Ex: Ball is moving at Y: -5 (5 pixels up) per frame. -5 * -1 = 5 so dy = Y: 5 so the ball is moving 5 pixels down per frame. EDIT:: And what the above poster said if you plan on implemented correct angular collision :S
  10. Rodaxoleaux

    Win32 Input and GetAsyncKeyState

    Simple and effective. Brilliant. Thanks!
  11. Rodaxoleaux

    Win32 Input and GetAsyncKeyState

    I want to be able to show a window after it is hidden using ShowWindow(hwnd,NULL). I've created a global keyboard hook but I don't know how to call it at the beginning of the program outside of the DLL. Doing this: HINSTANCE HookDLL = LoadLibrary("Hooked.dll"); if (!HookDLL) { MessageBox(NULL,"Unable to load Keyboard hook.","Error!",MB_ICONEXCLAMATION | MB_OK); } FARPROC HookProc = GetProcAddress(HookDLL,"installhook"); if (!HookDLL) { MessageBox(NULL,"Unable to load Keyboard hook function.","Error!",MB_ICONEXCLAMATION | MB_OK); } (*HookProc)(); How would I call HookProc with a parameter (the handle of the window) in __declspec(dllexport) void installhook(HWND h) I tried (*HookProc)(hwnd); but that says that parameters aren't allowed?
  12. Rodaxoleaux

    Win32 Input and GetAsyncKeyState

    Indeed. I just read this Window Visibility A window can be either visible or hidden. The system displays a visible window on the screen. It hides a hidden window by not drawing it. If a window is visible, the user can supply input to the window and view the window's output. If a window is hidden, it is effectively disabled. A hidden window can process messages from the system or from other windows, but it cannot process input from the user or display output from the Microsoft website. I will look up more information on hooks. Thanks.
  13. Rodaxoleaux

    Win32 Input and GetAsyncKeyState

    I was basically adding random ways once I figured out that the "way that's posted all over Google" doesn't produce the result I want (in other words, the same as what is happening now). I already said the part about the lsb but I thought it was worth a try to try it (and produced the same result), I tried using the WM_KEYDOWN/UP messages but they didn't work after ShowWindow(hwnd,NULL) hiding the window, so I scratched that. EDIT:: In fact, the normal GetAsyncKeyState() works perfectly as long as there is focus on the window. I'm confused. Isn't it supposed to work regardless?
  14. Windows input has thwarted all my attempts to attempt to even semi-understand it. I've read through the information about the different bits and how the least sign. bit of GetAsyncKeyState only works sometimes (which I suppose shouldn't be used at all since it is not reliable). If I use the function at all, it will work once, for one key, and then all input to that window doesn't register at all. I know I'm doing something wrong programmatically but I can't figure out what. if (GetAsyncKeyState(VK_F10) >> 8 < 0 || GetAsyncKeyState(VK_F10) >> 1 < 0 || GetAsyncKeyState(VK_F10) < 0) { TerminalOn = !TerminalOn; if (GetFocus() != hwnd) SetFocus(hwnd); ToSetWindow = true; } I've changed this actually a bunch of times only to produce the same result. Any ideas/advice? (and if that advice is "don't use GetAsyncKeyState()", i'd thank you, but I do need a form of keyboard input that does not rely on focus or the window being shown (as it is hidden when not active))
  15. Rodaxoleaux

    Learned C++... Now what?

    SDL is a buggy piece of sh-anyway. My library of choice for 2D game development is Allegro, which is actually a C library but, blah blah blah etc etc. I wouldn't go any other way (unless I find one)
  • 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!