I have on the drawing board breakout and pong and asteroids using opengl and pong and tic tac toe using dx9 what should I finish first and then later. or should I go back to learning c++.
mouse values
I have decided to work on my tic tac toe game some more. I have reworked some of my code, but it still puts an X in the spot adjacent to where I clicked the mouse button.
here is some of my code
int x_board = (x-left_edge)/width;
int y_board = (y-top_edge)/height;
RECT font_rect;
if(x_board==0 && y_board==0)
{
font_rect.left=310;
font_rect.top=235;
font_rect.right=330;
font_rect.bottom=255;
board_x[y_board][x_board]=true;
}
if(x_board==1 && y_board==0)
{
font_rect.left=360;
font_rect.top=235;
font_rect.right=380;
font_rect.bottom=255;
board_x[y_board][x_board]=true;
}
I have already stubbed out the code using the x_board and y_board variables and they seem to work correctly. I have also changed my mouse input code but I still get the same problem. I know I have already posted code similar to the above but I have made some changes since then.
sounds like you should work on tic tac toe as its the easiest. and use directx, cause that's what you need to learn for work. forget openGL for now.
did you get the mouse working correctly yet?
can you display the coordinates of a mouse click, and are they correct? that's the first battle.
also sounds like you're running in windowed mode, and the difference between the size of the window, and the client area (the part inside the border that you draw in) might be giving you issues. i only work in fullscreen mode, so i can't help you there.
sounds like you got lucky and got your foot in the door at a gamedev shop. you'd better get up to speed super quick if you don't want to blow this opportunity.
get the mouse working in windowed mode and the rest is trivial. like 4 lines of code trivial.
Norm Barrows
Rockland Software Productions
"Building PC games since 1989"
PLAY CAVEMAN NOW!
http://rocklandsoftware.net/beta.php
well I have tried the following code but cant get the mouse to work properly
int x=(short)LOWORD(lParam);
int y=(short)HIWORD(lParam);
how would I display the coordinates of the mouse click?
get mouse x y
convert x to string
display string
convert y to string
display string
Norm Barrows
Rockland Software Productions
"Building PC games since 1989"
PLAY CAVEMAN NOW!
http://rocklandsoftware.net/beta.php
well I have tried the following code but cant get the mouse to work properly
int x=(short)LOWORD(lParam);
int y=(short)HIWORD(lParam);
snippets from my Z game library:
variables:
// mouse position and button state
int mousex,mousey,mouselb,mouserb;
Norm Barrows
Rockland Software Productions
"Building PC games since 1989"
PLAY CAVEMAN NOW!
http://rocklandsoftware.net/beta.php
posting got screwed up.
continuing last post......
windows message pump:
// message handler
LRESULT WINAPI Zmsgproc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch(msg)
{
case WM_DESTROY: Zshutdown();
PostQuitMessage(0);
exit(0);
case WM_MOUSEMOVE:
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_LBUTTONUP:
case WM_RBUTTONUP:
mousex=(lParam & 0x0000FFFF); // mouse x = low order word of lParam
mousey=(lParam >> 16); // mouse y = high order word of lParam
if (wParam & MK_LBUTTON) mouselb=1; else mouselb=0;
if (wParam & MK_RBUTTON) mouserb=1; else mouserb=0;
return(0);
case WM_MOUSEWHEEL: mousewheel=(int) GET_WHEEL_DELTA_WPARAM(wParam);
// wParam >> 16; // distance rotated = high order word of wParam
// if (mousewheel > 32767) mousewheel = 65536 - mousewheel;
return(0);
}
return(DefWindowProc(hWnd,msg,wParam,lParam));
}
Norm Barrows
Rockland Software Productions
"Building PC games since 1989"
PLAY CAVEMAN NOW!
http://rocklandsoftware.net/beta.php
posting got screwed up again!
if i do (square bracket) /code (square bracket)
followed by a period on the next line, it clips off the rest of the post!
ok continuing post...
look at the code for WM_RBUTTONUP
you do:
x=(short)LOWORD(lParam)
it shoud be:
mousex=(lParam & 0x0000FFFF); // mouse x = low order word of lParam
apparently LOWORD doesn't work.
for y, you do:
y=(short)HIWORD(lParam);
it should be:
mousey=(lParam >> 16); // mouse y = high order word of lParam
HIWORD might work ok too though. check the docs. when all else fails R.T.F.M. !
and finally, the API call a game uses to get mouse info:
// gets mouse position and button state as of the last mouse message
void Zgetmouse(int *x,int *y,int *b)
{
*x=mousex;
*y=mousey;
if (mouselb) *b=1; else *b=0;
if (mouserb) *b+=2;
}
Norm Barrows
Rockland Software Productions
"Building PC games since 1989"
PLAY CAVEMAN NOW!
http://rocklandsoftware.net/beta.php