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 / Using DrawBox/DrawLine and GetImage() to create a grid sprite

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 10th Jul 2019 00:55 Edited at: 10th Jul 2019 00:56
I am trying to use DrawBox/Line to draw a grid that will scale to varying resolutions.
So i Draw a box to cover the screens resolution and then draw lines across and down the screen then use GetImage() to create a sprite

Here's the problem;
It appears that drawing the lines doesn't draw a line but draws transparency through the box.
If you look at the code the lines should be red but they end up being the colour of the background. It's very weird!




Attachments

Login to view attachments
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 10th Jul 2019 01:42 Edited at: 10th Jul 2019 01:59
replacing this part of code and the lines appear red

I think doing it the other way it only works with the makecolor(r,g,b) command
for example print(MakeColor(200,0,0)) will display -16777016 so the hexadecimal
equivalent is -ffff38 which I don't think can be represented in AppGameKit with the color
commands
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 10th Jul 2019 01:58
Sheesh! I'm so stoopid. Thanks fubes!
MadBit
VIP Member
Gold Codemaster
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 10th Jul 2019 07:34 Edited at: 10th Jul 2019 07:37
That would work, too.

DrawBox(0, 0, w, h, 0xff909090, 0xff909090, 0xff909090, 0xff909090, 1)
DrawLine(i, 0, i, h, 0xff0000ff, 0xff0000ff)

The first 8bits (from left) are the alpha values
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 10th Jul 2019 07:41 Edited at: 10th Jul 2019 07:41
Ah thanks Mr Bit. I didn't know about the alpha bits

Login to post a reply

Server time is: 2024-11-22 21:39:22
Your offset time is: 2024-11-22 21:39:22