Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


EpicCupcakes

Member Since 12 Feb 2012
Offline Last Active Jun 08 2014 11:32 PM

Posts I've Made

In Topic: Innaccurate Mouse

09 February 2013 - 01:18 AM

Good news, I've solved the problem. Just wanted to post the solution in case other beginners found themselves having the same troubles. One mistake that may lead to the symptoms I described above is to make your backbuffer the same size as your window. Since the window is actually larger than the screen that it draws (due to the menu bar, borders, etc), your drawn content will be stretched, leading to inaccuracies in the drawing. Increase the size of your backbuffer by the size of the window's edges, borders, etc that you will be drawing it in, and the problem disappears. For example, I used the code:

 

int gnBackBufferWidth = gnWindowWidth + 16;
int gnBackBufferHeight = gnWindowHeight + 40;

 

to solve the problem. I assume that, depending on your chosen window style (with/out borders, with/out system menu, etc) your values will differ. If that doesn't work, try some of the suggestions above.

 

Thanks for everyone who responded, I appreciate it.


In Topic: Innaccurate Mouse

04 February 2013 - 11:01 PM

The solution to this problem is mentioned in your query itself.

This is an offset issue. You're expecting that when you draw the cursor, you're drawing it with pointer tip at x,y.

But infact you're drawing the whole cursor rectangle with it's top-left tip as x,y.

So you need to make a small correction to the cursor position before drawing.

Use standard height/2, width/2 correction, that should do the trick.

 

Could you give an example of how to do this correction?

 

Okay, that was a silly question of me. I simply manually added 3 to the x position and 10 to the y position of the clicks I got and the return is more or less accurate enough. But is that really the ideal solution? I've searched the forums and found many people who have encountered the same problem, but they never seem to actually post an official solution that uses the Win API. Does an official solution even exist?


In Topic: Innaccurate Mouse

04 February 2013 - 10:42 PM

The solution to this problem is mentioned in your query itself.

This is an offset issue. You're expecting that when you draw the cursor, you're drawing it with pointer tip at x,y.

But infact you're drawing the whole cursor rectangle with it's top-left tip as x,y.

So you need to make a small correction to the cursor position before drawing.

Use standard height/2, width/2 correction, that should do the trick.

 

Could you give an example of how to do this correction?


In Topic: Is XML non-programmer friendly?

08 December 2012 - 01:09 PM

Thank you, that was just the type of answer I was looking for. I'll give your suggestion a try, as XML was always on my radar.

The website you offered seems to be empty, though.

In Topic: Need application to graphically plot 2D paths

10 September 2012 - 08:18 PM

Thank you for the code and the article. I found both of them to be very useful. I managed to cobble together a function that fit my needs for animation with it. It almost felt like I was in school again!

And if anyone knows any graphical program used to plot animation, please post or pm me. I'd really appreciate it.

PARTNERS