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 / Specifying colours in drawbox command

Author
Message
Jambo B
14
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 27th Jul 2014 16:52
Hi all,

I'm missing something here, I'm sure, but how do I specify a colour other than red for the corners of the box.

From the docs:

Quote: "Definition

DrawBox( x, y, x2, y2, color1, color2, color3, color4, filled )

Parameters

x - The X component of the top left corner of the box.
y - The Y component of the top left corner of the box.
x2 - The X component of the bottom right corner of the box.
y2 - The Y component of the bottom right corner of the box.
color1 - The color to use in the top left corner.
color2 - The color to use in the top right corner.
color3 - The color to use in the bottom left corner.
color4 - The color to use in the botom right corner.
filled - 1 to draw a filled box, 0 to draw an empty box."


So what are these 'colors'? The manual doesn't say. I remember in DBP, we used to be able to pass rgb(255,255,255) as a parameter.

Googled it, no joy. I must be missing something!

Thanks for any help,

James
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 27th Jul 2014 23:17
I'm sure you can just use RGB() in the same way as you do in DBPro, these colours will actually blend linearly... or you can just use the same colour for each corner to have a solid box.

I am the one who knocks...
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 28th Jul 2014 01:02
The instructions tell you right there, each color corresponds to a corner.

JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 28th Jul 2014 01:17
I understand Jambo's problem. The function definition is, frankly, ridiculous. As defined, you can have 4 coloured dots at the corners of a rectangle whose sides are of undefined colour, and the box may be filled with an undefined colour. Daft!

-- Jim - When is there going to be a release?
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 28th Jul 2014 02:14
Yes it is very poorly described. Oddly enough, AppGameKit still doesn't have a proper RGB command. However, if you throw these functions into your code you can then use RGB() in place of the color value.



Sample usage (draws a box with four different colored corners, filled in):

Jambo B
14
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 28th Jul 2014 13:58
Thanks for the replies. I agree that the docs are very poor for this command.

xCept - very useful code, thanks!

Interestingly, I've just installed build 108.23b (15th July 2014) and the drawbox command has gone - looks like it's been depreciated. Back to the 'drawing' board!

Cheers all,

James
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 28th Jul 2014 16:07
That documentation does need improving. Colors can be created with the MakeColor command or with the bitwise operators like so


These commands are only available in version 2, I've improved the documentation for the next update.
Jambo B
14
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 29th Jul 2014 01:42
Much appreciated, Paul - and I'd also like to say that it's nice to see that the developers are listening and responding to posts like this.

Login to post a reply

Server time is: 2024-04-27 05:59:47
Your offset time is: 2024-04-27 05:59:47