Version 0.0.6 is uploaded.
Code: Alles auswählen
#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