Page 2 of 2

Posted: Wed Jan 05, 2005 6:34 am
by PolyVector
Of couse nobody's posted them before, I researched and wrote them in response to your original question...
so... you're welcome...

Posted: Wed Jan 05, 2005 9:04 am
by traumatic
Shannara wrote:Anyways, I PM'd him even though he havent been on the forums since October 2004.
Better try to get him at the german forum.

Posted: Wed Jan 05, 2005 11:35 am
by The_CodeMaster
Until then, anybody have a way to change the colors of the four corners of a Sprite3D?
Manual
The 2D sprite used to create the 3D sprite must not be deleted when a 3D sprite use it. A single 2D Sprite can be used by any number of 3D Sprite.
mmm... Somehow I know there is a way to perform direct memory-functions on the videocard. Nice one, I will look into it :)

Posted: Wed Jan 05, 2005 8:49 pm
by cecilcheah
Hi there

I have recently done something like this, but not what you want, but i want to share anyway after getting so much from the forum.

Here is how i convert RGB to Hex. Suppose your RGB Color is in this format: 255,30,30

Code: Select all

Procedure.s Hex1(farb.l)  ; To make sure it return 00 not 0
  If Hex(farb.l) = Str(0)
    Result1 = "00"
  Else
    Result1 = Hex(farb.l)
  EndIf
  ProcedureReturn Result1 
EndProcedure 


HexColor  = "#" + Hex1(Val(StringField(RGBColor,1,",")) + Hex1(Val(StringField(RGBColor,2,",")) + Hex1(Val(StringField(RGBColor,3,","))

Take care

Cecil

Posted: Wed Jan 05, 2005 10:09 pm
by Shannara
Thanks Poly, I must of read your post wrong...

Anyways, Danilo replied stating the his code no longer works because the Sprite3D have changed a bit since the code was posted ... so ... that sucks :)

Posted: Thu Jan 06, 2005 1:55 am
by Shannara
The newest description of the Sprite3D lib and its structures
should be in the PB Library SDK.
You have to rewrite the code every time the PB lib internals
change.
This above is from Danilo. I looked all in the C:\Program Files\PureBasic\Library SDK and there is nothing concerning Sprite3D.. anybody know where else to look? Im still searching.

Posted: Thu May 18, 2006 7:22 pm
by Kale
A more elegant and cross platform method:

Code: Select all

;Convert a 24bit colour value to a Hex string
Procedure.s RGBToHex(Colour.l)
	Protected HexString.s = "#"
	HexString + RSet(Hex(Red(Colour)), 2, "0")
	HexString + RSet(Hex(Green(Colour)), 2, "0")
	HexString + RSet(Hex(Blue(Colour)), 2, "0")
	ProcedureReturn HexString
EndProcedure

Posted: Thu May 18, 2006 7:38 pm
by Shannara
Thanks to both Cecil and Kale :)