Shop OBEX P1 Docs P2 Docs Learn Events
Help with getting started with graphics and touchscreens... where to start? — Parallax Forums

Help with getting started with graphics and touchscreens... where to start?

vanmunchvanmunch Posts: 568
edited 2012-07-23 13:16 in Propeller 1
Hey everyone,

I recently purchased a couple of Rayman's excellent 4.3 inch touchscreens and got his demo programs running on then within 20 minutes of opening the box. Now I'm trying to figure out how to modify the code so that I can change the background and font colors, draw buttons/ graphics, and have it recognizes when one of the buttons have been pushed. The part that really has me stumped is with the graphic/color stuff and there codes. I've found the "Character Chart", but I can't find anything that helps with the colors or being able to change the background/font colors. I've already read through the massive "4.3" Touchscreen Thread Consolidation Test" thread (condensed version found here: http://forums.parallax.com/showthread.php?132083) Any help would be great. I feel like there is a great "Intro to using your touch screen and how to change the graphics" out there, but I'm just not looking in the right spot....?


Dave

Comments

  • JonathanJonathan Posts: 1,023
    edited 2012-07-20 20:29
    Dave,

    I have some poorly written and documented code for those touch screens. It can detect vertical and horizontal slides, scroll through a row of buttons with the slide, detect single and double clicks and so on. If you don't get a better offer, contact me off list at: jpeakall AT madlabs DOT info.

    But if yer lucky, someone will have some better code. Heck, I'd like some better code too! :-)

    Jonathan
  • RaymanRayman Posts: 14,826
    edited 2012-07-21 05:45
    Dave, the regular 4.3" driver is just a modified version of the standard VGA driver.
    The colors work exactly the same way...

    Somewhere in the main Spin program you should have this:
    DAT
    vgacolors               long
                            long    $F00CF00C       'blue background with yellow letters
                            long    $F0F00C0C
                            long    $08A808A8       'green
                            long    $0808A8A8
    

    The first two longs there define the default foreground and background color (text color #0).
    This is also the background color when the screen is cleared.
  • vanmunchvanmunch Posts: 568
    edited 2012-07-21 07:41
    Jonathan Thanks for the offer, I sent you an Email.


    Rayman wrote: »
    Dave, the regular 4.3" driver is just a modified version of the standard VGA driver.
    The colors work exactly the same way...

    Somewhere in the main Spin program you should have this:
    DAT
    vgacolors               long
                            long    $F00CF00C       'blue background with yellow letters
                            long    $F0F00C0C
                            long    $08A808A8       'green
                            long    $0808A8A8
    

    The first two longs there define the default foreground and background color (text color #0).
    This is also the background color when the screen is cleared.

    Hey Ray, I found that and tried chanding the values, but it was just a mess. I was hoping that there was a kind of a color key such as "This color is" $08A808A8
    I found the below key, but I don't understand how those codes are used to create the ones in the program. Any help would be great! :)

    Dave

    Color64_B.gif@
  • pik33pik33 Posts: 2,397
    edited 2012-07-21 08:22
    Colors are coded binary rrggbbss_rrggbbss_rrggbbss_rrggbbss where ss are reserved for v and h sync. One long gives four colors. They are all used in 4-color mode. In 2-color mode only lower 16 bits of this long is used.

    So $F00C is 11110000_00001100. Color 0 is 00 red, 00 green, 11 blue; color 1 is 11 red, 11 green, 00 blue. You have yellow pixels on blue background.

    This is a piece of code from my vga driver:
    pub setfontcolor(line,pos,r,g,b) | temp, place, color
    
    '*******************************************************************************
    '
    ' Set colors for text at line (0..29) and position (0..19)
    ' and put them in the color buffer
    '
    '*******************************************************************************
    
    color:=r<<6+g<<4+b<<2
    
    (...)
    
    
  • RaymanRayman Posts: 14,826
    edited 2012-07-21 08:34
    Dave,

    There's an applet here for deciphering/encoding the colors:
    http://www.rayslogic.com/propeller/Programming/Colors.htm

    under the applet is info on the format for text mode...
  • vanmunchvanmunch Posts: 568
    edited 2012-07-21 10:06
    @pik33 & Ray

    Thanks for your help and info. I feel like I'm starting to make some real progress. The explination of the how the colors are coded is great and Ray's applet is wonderful. I've been able to change the background and text colors to whatever I want. Such as black and white using $FC00FC00 and then $FCFC0000 (incase any lurkers are trying to figure out the same thing :) ) Now that I can change the colors, I'm going to go and start working on figureing out the other stuff... :)
  • JonathanJonathan Posts: 1,023
    edited 2012-07-22 18:41
    Dave,

    Never got an email, just so ya know.

    Jonathan
  • vanmunchvanmunch Posts: 568
    edited 2012-07-22 18:48
    Jonathan wrote: »
    Dave,

    Never got an email, just so ya know.

    Jonathan

    opps, sent it to .com by accident
  • RaymanRayman Posts: 14,826
    edited 2012-07-23 03:40
    Dave,

    If your feeling brave, you can also try VisualSpin with that 4.3" touchscreen.
    It can help you quickly make a GUI. But, there's no help file or instructions...
  • vanmunchvanmunch Posts: 568
    edited 2012-07-23 13:16
    Hey everyone, thanks for your great help. Using Ray's color applet I was able to figure out how color codes work and how to get the colors I wanted. Over the weekend I was able to create the GUI that I wanted that works with the touchscreen. It's basic, but it works and Jonathan was kind enough to send me his program. I'm going to have time tonight to look at it and probably realize a dozen ways to make mine better.

    @Ray I've never used VisualSpin before, sounds like something else I need to try. :)

    Thanks again for everyone's help!

    Dave
Sign In or Register to comment.