Button problems

Post Reply
User avatar
Dutchman
Posts: 151
Joined: Tue Aug 06, 2019 4:47 pm
Location: Netherlands

Button problems

Post by Dutchman » Fri Sep 13, 2019 1:59 pm

I wanted to make two buttons with emojis.

Code: Select all

Fsize=50 ' font size
DRAW FONT "Arial" fsize
w= 3+STRWIDTH "🔼"
h= 3+STRHEIGHT "🔼"

INBUTT SET    1 "🔼" 20,20 w,h
INBUTT FONT   1 "Arial" fsize
INBUTT BCOLOR 1 0,0,0,0

INBUTT SET    2 "🔽" 20,20+h w,h
INBUTT FONT   2 "Arial" fsize
INBUTT BCOLOR 2 0,0,0,0
INBUTT BORDER 2 0,0,0,0,0
.
Buttons.JPG
Buttons.JPG (11.63 KiB) Viewed 391 times
.
• The symbol is not centered vertically
Would an extra parameter be possible in the INBUT FONT command that can shift the "baseline"?
• As a solution, I wanted to make the border invisible in the lower button. However, that does not work.
It is still a long way to go

User avatar
kibernetik
Site Admin
Posts: 142
Joined: Tue Aug 06, 2019 3:03 pm

Re: Button problems

Post by kibernetik » Fri Sep 13, 2019 5:30 pm

Buttons differ from touchable images (aka sprites, to be implemented) by the built-in pressing effect and the border.
Button effects are managed by the system.

If you want exactly your own appearance then you will need to wait when images are implemented and then make your own button-like objects.

But if to use buttons then your code could look like:

Code: Select all

draw clear 1,1,1

Fsize=50 ' font size
DRAW FONT "Arial" fsize
w= 8+STRWIDTH "🔼"
h= 8+STRHEIGHT "🔼"

INBUTT SET    1 "🔼" 20,20 w,h
INBUTT FONT   1 "Arial" fsize
INBUTT BCOLOR 1 0,0,0,0

INBUTT SET    2 "🔽" 20,20+h w,h
INBUTT FONT   2 "Arial" fsize
INBUTT BCOLOR 2 0,0,0,0
INBUTT BORDER 2 2,1,1,1
Снимок экрана 2019-09-13 в 10.29.58 PM.png
Снимок экрана 2019-09-13 в 10.29.58 PM.png (48.74 KiB) Viewed 389 times

Post Reply