|
Post by NoVaGene on Jul 20, 2004 9:47:09 GMT -5
A question concerning this code. The program could not acquire the color of the sprite using the line "print sprcolor(sprite)". However, its ok if I use similar statement but this time using it to get the x position of the sprite with "print sprx(sprite)". Couldn't find a solution in the manual and the source codes. Any1 knows the workaround for this? Thks! - Lucas dim texture, sprite texture = LoadTexture ("data\ball.png") sprite = NewSprite (texture)
SprSetColor (1, 1, 1) SprSetPos (320, 200)
print sprcolor(sprite) 'print sprcolor() 'print sprx(sprite)
drawtext() swapbuffers()
|
|
|
Post by AHBanen on Jul 20, 2004 14:03:36 GMT -5
Lucas, This works...
dim texture, sprite texture = LoadTexture ("data\ball.png") sprite = NewSprite (texture)
SprSetColor (1, 1, 1) SprSetPos (320, 200)
print sprcolor(sprite)(0) 'print sprcolor() 'print sprx(sprite)
drawtext() swapbuffers()
...but I've got no idea what this number means (sprcolor returns an araay of length 1(!) it seems, can this be correct? Note: real() sprcolor(), real() sprcolor(int)
André
|
|
|
Post by AHBanen on Jul 20, 2004 14:10:08 GMT -5
Lucas, Sorry, sprcolor returns an array of length 2 (still strange)...
dim texture, sprite texture = LoadTexture ("data\ball.png") sprite = NewSprite (texture)
SprSetColor (3, 2, 1) SprSetPos (320, 200)
printr sprcolor(sprite)(0) printr sprcolor(sprite)(1) 'print sprcolor() 'print sprx(sprite)
drawtext() swapbuffers()
André
|
|
|
Post by NoVaGene on Jul 22, 2004 3:25:05 GMT -5
Hey thanks, André! There is some syntax inconsistency in these functions or maybe Tom has missed out certain aspects in documentation. In your code, printr sprcolor(sprite)(0) printr sprcolor(sprite)(1) it returned only the red & green color values. The blue value is missing. Possibly a bug in the langauge. Regards, Lucas Tan ps: wld report it as a bug later when its being affirmed
|
|
|
Post by Tom not logged in on Aug 8, 2004 2:42:59 GMT -5
Yep, that's a bug. SprColor is supposed to return a 4 element array (red, blue, green, alpha). Will fix in next release (v2.2.4).
-Tom
|
|