Function to get current font size (needed it)

Post Reply
Henko
Posts: 814
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Function to get current font size (needed it)

Post by Henko »

def font_size = (text_width("0123456789")-1)/6

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Function to get current font size (needed it)

Post by Mr. Kibernetik »

Very smart function!

Next release will have such function built-in.
It was interesting to compare speed of this user function wih built-in function.
User function performs 100000 times in 1.727 seconds.
Built-in function in 0.269 seconds.

Dr zayus
Posts: 25
Joined: Sat Dec 14, 2013 10:47 pm

Re: Function to get current font size (needed it)

Post by Dr zayus »

Yes, there's excellent performance in Smart Basic. Great accuracy on sprite collisions also.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: Function to get current font size (needed it)

Post by Mr. Kibernetik »

Dr zayus wrote:Yes, there's excellent performance in Smart Basic. Great accuracy on sprite collisions also.
Nice to hear that!

Post Reply