Programm wird lahm
Verfasst: 02.03.2012 11:43
Hallo Leute !
Das Programm wird richtig lahm und ich weis nicht woran es liegt.
Habe mal etwas Code zusammen gebastelt, damit ihr seht was ich
meine.
Das Programm wird richtig lahm und ich weis nicht woran es liegt.
Habe mal etwas Code zusammen gebastelt, damit ihr seht was ich
meine.
Code: Alles auswählen
EnableExplicit
;**************************************************************************************************************************
; Konstanten declarieren
;**************************************************************************************************************************
#ScreenWidth = 1024
#ScreenHeigth = 768
If InitSprite() = 0 Or InitKeyboard() = 0 Or InitSprite3D() = 0 Or InitSound() = 0 Or InitMouse() = 0
MessageRequester( "Error", "Can't open DirectX 7 or later", 0 )
End
EndIf
If OpenScreen( #ScreenWidth, #ScreenHeigth, 32, "Test3D", 0 ) = 0
MessageRequester( "Error", "Can't open Screen", 0 )
End
EndIf
Define Font1.l
Define Pure.l
Define i.l
Define r.l
Define Sprite1.l
Font1 = LoadFont( #PB_Any , "Arial", 120, #PB_Font_Bold )
ClearScreen( RGB( 1, 1, 1 ) )
StartDrawing( ScreenOutput() )
DrawingFont( FontID( Font1 ) )
DrawingMode( #PB_2DDrawing_Transparent )
DrawText( 3, 3, "PURE BASIC", RGB( 0,0,0 ) )
DrawingMode( #PB_2DDrawing_Outlined )
Box( 0, 0, 1024, 200, RGB( 255, 0, 0 ) )
StopDrawing()
Pure = GrabSprite( #PB_Any, 0, 0, 1024, 200, #PB_Sprite_Texture )
Pure = CreateSprite3D( #PB_Any, Pure )
Define i.l
Define Col.l
Define Sprite1.l
Repeat
ClearScreen( RGB( 1, 1, 1 ) )
StartDrawing( ScreenOutput() )
For i = 0 To 14
Box( 0, 230 + i * 21, 1024, 20, RGB( Random( 50 ) + 200, Random( 50 ) + 200, Random( 50 ) + 200 ) )
Next
StopDrawing()
Start3D()
Sprite3DQuality( 1 )
ZoomSprite3D( Pure, 1024, 500 )
DisplaySprite3D( Pure, 0, 150, 255 )
Stop3D()
If IsSprite( Sprite1 ): FreeSprite( Sprite1 ): EndIf
If IsSprite3D( Sprite1 ): FreeSprite3D( Sprite1 ): EndIf
Sprite1 = GrabSprite( #PB_Any, 0, 150, 1024, 500, #PB_Sprite_Texture )
Sprite1 = CreateSprite3D( #PB_Any, Sprite1 )
Start3D()
Sprite3DQuality( 1 )
ZoomSprite3D( Sprite1, 150, 50 )
RotateSprite3D( Sprite1, r, 0 )
DisplaySprite3D( Sprite1, 400, 100, 255 )
r + 1
If r = 360: r = 0:EndIf
Stop3D()
FlipBuffers()
ExamineKeyboard()
Until KeyboardPushed( #PB_Key_Escape )
End