Welcome, Guest. Please login or register.

Author Topic: Direct input  (Read 2407 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Direct input
« on: February 19, 2003, 12:28:51 PM »
Hi all,

Does anybody know an OS friendly way to directly query the absolute mouse position/button states from C?

I need this feature for an input abstraction layer (direct version) I'm working on:

class Mouse {
//...
public:
   static int directReadX(); // get current absolute xPos
   static int directReadY(); // get current absolute yPos
//...
};

I have looked around the includes/autodocs/RKMs and don't seem to find anything with which to implement the above interface.

I already have a buffered version which works by processing normal input events and that works fine. It's just the above direct access that's holding me up.

Cheers for any advice,

K
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Direct input
« Reply #1 on: February 20, 2003, 02:36:14 PM »
Thanks matey. I don't suppose the currently active mouse button states are anywhere in there too?

-edit-

Assuming I only want to read said variables, is locking intution *strictly* required? I realise the value you get may be slightly old, but I doubt it will be too many pixels out (unless your really zoom the mouse along!)
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Direct input
« Reply #2 on: February 21, 2003, 12:09:28 PM »
Hi Rouge,

Thanks for the suggestions. I am aware that global mouse reading looks a bit silly, but I only wanted to add the absolute position stuff to the Mouse class to complete the interface.

For normal input, I do have an 'InputFocus' class interface (that utilizes IDCMP under AmigaOS) and thats working just fine.

Ultimately the classes I'm writing are for a multiplatform 'system abstraction layer' project. The intention is to provide a set of application building blocks that can take advantage of the underlying OS's abilities whilst giving a consistent programming interface.

This is a project I've been working on for some time and recently aimed for an internal version bump so everything is getting re written.

int p; // A