Shop OBEX P1 Docs P2 Docs Learn Events
TV Graphical display - help needed — Parallax Forums

TV Graphical display - help needed

computer guycomputer guy Posts: 1,113
edited 2008-10-12 12:46 in Propeller 1
Hi everyone,


I need help writing some code that can use the graphics driver to display 5 squares on a tv.
The squares will be in a horizontal line and be:

Green Red Yellow Blue Orange.

They will need to be able to be hidden.

If green == true
  showgreen
else
  hidegreen




Something like that.


I have never done graphics programming on the prop or any device for that matter.


Any help would be greatly appreciated.

Thank you smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

Guitar Hero controller using the prop (WIP) --> HERE

Comments

  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-10-10 10:46
    That's going to be a little difficult because the graphics driver only works with four colours per tile. So, since you want at least 6 colours your going to have to make sure that the boxes are all on different tiles and then set up different colours on the different tiles.

    Other than that just grab the graphics demo and start playing with it. Its fairly easy to use.
  • computer guycomputer guy Posts: 1,113
    edited 2008-10-10 10:49
    The squares will always be in the same location.
    attachment.php?attachmentid=55884

    The squares will just appear or disappear.
    I have tried playing with the graphics demo in this thread.
    http://forums.parallax.com/showthread.php?p=752119

    However have gotten no where.


    Thank you Steven smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • RaymanRayman Posts: 14,243
    edited 2008-10-10 11:08
    What you want is really easy without graphics! Just change the color of the tiles in question.

    After clearing the screen, all screen tiles is the tile array are the space tile with some color, usually black. So, just make new solid colors in the color table.

    Then, either replace tiles in the tile array with space tiles with the appropriate color, or just change the bits in the tile array that correspond to color (I think th elower 6 bits in each word).
    Each tile is represented by a word in the tile array.
  • computer guycomputer guy Posts: 1,113
    edited 2008-10-10 11:25
    I have never programmed with visual displays.
    I understand that I need to set the tiles colors in the tile array but have no idea how.


    Thank you Rayman smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • RaymanRayman Posts: 14,243
    edited 2008-10-10 20:38
    Well, the simple way would be to start with TV_Text or TV_Text_Demo... Just use TV_Text's OUT function to change color, set cursor position, and output spaces (OUT(32) should print a space in the current color.
  • AribaAriba Posts: 2,687
    edited 2008-10-11 18:30
    Here is a little Demo, of that what Rayman says:
    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
    OBJ
      text : "tv_text"
    
    PUB start | i
      text.start(12)
      text.setcolors(@myPalette)
      repeat
        text.out(0)
        repeat i from 1 to 5
          text.out(12)                'set color for block
          text.out(i)
          text.str(string("      "))  'draw block (6 spaces)
          waitcnt(clkfreq>>2+cnt)
        waitcnt(clkfreq+cnt)
        text.out(1)
        repeat i from 1 to 5
          text.out(12)                'clear color for block
          text.out(0)
          text.str(string("      "))  'draw block
          waitcnt(clkfreq>>2+cnt)
        waitcnt(clkfreq+cnt)
    
    DAT
    myPalette  byte $02,$02   'black/black
               byte $02,$D8   'green/black
               byte $02,$38   'red/black
               byte $02,$9E   'yellow/black
               byte $02,$88   'blue/black
               byte $02,$18   'brown/black
    
    



    Andy
  • computer guycomputer guy Posts: 1,113
    edited 2008-10-12 07:06
    Thank you both. smile.gif

    Just a quick question, where can I find the color codes?

    Andy, your example is exactly what I need.

    Thank you smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.

    Guitar Hero controller using the prop (WIP) --> HERE
  • AribaAriba Posts: 2,687
    edited 2008-10-12 08:14
    I use 'Graphics_palette.spin' from the Library Examples for the color codes.
  • RaymanRayman Posts: 14,243
    edited 2008-10-12 12:46
    I've got a tabulated screen capture from that program here:

    http://www.rayslogic.com/propeller/Programming/TV_Colors.htm
Sign In or Register to comment.