Share via Twitter, Facebook...

magarcan

Active Member
Licensed User
Longtime User
Share via Twitter, Facebook... + Canvas

Hi! I'm developing a game, and I want my users can share their scores using facebook, Twitter...

I've tried using javascript code that Twitter provides, but the problem is that user can edit text in the textbox.

Do you have any idea??

One way is using the Twitter library, but user would have to give my program user and passwd.

Other solution, I think, is taking an screenshot of my program wshowing the score and send this.

Thanks!!!
 
Last edited:

magarcan

Active Member
Licensed User
Longtime User
Thanks!! When I arrive home I'll check this.

Now a little question more:
I've an image file (in .PNG for example), and I want to write in it some text and save the image. Which is the best way to do this?? I know that I can save an image with Canvas.Bitmap.WriteToStream, but I don't know how to write some text over this before saving.

Thanks again!!!
 
Last edited:
Upvote 0

magarcan

Active Member
Licensed User
Longtime User
You can write text with Canvas.DrawString.
I think you are referring to Canvas.DrawText, doesn't it?

Maybe, something like this could work??
B4X:
Dim Bitmap1 As Bitmap
Bitmap1.Initialize(File.DirAssets, "MyImageFile.png")

Dim DestRect As Rect
DestRect.Initialize(10dip, 10dip, 10dip + 100dip, 10dip + 100dip)
Canvas1.DrawBitmap(Bitmap1, Null, DestRect)

Canvas1.DrawText("Sample text.", 200dip, 200dip, Typeface.DEFAULT_BOLD, 30, Colors.Blue, "LEFT")

Dim Out As OutputStream
Out = File.OpenOutput(File.DirRootExternal, "Test.png", False)
Canvas1.Bitmap.WriteToStream(out, 100, "PNG")
Out.Close
Thanks!!
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…