Shop OBEX P1 Docs P2 Docs Learn Events
Post-increment NOT working !!! — Parallax Forums

Post-increment NOT working !!!

HarleyHarley Posts: 997
edited 2010-08-26 19:11 in Propeller 1
What would prevent the post-increment from occurring?
PUB SetColor(text, background)                          
  if text == oldColorText and background == oldColorBackground
    print($111 + colorIndex - 1)                        ' use last color
  else
    gobalColor :=  byte[@colorPalette + text]           ' ms byte for foreground text
    gobalColor <<=  8
    gobalColor +=  byte[@colorPalette + background]
    gobalColor <<=  8
    gobalColor +=  byte[@colorPalette + text]
    gobalColor <<=  8
    gobalColor +=  byte[@colorPalette + background]
 
    longmove(@menuColors + (colorIndex * 8), @gobalColor, 1)
 
    gobalColor :=  byte[@colorPalette + text]           ' ms byte for background colot
    gobalColor <<=  8
    gobalColor +=  byte[@colorPalette + text]
    gobalColor <<=  8
    gobalColor +=  byte[@colorPalette + background]
    gobalColor <<=  8
    gobalColor +=  byte[@colorPalette + background]
 
    longmove(@menuColors + (colorIndex * 8) + 4, @gobalColor, 1)
    print($111 + [b]colorIndex++[/b] )
    colorIndex <#= $0E
    oldColorText := text
    oldColorBackground := background
VAR colorIndex is assigned as a byte. Using a debug print statement to display it, colorIndex remains at whatever value exists prior to its use.

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2010-08-26 10:59
    Harley,

    Could it be that the same values for text and background are being sent to the method?

    I'm still using the method and works for me (I'm only using text, no graphics).

    Duane
  • HarleyHarley Posts: 997
    edited 2010-08-26 12:30
    Thanks, Duane

    I had several things wrong at the same time. Your suggestion was one. I note that I AM getting various colors for text (and its associated background color), but the graphics part, namely this one:

    gr.color(n)

    doesn't seem to allow more than 4 colors to be used. So if I have 16 rectangles side by side generated by

    gr.box(x,y,w,h)

    those rectangles, which I assumed would be either a text or background color DOESN'T get properly colored. I'll have to look further into the Graphics driver to find out what I should be doing. I didn't realize trying to get those '16 colors' mentioned by LaMothe's book isn't very straightforward. Not giving up.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2010-08-26 13:04
    According to UPS, my book is "out for delivery." I'm looking forward to undstanding the Prop better.

    Duane
  • HarleyHarley Posts: 997
    edited 2010-08-26 19:11
    @ Duane,

    'Out for delivery' sounds good. There is a 'ton' of info in the Hydra book. Just wish there were a good way to make the binding of the book tons better also. They made a mistake on the binding, IMHO.

    I looked into Graphics.spin on how they deal with the 'gr.color' command. Unfortunately they use 'setcommand(....)' but 'gr.setcommand(...)' doesn't work. Graphics limits the color to the lower 2 bits (masking c & 3). I thought maybe I could go in and change that, but it didn't compile right.

    There still must be something I can 'trick' graphics into allowing a 4-bit mask.

    Off-topic, MacMall had a 1 TB external HD for $50 after mail in rebate. $0 shipping if choose ground. That should arrive Monday, so I too am looking forward to a 'out for delivery' note. I don't presently have a decent backup system; feel there should be one.

    Got to dig into that book for some clue as to getting the 16 colors. First pass through the CD I didn't recognize anything to do with color graphics, or even getting those colors. Dig, dig, dig...
Sign In or Register to comment.