Shop OBEX P1 Docs P2 Docs Learn Events
Mouse object bounds? — Parallax Forums

Mouse object bounds?

parts-man73parts-man73 Posts: 830
edited 2009-02-17 18:25 in Propeller 1
A question about the mouse object.

What are bounds?

I'll tell you what I'm trying to accomplish. I am reading the values from a mouse. Works great, but when one of the values gets to 0 and moves just a touch more, it rolls over to the maximum value. The same thing happens on the other end...when you get to the max value, it rolls back over to 0. The max value depends upon what type of variable you are reading the position into. For example, if you read the value into a "Byte" the max value is 255.

What I would like to do, is when the max value is reached, I want it to stay at the max value until the mouse is moved back in the opposite direction. Similar to coordinates on a screen, when the mouse moves a cursor to the far edge of the screen, you wouldn't want it to flip over to the opposite edge of the screen.

I tried to plug some numbers in via the "bound_limits" but it seemed to have no effect on the output. Can the mouse object provide the kind of results I would like to achieve? or do I need to modify the object? I don't want to reinvent the wheel, if the current object can do this and I am just using it wrong. However I couldn't find much documentation for the mouse object.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Brian Meade

"They who dream by day are cognizant of many things which escape those who dream only by night" - Edgar Poe

Comments

  • El PaisaEl Paisa Posts: 375
    edited 2007-01-20 03:52
    I use a constrain like this:

    ···· mousex := mousex + mouse.delta_x #> -126 <# 125
    ···· mousey := mousey + mouse.delta_y #> -95 <# 83

    I hope this helps.
  • MasterCMasterC Posts: 39
    edited 2009-02-13 20:21
    Yeah, but could somebody please address what the bound_limits function does? Also, bound_scales and bound_preset?? I have tried playing with them, but they seem to have no impact.

    [noparse][[/noparse]unsolicited rant] I think this is a fairly common comment from newbies here, but the documentation of objects could really use some work. (This is my first post, but I've been around and developing on the propr for a while now.) Chip Gracey appears to be a brilliant individual and has developed some great objects, but his commenting falls far, far short of the standard he sets in other areas. It gets frustrating spending more time trying to decipher the objects I want to use than actually moving forward on my project.

    To truly take maximum advantage of object-oriented devlopment, one should be able to simply use an object without having to try so hard to interpret how it actually works, spend hours in trial-and error and disecting another poorly-commented demo, etc. Ideally, there would be a standard format for object interface descriptions that include all the ins-and-outs of how to use the object. At the very least, each object should have adequate comments to tell you what each method does and details about each input and output parameter. I mean, if you just spent a good chunk of time developing this awesome object for the benefit of the community, why not spend another 15 minutes and document it so others can more easily take advantage of it?[noparse][[/noparse]/unsolicited rant]
  • KyeKye Posts: 2,200
    edited 2009-02-14 02:44
    Use my driver, the plug n' play mouse one. It has bounds and everything else.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • MasterCMasterC Posts: 39
    edited 2009-02-17 18:25
    Hi Kye,

    It looks like Chip's mouse driver has bounds functions·too, I just don't know how to use them.· Or are these non-functional?

    Incidentally, I did·download your·drivers and give them a shot when I started messing with this mouse stuff.· Unfortunately, your demo runs using your VGA driver, and it didn't appear to work with my monitor.· That's when I switched gears and gave Chip's mouse driver a try.
Sign In or Register to comment.