2014년 11월 29일 토요일

Adding text and buttons onto a canvas


Is it possible to add text and buttons onto a canvas? If so, how would you do it.

--
You can add text (there's blocks for drawing text on canvas) and use an image sprite instead of a button.


--
Yes.


Text:  call Canvas1.DrawText
   text =  what you want to display on the Canvas
   x  = the x coordinate to start the text
   y  = the y coordinate

Buttons:  You can not actually place a button.  What you do is simulate a button with a sprite   (the sprite can be a small box image, perhaps 48 x 48 pixels for example)

Find a suitable image for your 'button' .... it can be any shape... round, square, rectangular.
    
Use imageSprite. 
set imageSprite to ... the name of your image for your 'button'

Then put the code you would normally put in a button.click event handler in    a  when imagesprite.Touched block.

Try  some blocks.    Send us a jpg or png image of the code if you have issues.    If this works for you, please let us know.

--
Thank you SteveJG.
But there was another socket called component. What are the blocks to fill it with? Please Explain.

--
You're using the "Any" blocks at the bottom.  They are for doing actions with multiple components of the same type.  Use the blocks above from each of your named components instead.  Don't use the Canvas fron the Any blocks, use the blocks from Canvas1 etc.

--

댓글 없음:

댓글 쓰기