Page 1 of 2

ICE_SpriteFont3D library (0.0.6)

Posted: Sat Dec 02, 2006 1:32 am
by IceSoft
Actual version: 0.0.6

[New]
Zoom Font

User Library:
ICE_SpriteFont3D

Demo:
ICE_SpriteFontLib_Demo.zip


Screenshot:
Image[/url]org/files/78/ICE_SpriteFont.PNG[/img]

Posted: Mon Dec 04, 2006 9:39 pm
by IceSoft
[Add]

Code: Select all

ICE_DisplayTranslucentSpriteText(x.l, y.l, intensity.w) 
Display a 'translucent' string.

Add a screenshot too.

Posted: Tue Dec 05, 2006 3:48 pm
by dontmailme
Nice :)

Translucent is very slow on my system though :(

Everything else is great ;)

Posted: Tue Dec 05, 2006 4:46 pm
by IceSoft
dontmailme wrote:Nice :)
Translucent is very slow on my system though :(
Everything else is great ;)
About Translucent: I am on it ;-)
Thanks for the rest...more features will come.

Posted: Tue Dec 05, 2006 5:01 pm
by dracflamloc
Pretty neat, I assume you prerender the font to a surface and use it like a bitmap font?

If so could you make your bitmap font rendering routines open source?

Thanks

Posted: Tue Dec 05, 2006 10:00 pm
by IceSoft
New version: 0.0.2

[ADD]

Code: Select all

SpriteFont6 = ICE_CreateSpriteFontFromImage(".\BitmapFonts\094.bmp")
Load a bitmap font and convert it to aSpriteLib font.

If you want to use your own bitmap font please add a 'inf' file to the bitmapfont too.
On the inf file there is the 'Letter'-Map of the bitmapfont image.
Look on the both example bitmap font inf file and you will understand it.


New misc commands:

[ADD]

Code: Select all

ICE_GetFPS()
Returns the FPS as a long.

Posted: Tue Dec 05, 2006 10:45 pm
by dracflamloc
Cool stuff.

Posted: Wed Dec 06, 2006 8:38 pm
by IceSoft
Version 0.0.3 uploaded

Posted: Thu Dec 07, 2006 3:14 am
by mskuma
I'm not sure if it makes sense to ask this.. are you planning to support unicode with your lib?

Posted: Thu Dec 07, 2006 6:42 am
by IceSoft
mskuma wrote:I'm not sure if it makes sense to ask this.. are you planning to support unicode with your lib?
Yes.

Re: ICE_SpriteFont library (0.0.4) (Rotating text)

Posted: Sun Dec 17, 2006 2:05 am
by IceSoft
Version: 0.0.4

[ADD] Rotating text in different ways

Please tell me about your FPS. Thanks.

Posted: Sat Jan 06, 2007 1:59 am
by IceSoft
0.0.4

The ICE_SpriteFont lib + a source example for your own tests.

Posted: Sat Jan 06, 2007 9:52 am
by IceSoft
0.0.5

[FIX] ICE_DisplayRotatedFadingSprite3DText((x.l, y.l, angle.l, text.s, fading.w)
TextMix with upper/lower letters was wrong displayed

Posted: Sat Jan 06, 2007 1:43 pm
by IceSoft
Tips&Tricks:
Using only the *3D* Fuction will be perform the speed output

Here the example source only with *3D* SpriteFont functions:

Code: Select all

#Titler = "ICE_SpriteFont Library - DEMO -"

InitSprite()
InitSprite3D()


wX = 800
wY = 600

wHnd = OpenWindow(0, 0, 0, wX, wY, #Titler, #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(wHnd, 0, 0,  wX, wY, 0, 0, 0)
SetFrameRate(99999)

LoadFont(1, "Arial", 10)   ; Font Nr.: 1
LoadFont(2, "Papyrus", 30) ; Font Nr.: 2
LoadFont(3, "Rage", 40)    ; Font Nr.: 3
LoadFont(4, "Script", 40)  ; Font Nr.: 4
LoadFont(5, "Arial", 50)  ; Font Nr.: 5
LoadFont(6, "Arial", 100)  ; Font Nr.: 6 

;###################################
;- Create the SpriteFonts 
;  ICE_CreateSpriteFont(FrontColor.l,BackgroundColor.l,Font Nr.)
;###################################
SpriteFont0 = ICE_CreateSpriteFont($FF, 0, -1)     ; "Arial" Size: 10
SpriteFont1 = ICE_CreateSpriteFont($FF, 0, -1)     ; "Arial" Size: 10
SpriteFont2 = ICE_CreateSpriteFont($FFFFFF, 0, 2) ; Papyrus Size: 30
SpriteFont3 = ICE_CreateSpriteFont($FF, $FFFF, 3) ; Rage Size: 40
SpriteFont4 = ICE_CreateSpriteFont($FF0000, 0, 4) ; Script Size: 40
SpriteFont5 = ICE_CreateSpriteFont($FF0000, 0, 5) ; Arial Size: 50
SpriteFont6 = ICE_CreateSpriteFont($FF0000, 0, 6) ; Arial Size: 100

;###################################
;- Create the SpriteFonts from an image file 
;  ICE_CreateSpriteFontFromImage(<Path of the image file>)
;###################################
SpriteFont7 = ICE_CreateSpriteFontFromImage(".\BitmapFonts\CoolSpot.bmp")
SpriteFont8 = ICE_CreateSpriteFontFromImage(".\BitmapFonts\094.bmp")

;###################################
;- Create the background picture
;###################################
sBox = CreateSprite(#PB_Any,wX,wY)
StartDrawing(SpriteOutput(sBox))
  For n = 1 To wY
  Box(0,n,100,1,$FFFF*n%255)
  Box(100,n,100,1,$FFFF-n)
  Box(200,n,100,1,$FF*n)
  Box(300,n,100,1,n)
  Box(600,n,100,1,$FF00FF*n)
  Next n
  Box(500,0,100,wY,$FF0000)
  Box(400,0,100,wY,$FFFFFF)
StopDrawing()
x = 0
y = 0
xd = 1
yd = 1
id =1
Repeat
  x +xd
  y +yd
  i +id
  ClearScreen($0)
  DisplaySprite(sBox,0,0)
  event =  WindowEvent() 
  Select event
    Case #PB_Event_CloseWindow
      CloseWindow(0)
      End
  EndSelect
 
;   ;###################################
;   ;- Set the actual SpriteFont
;   ;  ICE_DrawingSpriteFont(SpriteFontNr.l)
;   ;###################################
;   ICE_DrawingSpriteFont(SpriteFont1)
;   
;   ;###################################
;   ;- Display a vertical transparent SpriteFont text
;   ;  ICE_DisplayVerticalTransparentSpriteText(x.l, y.l ,text.s)
;   ;###################################
;   ICE_DisplayVerticalTransparentSpriteText(350,x, "ICE_DisplayVerticalTransparentSpriteText")
;  
;   ICE_DrawingSpriteFont(SpriteFont0)
;   ;###################################
;   ;- Display a transparent SpriteFont text
;   ;  ICE_DisplayTransparentSpriteText(x.l, y.l ,text.s)
;   ;###################################
;   ICE_DisplayTransparentSpriteText(10, 10, "FPS: "+ Str(ICE_GetFPS()))
;   
;   
;   s$ = "Position"
;   ICE_DrawingSpriteFont(SpriteFont2)
;   ICE_DisplayTransparentSpriteText(x,70,  "(" + s$ + ") " +Str(x) + ", 70, ")
;  
;   ICE_DrawingSpriteFont(SpriteFont3)
;   ICE_DisplayTransparentSpriteText(x,120, "(C) ICESOFT")
;   
;   ICE_DrawingSpriteFont(SpriteFont4)
;   ICE_DisplayTransparentSpriteText(0, 170, "Test")
;  

  If i >= 255 Or i <= 0
    id *-1
    xxx = Random(wX)
    yyy = Random(wY)
  EndIf
 
  If x > wX Or x < 0
    xd *-1
  EndIf
  If y > wY Or y < 0
    yd *-1
  EndIf

  
  angle+1
  If angle > 359: angle = 0:EndIf
  If Start3D()
    ICE_DrawingSpriteFont(SpriteFont0)
    ICE_DisplayFadingSprite3DText(10, 10, "FPS: "+ Str(ICE_GetFPS()),255)
    
    
    s$ = "Position"
    ICE_DrawingSpriteFont(SpriteFont2)
    ICE_DisplayFadingSprite3DText(x,70,  "(" + s$ + ") " +Str(x) + ", 70, ",255)
   
    ICE_DrawingSpriteFont(SpriteFont3)
    ICE_DisplayFadingSprite3DText(x,120, "(C) ICESOFT",255)
    
    ICE_DrawingSpriteFont(SpriteFont4)
    ICE_DisplayFadingSprite3DText(0, 170, "Test",255)
  
    ICE_DrawingSpriteFont(SpriteFont6)
    ;###################################
    ;- Display a rotated SpriteFont text
    ;  ICE_DisplayFadingSprite3DText(x.l, y.l, text.s, fading)
    ;###################################
    ICE_DisplayFadingSprite3DText(200, 200,"FADING",i)
    ICE_DrawingSpriteFont(SpriteFont8)
    ;###################################
    ;- Display a rotated SpriteFont text
    ;  ICE_DisplayRotatedFadingSprite3DText(x.l, y.l, angle.l, text.s, fading.w)
    ;###################################
    ICE_DisplayRotatedFadingSprite3DText(200, 200, angle, "ROTATE +",i)
    ICE_DisplayRotatedFadingSprite3DText(200, 400,-angle, "ROTATE -",255-i)
     ICE_DisplayRotatedFadingSprite3DText(y, x, angle, "ICESOFT",255)
    ICE_DrawingSpriteFont(SpriteFont5)
    ICE_DisplayFadingSprite3DText(xxx, yyy, "FADING ",255-i)
    
    ICE_DrawingSpriteFont(SpriteFont7)
    ICE_DisplayRotatedFadingSprite3DText(y, x, -angle, "ROTADE FADING",255)
    ICE_DisplayRotatedFadingSprite3DText(x, y, -angle,Str(x),255)
    ICE_DrawingSpriteFont(SpriteFont6)
    ICE_DisplayRotatedFadingSprite3DText(wx/2-100, wy/2, angle, "RotA",255)
     ICE_DisplayRotatedFadingSprite3DText(wx/2-200, wy/2, -angle, "RotA",255)

        
  Stop3D()
  EndIf
  FlipBuffers(0)
  Delay(1)
ForEver 
End

Posted: Tue Mar 06, 2007 8:34 pm
by IceSoft
Version 0.0.6 is uploaded.

[NEW]
Zoom Font

Source Example (The DEMO Source):

Code: Select all

#Titler = "ICE_SpriteFont Library - DEMO -"


Declare Fading()
Declare Rotate()
Declare Zoom()

InitSprite()
InitSprite3D()
InitKeyboard()

UseJPEGImageDecoder()


Global wX = 800
Global wY = 600

wHnd = OpenWindow(0, 0, 0, wX, wY, #Titler, #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(wHnd, 0, 0,  wX, wY, 0, 0, 0)
SetFrameRate(99999)

LoadFont(1, "Small Font", 8)   ; Font Nr.: 1
LoadFont(2, "Papyrus", 30) ; Font Nr.: 2
LoadFont(3, "Rage", 40)    ; Font Nr.: 3
LoadFont(4, "Script", 40)  ; Font Nr.: 4
LoadFont(5, "Arial", 50)  ; Font Nr.: 5
LoadFont(6, "Arial", 100)  ; Font Nr.: 6 

;###################################
;- Create the SpriteFonts 
;  ICE_CreateSpriteFont(FrontColor.l,BackgroundColor.l,Font Nr.)
;###################################
Global SpriteFont0 = ICE_CreateSpriteFont($FF, 0, -1)     ; "Arial" Size: 10
Global SpriteFont1 = ICE_CreateSpriteFont($FF, 0, -1)     ; "Arial" Size: 10
Global SpriteFont2 = ICE_CreateSpriteFont($FFFFFF, 0, 2) ; Papyrus Size: 30
Global SpriteFont3 = ICE_CreateSpriteFont($FFFF, $0, 3) ; Rage Size: 40
Global SpriteFont4 = ICE_CreateSpriteFont($FF0000, 0, 4) ; Script Size: 40
Global SpriteFont5 = ICE_CreateSpriteFont($FF0000, 0, 5) ; Arial Size: 50
Global SpriteFont6 = ICE_CreateSpriteFont($FF0000, 0, 6) ; Arial Size: 100

;###################################
;- Create the SpriteFonts from an image file 
;  ICE_CreateSpriteFontFromImage(<Path of the image file>)
;###################################
Global SpriteFont7 = ICE_CreateSpriteFontFromImage(".\BitmapFonts\CoolSpot.bmp")
Global SpriteFont8 = ICE_CreateSpriteFontFromImage(".\BitmapFonts\094.bmp")
Global SpriteFont9 = ICE_CreateSpriteFontFromImage(".\BitmapFonts\alpha.bmp")
;###################################
;- Create the background picture
;###################################
iImage = LoadImage(#PB_Any, "C:\Dokumente und Einstellungen\All Users\Dokumente\Eigene Bilder\Beispielbilder\Sonnenuntergang.jpg")
sBox = CreateSprite(#PB_Any,wX,wY)
StartDrawing(SpriteOutput(sBox))
  If iImage
    DrawImage(ImageID(iImage),0,0,wx,wy)
  Else
    For n = 1 To wY
    Box(0,n,100,1,$FFFF*n%255)
    Box(100,n,100,1,$FFFF-n)
    Box(200,n,100,1,$FF*n)
    Box(300,n,100,1,n)
    Box(600,n,100,1,$FF00FF*n)
    Next n
    Box(500,0,100,wY,$FF0000)
    Box(400,0,100,wY,$FFFFFF)
  EndIf
StopDrawing()
x = 0
y = 0
xd = 1
yd = 1
ad=1
id =1
Global  angle

Global Dim pos.Point (100)
For n= 0 To 100 
  pos(n)\x = Random(wx)
  pos(n)\y = Random(wy)
Next n


Repeat
  ExamineKeyboard()

  If KeyboardReleased(#PB_Key_F1)
    key = 1 
  ElseIf KeyboardReleased(#PB_Key_F2)
    key = 2
  ElseIf KeyboardReleased(#PB_Key_F3)
    key = 3
  ElseIf KeyboardReleased(#PB_Key_F4)
    key = 4
  ElseIf KeyboardReleased(#PB_Key_F5)
    key = 5
  ElseIf KeyboardReleased(#PB_Key_F6)
    key = 6
  EndIf
  x +xd 
  y +yd
  i +id
  ;ClearScreen($0)
  DisplaySprite(sBox,0,0)
  event =  WindowEvent() 
  Select event
    Case #PB_Event_CloseWindow
      CloseWindow(0)
      End
  EndSelect
  

  If i >= 255 Or i <= 0
    id *-1
    xxx = Random(wX)
    yyy = Random(wY)
  EndIf
 
  If x > wX Or x < 0
    xd *-1
  EndIf
  If y > wY Or y < 0
    yd *-1
  EndIf

  
  angle +ad
  If angle > 359 Or angle < 1
    ad *-1
    w = Random(180)-90
  EndIf

  If Start3D()
    ICE_DrawingSpriteFont(SpriteFont7)
    ICE_DisplayFadingSprite3DText(10, 10, "FPS: "+ Str(ICE_GetFPS()),255)
    
    ICE_DrawingSpriteFont(SpriteFont2)
    ICE_DisplayFadingSprite3DText(120+ x/10, 10, "ICE_SpriteFont3D Library",255)
    ICE_DisplayFadingSprite3DText(160+ x/5, 70, "(C) 2007 by ICEsoft",255)
    
    ICE_DrawingSpriteFont(SpriteFont1)
    ICE_DisplayFadingSprite3DText(10, 30,  "[F1] Zoom demo", 255)
    ICE_DisplayFadingSprite3DText(10, 50,  "[F2] Rotate demo", 255)
    ICE_DisplayFadingSprite3DText(10, 70,  "[F3] Fading demo", 255)
;     ICE_DisplayFadingSprite3DText(10, 90,  "[F4] Shadow demo", 255)
;     ICE_DisplayFadingSprite3DText(10, 110, "[F5] FullControl demo", 255)
    ICE_DisplayFadingSprite3DText(10, 130, "[F6] All together", 255)

    Select key    
      Case 1
        Zoom()
      Case 2
        Rotate()
      Case 3
        Fading()  
      Case 4
      
      Case 5
      
      Case 6
        Zoom()
        Rotate()
        Fading()  
    EndSelect

  Stop3D()
  EndIf
  FlipBuffers(0)
  Delay(1)
ForEver 
End

Procedure Fading()
  Static lFading = 0
  Static zD = 1
  lFading + zD
  If lFading > 255 Or lFading < 1
    zD *-1
  EndIf

  ICE_DrawingSpriteFont(SpriteFont3)
  ICE_DisplayFadingSprite3DText(20, 200, "Fading example:", lFading )
  For n= 0 To 30 
    Select n % 5
      Case 0
        ICE_DisplayFadingSprite3DText(pos(n)\x, pos(n)\y, "1234",lFading)
      Case 1
        ICE_DisplayFadingSprite3DText(pos(n)\x, pos(n)\y, "ausblenden", 255-lFading)
      Case 2
        ICE_DrawingSpriteFont(SpriteFont2)
        ICE_DisplayFadingSprite3DText(pos(n)\x, pos(n)\y, "ICEsoft", lFading)
      Case 3
        ICE_DrawingSpriteFont(SpriteFont3)
        ICE_DisplayFadingSprite3DText(pos(n)\x, pos(n)\y, "ICEsoft", 255-lFading)
      Case 4
        ICE_DrawingSpriteFont(SpriteFont5)
        ICE_DisplayFadingSprite3DText(pos(n)\x, pos(n)\y, "ICE_Sprite3D", lFading)
      Case 5
        ICE_DrawingSpriteFont(SpriteFont6)
        ICE_DisplayFadingSprite3DText(pos(n)\x, pos(n)\y, "FADING", 255-lFading)
    EndSelect
  Next n
EndProcedure

Procedure Rotate()
  Static lRotate = 0
  Static zD = 1

  lRotate + zD
  If lRotate > 360 
   lRotate = 0
  ElseIf lRotate < 0 
   lRotate = 360
  EndIf

  ICE_DrawingSpriteFont(SpriteFont3)
  ICE_DisplayRotatedFadingSprite3DText(wx/2, wy/2, lRotate, "Rotate example:", 255 )

  ICE_DrawingSpriteFont(SpriteFont7)
  For n= 0 To 30 
    Select n % 5
      Case 0
        ICE_DisplayRotatedFadingSprite3DText(pos(n)\x, pos(n)\y, lRotate, "1234", 255)
      Case 1
        ICE_DisplayRotatedFadingSprite3DText(pos(n)\x, pos(n)\y, 360-lRotate, "Drehen", 255)
      Case 2
        ICE_DrawingSpriteFont(SpriteFont2)
        ICE_DisplayRotatedFadingSprite3DText(pos(n)\x, pos(n)\y, lRotate, "ICEsoft", 255)
      Case 3
        ICE_DrawingSpriteFont(SpriteFont3)
        ICE_DisplayRotatedFadingSprite3DText(pos(n)\x, pos(n)\y, 360-lRotate, "ICEsoft", 255)
      Case 4
        ICE_DrawingSpriteFont(SpriteFont5)
        ICE_DisplayRotatedFadingSprite3DText(pos(n)\x, pos(n)\y, lRotate, "ICE_Sprite3D", 255)
      Case 5
        ICE_DrawingSpriteFont(SpriteFont6)
        ICE_DisplayRotatedFadingSprite3DText(pos(n)\x, pos(n)\y, 360-lRotate, "ROTATE", 255)
    EndSelect
  Next n
EndProcedure

Procedure Zoom()
  Static lZoom = 0
  Static zD = 1

  lZoom + zD
  If lZoom > 500 Or lZoom < 1
    zD *-1
  EndIf
  ICE_ZoomSprite3DText(1, lZoom, lZoom)
  ICE_DrawingSpriteFont(SpriteFont3)
  ICE_DisplayFadingSprite3DText(wx/2 - ICE_GetSpriteStringWidth("Zoom")/2, 100, "Zoom",255)
  ICE_DrawingSpriteFont(SpriteFont2)
  ICE_DisplayFadingSprite3DText(wx/2 - ICE_GetSpriteStringWidth("EXAMPLE")/2, 200, "EXAMPLE",255)
  ICE_ZoomSprite3DText(0, -1, -1) 
  ICE_ZoomSprite3DText(1, lZoom, lZoom)
  ICE_DrawingSpriteFont(SpriteFont7)
  ICE_DisplayFadingSprite3DText(wx/2 - ICE_GetSpriteStringWidth("ZOOM")/2, 310, "ZOOM",255)
  ICE_ZoomSprite3DText(0, -1, -1) 
EndProcedure