transparency

Discussion in 'Questions (Windows Mobile)' started by colin9876, Nov 15, 2007.

  1. colin9876

    colin9876 Active Member Licensed User

    Writing some code now, 1st game where man has to jump onto a swinging rope.
    Rope code is something like
    For angle= -2 to 2 step .1
    Line (120,120, 100*(1+sin(angle)),100*(1+cos(angle)),cBlack)
    Next
    ..etc...

    Obviously the rope leaves a trail of where it was before. Rather than drawing over the previous line in the background colour I wanted to try the
    SetTransparencyColor function and then draw it to the foreground (I saw it was done like this in the clock program.)
    What do I have to do to make this happen?

    I tried SetTransparencyColor=CBlack, and put a ,f) at the end of the line command but it didnt make any difference. Do I specifically have to clear the foreground somehow before I redraw my rope.

    I hope my question makes sense? Grateful for any help
     
  2. colin9876

    colin9876 Active Member Licensed User

    I see actually that the clock prog does clear a circle every tick, so what my question is ....
    1) How does transparency funtion work & What happens when you settransparencycolor

    2) Also I know how to do a line [form1.line(....] but cant work out how to do a point [tried form1.plot and form1.point] can someone tell me the keyword please?
     
  3. agraham

    agraham Expert Licensed User

    There isn't one.

    Use "Form1.Line(x, y, x+1, y+1, color)" to set a single pixel.
     
    Last edited: Nov 16, 2007
  4. Erel

    Erel Administrator Staff Member Licensed User

    SetTransparentColor determines which color will be used as the transparent color (forelayer only).
    You could use Form.FErase or draw on the forelayer with the transparent color to part of it.
    Note that ImageLib gives more options for transparent drawings.
     
  5. colin9876

    colin9876 Active Member Licensed User

    Thanks - this Basic4PPC really is good - except Ive found one prob I will have to work round ...
    ....I had my program DrawRope which twirled a rope round BUT I didnt see it till it had got to the end of the Sub. That is to say that the screen didnt refresh all the time the rope was moving - so I only saw the rope in the end position!!

    Is that ususal for PocketPCs to only update the screen at the end of a proceedure or is this an issue with Basic4PPC ???

    OK I could get round this by having the rope move each step by a TimerClick but is there anyway to force a screen refresh in the middle of a drawing loop?
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    If you are using a tight loop for the drawings then you can add DoEvents statement to cause the screen to redraw itself.
    I recommend you to use Timer_Tick events instead.
     
  7. colin9876

    colin9876 Active Member Licensed User

    great thanks - last question.
    :sign0188:
    Im using a HTC VGA Universal, but it plots to the screen as if its only 320x240.
    I tried going into the form and changing the property dimensions but I couldnt edit those boxes.

    1) How do I make a program findout if the screen is VGA?
    2) How do I then do line(0,0,640,0, ..) etc
     
  8. Erel

    Erel Administrator Staff Member Licensed User

Loading...