Desktop Spielerei
Übersicht

![]() |
Suco-XBetreff: Desktop Spielerei |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hi
Eine kleine Spielerei von mir, nichts besonderes. Dauert ein wenig beim Laden da der Desktop Screenshot etwas dauert. Keine Ahnung ob das auch mit der Demo Läuft. Code: [AUSKLAPPEN] Strict Framework brl.glmax2d Import brl.max2d Import brl.basic Const BITSPIXEL = 12 Const VREFRESH = 116 Const SCRCCOPY = $00CC0020 Const SM_CXSCREEN = 0 Const SM_CYSCREEN = 1 Extern "Win32" Function GetDC(Hwnd:Int) Function GetPixel(hdc:Int,x:Int,y:Int) Function GetSystemMetrics(Temp:Int) Function GetDeviceCaps(hdc:Int, Flag:Int) End Extern Local DesktopWidth = GetSystemMetrics(SM_CXSCREEN) Local DesktopHeight = GetSystemMetrics(SM_CYSCREEN) Local DesktopDC = GetDC(0) Local DesktopBits = GetDeviceCaps(DesktopDC,BITSPIXEL) Local DesktopHz = GetDeviceCaps(DesktopDC,VREFRESH) Local DesktopPixmap:TPixmap = CreatePixmap(DesktopWidth,DesktopHeight,PF_BGRA8888) For Local x:Int = 0 Until DesktopPixmap.Width For Local y:Int = 0 Until DesktopPixmap.Height Local Col:Int = GetPixel(DesktopDC,x,y) Local PixelPtr:Byte Ptr = DesktopPixmap.PixelPtr(x,y) PixelPtr[0] = GetR(col) PixelPtr[1] = GetG(col) PixelPtr[2] = GetB(col) PixelPtr[3] = 255 Next Next TRect.ObjectList = New TList Type TRect Global ObjectList:TList Field ListLink:TLink Field x:Float, y:Float Field Width:Int, Height:Int Field Alpha:Float=1.0, Angle:Float Field Timer Field r:Byte,g:Byte, b:Byte Method New() self.ListLink = self.ObjectList.AddFirst(Self) End Method Method Remove() self.ListLink.Remove() End Method Function GetInstance:TRect(x:Float,y:Float,Width:Int,Height:Int,Angle:Float,r:Byte,g:Byte,b:Byte) Local TempObject:TRect = New TRect TempObject.x = x TempObject.y = y TempObject.Width = Width TempObject.Height = Height TempObject.Angle = Angle TempObject.r = r TempObject.g = g tempObject.b = b Return TempObject End Function Function Idle() For Local TempObject:TRect = EachIn self.ObjectList TempObject.Update() TempObject.Draw() Next End Function Method Update() If MilliSecs()-self.Timer>10 self.Alpha:-0.04 self.Timer = MilliSecs() EndIf If self.Alpha<0.0 self.Remove() EndIf End Method Method Draw() SetBlend ALPHABLEND SetColor self.r,self.g,self.b SetAlpha self.alpha SetRotation self.Angle SetOrigin self.x,self.y SetHandle self.Width/2,self.Height/2 DrawRect 0,0,self.Width,self.Height End Method End Type Function GetGameSpeed:Float(Hz:Int) Global _LoopTime:Int Local Speed:Float speed = MilliSecs()-_LoopTime speed = (Speed/1000.0)*Hz _LoopTime = MilliSecs() Return Speed End Function Function ScreenPan(OffsetX:Float, OffsetY:Float) Local Width,Height,Depth,Hz GetGraphics Width,Height,Depth,Hz glMatrixMode GL_PROJECTION glLoadIdentity glOrtho 0,Width,Height,0,-1,1 glTranslatef OffsetX, OffsetY,0 glMatrixMode GL_MODELVIEW EndFunction Function GetB:Byte(Color:Int) Return Color & $FF End Function Function GetG:Byte(Color:Int) Return (Color & $FF00)/$100 End Function Function GetR:Byte(Color:Int) Return (Color & $FF0000)/$10000 End Function If DesktopHz = 0 DesktopHz = 60 EndIf If DesktopBits = 0 DesktopBits = 32 EndIf Graphics DesktopWidth,DesktopHeight,DesktopBits,DesktopHz Local DesktopImage:TImage = TIMage.Load(DesktopPixmap,0,0,0,DYNAMICIMAGE|MASKEDIMAGE) Local Angle:Float = 0.0, Time:Int Local Steper:Float = 0.0 Global GameSpeed:Float = 0.0 Repeat Cls GameSpeed = GetGameSpeed(DesktopHz) Angle:+(GameSpeed*4.0) Angle = Angle Mod 360 steper:+0.5 SetBlend MASKBLEND SetRotation 0.0 SetOrigin 0,0 SetColor 255,255,255 SetAlpha 1.0 DrawImage DesktopImage,0,0 If MilliSecs()-Time>2 TRect.GetInstance(GraphicsWidth()/2,GraphicsHeight()/2,GraphicsWidth()+300,30,Angle,255,155,128+Sin(Steper)*127) Time = MilliSecs() EndIf TRect.Idle() ScreenPan(Rnd(-1,1),Rnd(-1,1)) Flip FlushMem() Until KeyHit(KEY_ESCAPE) Mfg Suco |
||
Intel Core 2 Quad Q8300, 4× 2500 MHz, 4096 MB DDR2-Ram, GeForce 9600GT 512 MB |
![]() |
DA |
![]() Antworten mit Zitat ![]() |
---|---|---|
Moin,
mhm. Sieht schonmal richtig gut aus. Weiter so ![]() PS: Mit der Demo gehts bei mir. Thx DarkAngel |
||
Deutscher Blitz Basic Chat |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group