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 / Feature request

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 10th Jun 2013 08:10
Could the developers overload any of the functions that take color value parameters? It's kind of annoying to have to track 3 variables when setting the color for something when most often I don't need to worry about the individual components.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 10th Jun 2013 09:36
+1
agree
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 10th Jun 2013 10:50
You can do it by yourself. It was the first thing i done.
All my functions have a string for the color like this:

"255-255-255-255"

and i done the RGBA converter <->

Try to do in this way.

Long life to Steve!
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Jun 2013 11:08
xGEKKOx, I think he means adding something like: setSpriteColorRed(spriteID, value)

So that you don't have to: setSpriteColor(spriteID, value, getSpriteColorGreen(spriteID), getSpriteColorBlue(spriteID), getSpriteColorAlpha(spriteID))

I agree this would be a useful addition. Could you stick it on the Google issues board Phaelax? It might get missed here.


this.mess = abs(sin(times#))
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 10th Jun 2013 11:33
Ok, it's been added to the board.

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 10th Jun 2013 17:35
+1 from me

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 10th Jun 2013 19:02
Quote: "xGEKKOx, I think he means adding something like: setSpriteColorRed(spriteID, value)"


Am I misunderstanding something? AppGameKit already has these commands:

SetSpriteColorRed ( iSpriteIndex, iRed )
SetSpriteColorGreen ( iSpriteIndex, iGreen )
SetSpriteColorBlue ( iSpriteIndex, iBlue )
SetSpriteColorAlpha ( iSpriteIndex, iAlpha )

integer GetSpriteColorRed ( iSpriteIndex )
integer GetSpriteColorGreen ( iSpriteIndex )
integer GetSpriteColorBlue ( iSpriteIndex )
integer GetSpriteColorAlpha ( iSpriteIndex )
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 10th Jun 2013 19:50
@xCept
i think he mean setSpriteColor(spriteID, RGBA) not setSpriteColorRed
XanthorXIII
AGK Gold Backer
13
Years of Service
User Offline
Joined: 13th May 2011
Location:
Posted: 10th Jun 2013 20:51
You would probably need to use the hex value of a color with function to get what you want. That is something I think would work. For each value is represented by 00 - FF. The value would need to be passed in as a string. A hex converter could parse the values out. And then call the AppGameKit functions to change the color.
So ChangeSpriteColor(SpriteID,String Color). Color would be FFFFFFFF. Problem solved. Unless you don't like working in Hex values.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 10th Jun 2013 21:55
@XanthorXIII
law or programming : botch things up is forbidden

the best way is a overload command that get a 32 bit integer for color.
blitz basic used a special trick for SetColor(r,g,b,a)
there you can use the complete value at last with the same command
SetColor(0,0,0,RGBA)
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 10th Jun 2013 22:06
Quote: "You would probably need to use the hex value of a color with function to get what you want"

Why? 16711680 is the same as FF0000 so I can use either one.

Quote: "The value would need to be passed in as a string. "


AGK supports hexadecimal(prefix with '0x'), so you can forget about strings altogether.



https://code.google.com/p/agk/issues/detail?id=572&sort=-id

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 10th Jun 2013 22:48
more occasion is, string is slow, integer is fast in this request.
XanthorXIII
AGK Gold Backer
13
Years of Service
User Offline
Joined: 13th May 2011
Location:
Posted: 11th Jun 2013 03:12 Edited at: 11th Jun 2013 03:14
ChangeSpriteColor(int,string)

The String is passed in the format "FFFFFFFF" First 6 Characters are the RGB Channel in groupings of 2, 00-FF followed by the last 2 characters which is the alpha channel.




Then you can call the function with the SpriteID, followed by the Hexvalue of the color which is easier to find from a color chart
or color picker. Of course if you want to set transparency to something different than say full opaque you may have to break out a calculator to handle it. There is no error checking in this at the moment.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 11th Jun 2013 12:48
@XanthorXIII
you can add this snippet as remark for Phaelax feature request
in the google issue list and ask for it too.
maybe we get both.
XanthorXIII
AGK Gold Backer
13
Years of Service
User Offline
Joined: 13th May 2011
Location:
Posted: 11th Jun 2013 21:06 Edited at: 11th Jun 2013 21:10
@Markus maybe but I think there should be a line between when a feature is needed and when we already have the tools to do what we need to do. I agree though that the color functions should be improved upon though. So I will submit. Thought I give it a try and give you guys a nice function to use.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 11th Jun 2013 21:36
@XanthorXIII
i think each simplification measure give us(community) more time/fun to develope a
game. agk is the ideal/central way to distribute/share more commands.
we profit all of it.
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 11th Jun 2013 21:59
In a past unreleased project I used bitwise operators to extract the RGBA components of an integer and vice versa. This made it easy to do exactly that, pass an integer as a single color value and back. If I can dig up the source I will post the functions.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Jun 2013 18:12
XanthorXIII, I still don't see why you insist on using strings?




And if for some reason you want to stick with strings, my function is still plausible if you use val(hexString, 16).

XanthorXIII
AGK Gold Backer
13
Years of Service
User Offline
Joined: 13th May 2011
Location:
Posted: 12th Jun 2013 20:37
Ok. Didn't realize Tier 1 can bit shift. Probably better as that value can be stored in an Int. Just probably need to add some error checking and should be good to go.

Login to post a reply

Server time is: 2024-11-24 15:37:18
Your offset time is: 2024-11-24 15:37:18