Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Problem with filled DrawBox

Author
Message
JulioTFP
7
Years of Service
User Offline
Joined: 5th Mar 2017
Location:
Posted: 5th Mar 2017 21:30
Hello,

I'm a spanish user and i'm not so good speaking English so please first apologize me.

In the past, I ordered DarkBasic Pro and programm a lot of staff a few years ago. Now I recently purchase the AppGameKit Basic and I was testing it. One of my 'experiment' was to creat a function to make buttons. I already did it in DBPro so I think that it will be easy. But I was wrong.

This is my function in DBPro

(HacerBoton = Make Button / PulsarBoton = Press Button)



But I have a lot of trouble converting this into AGK. I'm only trying to convert the first function (HacerBoton) but I have one problem. If I fill the box, the text won't appear above the screen. If I don't fill it, the function work perfectly. So my question is: how can I solve this problem? I want the text above the filled box.



I hope had explained myself correctly. Thanks a lot!!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 5th Mar 2017 22:46
In AppGameKit, it would be easier to do this with sprites.

myButton = createSprite(0)

will make a white sprite, 10x10 pixels. Then you can resize:

setSpriteSize(myButton, sizeX, sizeY)

and position:

setSpritePosition(myButton, posX, posY)

and change the colour:

setSpriteColor(myButton, 160,160,160,255)

If you want to make something more complicated, you can draw many sprites, GetImage() and then use this image as your sprite.

To put the text on top of the Sprite (the default depth is 10):

SetTextDepth(myText, 9)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
JulioTFP
7
Years of Service
User Offline
Joined: 5th Mar 2017
Location:
Posted: 6th Mar 2017 20:18
Thanks a lot.

With only one sprite is really easy, if I want to add an edge is more complicatted. Its time to continue improving!!

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 6th Mar 2017 21:03
You are coding like a DBPro coder

This part...



should be done like this in AGK...



This will assign a unique identifier in Boton for your new sprite. It will start at 10001 and count upwards with each new sprite.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
JulioTFP
7
Years of Service
User Offline
Joined: 5th Mar 2017
Location:
Posted: 6th Mar 2017 22:15
Cool! Thanks again.
JulioTFP
7
Years of Service
User Offline
Joined: 5th Mar 2017
Location:
Posted: 12th Mar 2017 10:22
My experiment it's done


Sometimes you have to press twice the left mouse button or it didn't work. I think it's a sync rate problem. But i don't mind it a lot.

Thanks again!

Login to post a reply

Server time is: 2024-09-30 01:24:16
Your offset time is: 2024-09-30 01:24:16