Shop OBEX P1 Docs P2 Docs Learn Events
VGA Graphics Shield: (Now Available!) - Page 3 — Parallax Forums

VGA Graphics Shield: (Now Available!)

13»

Comments

  • RaymanRayman Posts: 14,537
    edited 2013-02-23 09:55
    Tim, Should be there...
  • tdg8934tdg8934 Posts: 126
    edited 2013-02-23 10:14
    Weird. I went to my iPhone and saw the link. I went back to my laptop and did not see the link. I had to hit F5 and it refreshed and the link was there. I have never had to do that. It's a caching issue I suppose.

    I ran the demo PAINT program and IT IS AWESOME!!!!! Great use of the mouse and I can't want to play with the code a little. Nice Job!!

    Ti
  • tdg8934tdg8934 Posts: 126
    edited 2013-02-23 19:03
    Rayman,

    I've been busy creating a new mouse cursor tonight with some graph paper. I think it turned out fairly good of a hand holding a stick pointer (cursor is in 3 colors).

    CON 'Define cursor colors
      mfore=lcd#rgb_LightYellow
      mback=lcd#rgb_black
      [B]mstick=$ff_a5_00  'Orange[/B]
    :
    :
    
    PUB Main |i
      'start VGA driver
      lcd.start
      'lcd.StartMouse(@MouseCursor1,@lineBuffer) 'Mouse support requires mouse draw data and a buffer big enough to hold background
     [B] lcd.StartMouse(@MouseCursor2,@lineBuffer) 'Mouse support requires mouse draw data and a buffer big enough to hold background[/B]
    :
    :
    
    [B]
    DAT 'Define mouse pointer 2
    MouseCursor2 long          'with long, no hot spot needed as points can be relative
            long  17,22 'width, height of cursor
            long  82   '#quartets to draw
            long  0,1,mstick,1 'x,y,#width
            long  0,2,mstick,2
            long  0,3,mstick,2
            long  0,4,mstick,3
            long  1,5,mstick,2
            long  1,6,mstick,3
            long  2,7,mstick,2
            long  2,8,mstick,2
            long  3,9,mstick,1
            long  8,5,mback,3
            long  5,6,mback,2
            long  7,6,mback,1
            long  10,6,mback,3
            long  4,7,mback,1
            long  7,7,mback,1
            long  10,7,mback,1
            long  13,7,mback,2
            long  4,8,mback,1
            long  7,8,mback,1
            long  10,8,mback,1
            long  13,8,mback,1
            long  15,8,mback,1
            long  0,9,mback,3
            long  4,9,mback,1
            long  7,9,mback,1
            long  10,9,mback,1
            long  13,9,mback,1
            long  16,9,mback,1
            long  0,10,mback,1
            long  3,10,mback,2
            long  13,10,mback,1
            long  16,10,mback,1
            long  0,11,mback,1
            long  4,11,mback,1
            long  16,11,mback,1
            long  1,12,mback,1
            long  4,12,mback,1
            long  16,12,mback,1
            long  2,13,mback,1
            long  16,13,mback,1
            long  2,14,mback,1
            long  16,14,mback,1
            long  3,15,mback,1
            long  15,15,mback,1
            long  3,16,mback,1
            long  15,16,mback,1
            long  4,17,mback,1
            long  15,17,mback,1
            long  4,18,mback,1
            long  15,18,mback,1
            long  5,19,mback,1
            long  14,19,mback,1
            long  5,20,mback,1
            long  14,20,mback,1
            long  5,21,mback,10
            long  8,6,mfore,2
            long  5,7,mfore,2
            long  8,7,mfore,2
            long  11,7,mfore,2
            long  5,8,mfore,2
            long  8,8,mfore,2
            long  11,8,mfore,2
            long  14,8,mfore,1
            long  5,9,mfore,2
            long  8,9,mfore,2
            long  11,9,mfore,2
            long  14,9,mfore,2
            long  1,10,mfore,2
            long  5,10,mfore,8
            long  14,10,mfore,2
            long  1,11,mfore,3
            long  5,11,mfore,11
            long  2,12,mfore,2
            long  5,12,mfore,11
            long  3,13,mfore,13
            long  3,14,mfore,13
            long  4,15,mfore,11
            long  4,16,mfore,11
            long  5,17,mfore,10
            long  5,18,mfore,10
            long  6,19,mfore,8
            long  6,20,mfore,8  
    [/B]
    
  • RaymanRayman Posts: 14,537
    edited 2013-02-24 05:38
    I like it! Mind if I use that in the code?

    Next step is to allow saving screen to sd...

    BTW: One trick I did for the arrow cursor is to just draw black all the way across (instead of at both sides) to reduce the number of lines of code... I was worried about flicker if it took to long to draw.
    But, I don't notice any flicker with your cursor so maybe that's not an actual issue...
  • tdg8934tdg8934 Posts: 126
    edited 2013-02-24 11:11
    Absolutely. Use anything. I just appreciate learning from your code and others SPIN/PASM code to come up with some neat ideas.

    BTW: Originally I came up with the standard hand with the index finger pointing up but changed it because at point 0,0 is where the drawing starts and it was off (not drawing from the finger pointing up). It would be nice for the user to be able to set the coordinates of the pointer starting location. Just ideas coming up in my head to act or not. Great stuff you have!

    Tim
  • RaymanRayman Posts: 14,537
    edited 2013-02-24 11:26
    Tim, in Windows, the coordinate of the cursor application is called the "hot spot".
    I was going to do something like that here, but realized that I don't have to.
    That's because I just use 0,0 as the hot spot and allow negative numbers for the line start points...
  • tdg8934tdg8934 Posts: 126
    edited 2013-02-25 03:58
    Rayman,

    I would not have considered negative numbers. Great idea. I'll have to take another look at this.

    Tim
  • RaymanRayman Posts: 14,537
    edited 2013-02-25 09:58
    Tim, hope it works, let me know. Can't remember if that feature was actually tested, but think it should work...

    BTW: I'm thinking replacing the color picker with this image that is borrowed from Microsoft:
    ColorPicker.png
    188 x 206 - 3K
  • tdg8934tdg8934 Posts: 126
    edited 2013-02-26 16:25
    Rayman,

    It did not work with negative numbers. I got a lot of trailing lines that moved when the cursor moved. I tried a few times with simple small cursors with negative x values and was not successful.

    Tim
  • RaymanRayman Posts: 14,537
    edited 2013-02-26 17:31
    Hmm... Well, I see one thing I maybe did wrong, but I don't think it should matter...
    Anyway, can you please change two assembly "add" to "adds" and see if it helps?


    Actually, I see now what the problem is...
    It's not the painting, it's the restoring part that's not working...

    Might need to specify a "hot spot" after all...

    I'll have to think about this a minute...
  • tdg8934tdg8934 Posts: 126
    edited 2013-02-26 18:00
    :
     lcd.StartMouse(@MouseCursor3,@lineBuffer) 'Mouse support requires mouse draw data and a buffer big enough to hold background
    :
    :
    DAT 'Define mouse pointer 3
    MouseCursor3 long          'with long, no hot spot needed as points can be relative
            long  4,10 'width, height of cursor
            long  9   '#quartets to draw
            long  0,1,mstick,1 'x,y,#width
            long  0,2,mstick,2
            long  0,3,mstick,2
            long  0,4,mstick,3
            long  1,5,mstick,2
            long  1,6,mstick,3
            long  2,7,mstick,2
            long  2,8,mstick,2
            long  3,9,mstick,1
    

    Here is the code I was using (the stick part of the other cursor). This works but if you make any x or y part negative... you get the trailing paint lines.
  • RaymanRayman Posts: 14,537
    edited 2013-02-26 18:04
    Maybe I have an idea on how to fix this for negative numbers, but it's going to take me a bit of time...

    Actually, after sleeping on it maybe we should forget negative numbers and use the hot-spot approach.
    Also, I think I'm going to change things so that each line only takes 2 longs instead of 4 to reduce the data size...
  • RaymanRayman Posts: 14,537
    edited 2013-02-27 16:55
    Ok, I've added hot spot support (easier than negative numbers)...
    Also, I've made a lot of the cursor data bytes instead of longs to make it smaller in memory
    (even though it takes more lines of code).

    SSD1963_Paint - Archive [Date 2013.02.27 Time 19.50].zip

    I've also added one extra feature that isn't exploited in this cursor defininion because I had a spare byte...
    Using the spare byte as an x increment when drawing the horizontal lines.
    Before the x increment was fixed at 1.
    But now, to draw black on either side of the arrow, I could set width to 2 and x increment to the width of the cursor.
    Make any sense?
    I think this should speed up drawing.
    Haven't tested this feature yet, just set all the x increments to 1 in this example...

    Update: Just tried the x-increment and it works. It saves a bit of time drawing the cursor edge... Here's the new data for drawing the black edge of the cursor:
    DAT 'Define mouse pointer
    MouseCursor1 long          'must be long aligned
            long  1,1  'hot spot offset in x,y  
            long  12,19 'width, height of cursor
            long  41   '#quartets to draw
            byte  0,0,1,1  'x,y,#width,increment
            long  mback      'color
            byte  0,1,2,1
            long  mback
            byte  0,2,2,2
            long  mback
            byte  0,3,2,3
            long  mback
            byte  0,4,2,4
            long  mback
            byte  0,5,2,5
            long  mback
            byte  0,6,2,6
            long  mback
            byte  0,7,2,7
            long  mback
            byte  0,8,2,8
            long  mback
            byte  0,9,2,9
            long  mback
            byte  0,10,2,10
            long  mback
            byte  0,11,2,11
            long  mback
            byte  0,12,12,1
            long  mback
            byte  0,13,8,1
            long  mback
            byte  0,14,2,3
            long  mback
            byte  0,15,2,2
            long  mback
            byte  0,16,2,1
            long  mback
    
  • tdg8934tdg8934 Posts: 126
    edited 2013-02-28 19:34
    Rayman,

    I converted my cursor over fairly easily to your new format. It's twice as big as your arrow default MouseCursor1. Notice I moved the hotspot from 0,0 to 0,1.

    Very nice!

    Tim
    :
    CON 'Define cursor colors
      mfore=lcd#rgb_LightYellow
      mback=lcd#rgb_black
      [B]mstick=$ff_a5_00  'Orange[/B]
    :
    :
    PUB Main |i
      'start VGA driver
      lcd.start
      'lcd.StartMouse(@MouseCursor1,@lineBuffer) 'Mouse support requires mouse draw data and a buffer big enough to hold background
      [B] lcd.StartMouse(@MouseCursor2,@lineBuffer) 'Mouse support requires mouse draw data and a buffer big enough to hold background[/B]
    :
    :
    [B]DAT 'Define mouse pointer 2
    MouseCursor2 long          'with long, no hot spot needed as points can be relative
            long  0,1  'hot spot offset in x,y
            long  17,22 'width, height of cursor
            long  82   '#quartets to draw
            byte  0,1,1,1 'x,y,#width
            long  mstick
            byte  0,2,2,1
            long  mstick
            byte  0,3,2,1
            long  mstick
            byte  0,4,3,1
            long  mstick
            byte  1,5,2,1
            long  mstick
            byte  1,6,3,1
            long  mstick
            byte  2,7,2,1
            long  mstick
            byte  2,8,2,1
            long  mstick
            byte  3,9,1,1
            long  mstick
            byte  8,5,3,1
            long  mback
            byte  5,6,2,1
            long  mback
            byte  7,6,1,1
            long  mback
            byte  10,6,3,1
            long  mback
            byte  4,7,1,1
            long  mback
            byte  7,7,1,1
            long  mback
            byte  10,7,1,1
            long  mback
            byte  13,7,2,1
            long  mback
            byte  4,8,1,1
            long  mback
            byte  7,8,1,1
            long  mback
            byte  10,8,1,1
            long  mback
            byte  13,8,1,1
            long  mback
            byte  15,8,1,1
            long  mback
            byte  0,9,3,1
            long  mback
            byte  4,9,1,1
            long  mback
            byte  7,9,1,1
            long  mback
            byte  10,9,1,1
            long  mback
            byte  13,9,1,1
            long  mback
            byte  16,9,1,1
            long  mback
            byte  0,10,1,1
            long  mback
            byte  3,10,2,1
            long  mback
            byte  13,10,1,1
            long  mback
            byte  16,10,1,1
            long  mback
            byte  0,11,1,1
            long  mback
            byte  4,11,1,1
            long  mback
            byte  16,11,1,1
            long  mback
            byte  1,12,1,1
            long  mback
            byte  4,12,1,1
            long  mback
            byte  16,12,1,1
            long  mback
            byte  2,13,1,1
            long  mback
            byte  16,13,1,1
            long  mback
            byte  2,14,1,1
            long  mback
            byte  16,14,1,1
            long  mback
            byte  3,15,1,1
            long  mback
            byte  15,15,1,1
            long  mback
            byte  3,16,1,1
            long  mback
            byte  15,16,1,1
            long  mback
            byte  4,17,1,1
            long  mback
            byte  15,17,1,1
            long  mback
            byte  4,18,1,1
            long  mback
            byte  15,18,1,1
            long  mback
            byte  5,19,1,1
            long  mback
            byte  14,19,1,1
            long  mback
            byte  5,20,1,1
            long  mback
            byte  14,20,1,1
            long  mback
            byte  5,21,10,1
            long  mback
            byte  8,6,2,1
            long  mfore
            byte  5,7,2,1
            long  mfore
            byte  8,7,2,1
            long  mfore
            byte  11,7,2,1
            long  mfore
            byte  5,8,2,1
            long  mfore
            byte  8,8,2,1
            long  mfore
            byte  11,8,2,1
            long  mfore
            byte  14,8,1,1
            long  mfore
            byte  5,9,2,1
            long  mfore
            byte  8,9,2,1
            long  mfore
            byte  11,9,2,1
            long  mfore
            byte  14,9,2,1
            long  mfore
            byte  1,10,2,1
            long  mfore
            byte  5,10,8,1
            long  mfore
            byte  14,10,2,1
            long  mfore
            byte  1,11,3,1
            long  mfore
            byte  5,11,11,1
            long  mfore
            byte  2,12,2,1
            long  mfore
            byte  5,12,11,1
            long  mfore
            byte  3,13,13,1
            long  mfore
            byte  3,14,13,1
            long  mfore
            byte  4,15,11,1
            long  mfore
            byte  4,16,11,1
            long  mfore
            byte  5,17,10,1
            long  mfore
            byte  5,18,10,1
            long  mfore
            byte  6,19,8,1
            long  mfore
            byte  6,20,8,1
            long  mfore[/B]
    
Sign In or Register to comment.