It is currently Wed Nov 22, 2017 9:08 pm

All times are UTC - 5 hours




 Page 1 of 1 [ 8 posts ] 
Author Message
 Post subject:
PostPosted: Wed Aug 01, 2007 5:58 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
In VMK 37A I show you how to rework the mouse input control so that all mouse activity is handled via windows messages. A bug is also fixed that you may have noticed previously if you were running your computer at a resolution larger than two times the size of the window that you are creating for the game engine.


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 37 - Mouse Input version 2
PostPosted: Tue Aug 07, 2007 10:32 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
In VMK 37B I add the ability to display the current mouse X,Y co-ordinate to the console window. Note that at the end of the video I say that you can not see the mouse cursor, however if you watch the video you will actually see the cursor. This is because of the video recording software that I am using. When you run this program on your computer, you will not see the cursor on the screen when you move the mouse over top of your own window.


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 37 - Mouse Input version 2
PostPosted: Sat Aug 11, 2007 6:24 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
VMK 37C shows you how to add your own custom mouse cursor to the game engine. Note that in the video, you will see the default mouse cursor and the custom mouse cursor rendered, however this is only an artifact from my video recording software. When you actually do this on your own computer, you will only see the custom cursor rendering on the screen.


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 37 - Mouse Input version 2
PostPosted: Thu Sep 06, 2007 7:02 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
I have a feeling that I may have introduced a compiling bug into the GameEngine project. I am finishing up some work now on VMK38C and I see that the project doesn't build properly. If you are having problems compiling your program, let me know and I can tell you how to fix it. Alternatively, watch VMK38C and you will see how to fix everything.


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 37 - Mouse Input version 2
PostPosted: Thu May 07, 2015 2:44 pm 

Joined: Fri Jul 04, 2014 1:07 pm
Posts: 6
If we change this line:

MoveWindow(m_hWnd, px, py, m_iWidth, m_iHeight, FALSE);

To:
MoveWindow(m_hWnd, px, py, rcWnd.right - rcWnd.left , rcWnd.bottom - rcWnd.top, FALSE);


The client window size is now correctly set. The mouse movement and coordinates will now be correct that the client window size is correct.

What was happening was we used MoveWindow to resize the window to 800,600, after we used AdjustWindowRectEx to resize it taking into consideration the window borders. If you change the line above, the client window size then still takes this into consideration.


Last edited by darkrider on Thu May 07, 2015 5:37 pm, edited 1 time in total.

Offline
 Profile  
 
 Post subject: Re: GameDev VMK 37 - Mouse Input version 2
PostPosted: Thu May 07, 2015 5:39 pm 

Joined: Fri Jul 04, 2014 1:07 pm
Posts: 6
MoveWindow(m_hWnd, px, py, m_iWidth, m_iHeight, FALSE);
according the msdn, this SETS the whole window dimensions to m_iWidth and m_iHeight, which dimensions include the borders. This means it sets it to 800x600 including borders. This means the client rect is NOT 800x600.

Before we ran MoveWindow, we called:
AdjustWindowRectEx(&rcWnd, dwStyle, false, dwStyleEx);
This line sets the whole window with correct window dimensions according to the borders and client area, which means the client rect IS 800x600.

Being we called MoveWindow AFTER AdjustWindowRectEx, the whole window including client area are set back to 800x600, which does NOT adjust to the borders.

If you call GetClientRect towards the end of Create (where we create the window), doing this the way it is in the source code I purchased, you'll see the client area is NOT 800x600, but smaller due to the total window dimensions being 800x600. The way I have shown, the client area is then fixed to be 800x600.

When using WM_MOUSEMOVE you WANT 800x600 client area pixels.


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 37 - Mouse Input version 2
PostPosted: Thu May 07, 2015 7:49 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1105
Location: Ontario Canada
I believe this was discussed back in VMK3 in the forum : viewtopic.php?f=3&t=23


Offline
 Profile  
 
 Post subject: Re: GameDev VMK 37 - Mouse Input version 2
PostPosted: Fri Dec 18, 2015 2:47 am 

Joined: Wed Sep 30, 2015 3:10 am
Posts: 7
The client window size is now correctly set.
จีคลับ 1688


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 8 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

cron