Shop OBEX P1 Docs P2 Docs Learn Events
A Question about VGA_Tile_Driver_Demo2... where's the action, man? — Parallax Forums

A Question about VGA_Tile_Driver_Demo2... where's the action, man?

ElectricAyeElectricAye Posts: 4,561
edited 2009-05-08 20:21 in Propeller 1
Hi all,

I just hooked up a mouse to my Prop for the first time and started working with VGA_Tile_Driver_Demo2. Everything on the screen looks good and the cursor moves around. But when I clicked on the displayed buttons, nothing happens. So I looked through the code to see if something is supposed to happen, and... well... I guess nothing is supposed to happen. Which seems weird to me since VGA_Tile_Driver_Demo2 uses VGA_1280x1024_tile_driver_with_cursor. Then I looked more closely at VGA_1280x1024_tile_driver_with_cursor to see if it even has the ability to make something happen when I click on a button if I so programmed it to do so. And it's not clear to me that it can do that. Needless to say, I'm confused. I don't know assembly code and there are few comments in any of these objects, so maybe I'm overlooking something. Surely there must be a way to make things happen when you click on a button. And is there a VGA demo that will show that to a poor wretched newbie like me?

TGIF to all,
Mark

smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Watching the world pass me by, one photon at a time.

Comments

  • RaymanRayman Posts: 14,827
    edited 2009-05-08 18:42
    I think those demos are just for show... There is a "ESC" demo in 1024x768 with a different kind of button that does function...

    I have all kinds of apps for 1024x768 that use buttons. Some of them are on my website...

    Basically, you just start a loop inside of which you check for the mouse down event.· Then, you may wish to start another loop to wait for the mouse up event.· Then, take the mouse coordinates and see if it's on top of a button...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-08 18:51
    The existing mouse driver just reports the position of the mouse when a click is done. The display driver just displays a cursor at the coordinates requested. You have to write the software to take the mouse click position and search a table of button coordinates to find the button that's associated with that position (if any), change the appearance of the button by re-displaying it maybe in a different color and repeat the whole process when the mouse click button is released to make the button look "normal" again. The display driver and the mouse driver know nothing about buttons or other graphics. That's a whole 'nother layer on top of them.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2009-05-08 19:52
    To Mike and Rayman,
    thanks for your superfast responses. I had hoped the demos would give me more to work from but now I see your point about having to make all that button stuff myself. I'm already using 6 cogs without using a cursor + button feature with my VGA display. Any ideas on how many additional cogs, if any, would be required to drive a button-pushable cursor with my project? I want to have a cursor so I can control about 6 buttons on a screen to lower and raise a few variables. Is this the sort of thing that takes, like, one or two cogs by itself???

    thanks again,
    Mark

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Watching the world pass me by, one photon at a time.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-08 20:07
    You need one cog to do the cursor display itself (part of the display driver) and one cog to talk to the mouse. You could modify the mouse driver to directly change the memory locations used by the cursor display cog for its coordinates so that's kept up to date as the mouse moves around.

    The higher level button display/manipulation functions could either be done by the mouse driver in response to a click on or click off or it could be done by the main program (cog) as an event (if it's event oriented) or it could be handled by its own cog. These are all valid choices depending on the details of your program and the resources available. I'm more concerned about the memory needed. If you're handling the buttons by using graphics areas, that's a lot of memory. If you're using the tile based drivers, particularly the button stuff, for primarily text, you'll be in better shape memory-wise.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2009-05-08 20:21
    Thanks, Mike,

    I'll need to grok your comments over the weekend.· Silly me, I thought this cursor thing would be a rare plug-and-chug moment for me today.· sad.gif·· "Everyone else has got a cursor, why not me?" I said to myself this morning.

    "Because you're clueless and lazy," then said God.· "Get to work."



    smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Watching the world pass me by, one photon at a time.
Sign In or Register to comment.