Hi,
nach DCs Post hab ich mir gedacht, ich schreib mal ne Lib.
Ich denke Beispiel könnt ihr euch selbst ganz leicht schreiben
BlitzBasic: [AUSKLAPPEN] [EINKLAPPEN]
Function s_InitGraphics(width, height, bpp, windowed) Local camera Graphics3D width, height, bpp, windowed SetBuffer BackBuffer() SeedRnd MilliSecs() camera = CreateCamera() CameraRange camera, 1, width*2 CameraClsMode camera, 0, 1 MoveEntity camera, 0, 0, -width Return camera End Function
Function s_LoadImage(pfad$) Local tmpimg, width, height, bank, sprite bank = CreateBank(24) tmpimg = LoadImage(pfad$) sprite = LoadSprite(pfad$) width = ImageWidth(tmpimg) height = ImageHeight(tmpimg) PokeInt bank, 0, sprite PokeInt bank, 4, 0 PokeInt bank, 8, 0 PokeInt bank, 12, width PokeInt bank, 16, height PokeInt bank, 20, 0 FreeImage tmpimg SpriteViewMode sprite, 2 ScaleSprite sprite, width, height PositionEntity sprite, -GraphicsWidth()+width, GraphicsHeight()-height, 0 Return bank End Function
Function s_ScaleImage(img, xs#, ys#) Local sprite, width, height, x, y sprite = PeekInt(img, 0) x = PeekInt(img, 4) y = PeekInt(img, 8) width = PeekInt(img, 12) height = PeekInt(img, 16) width = width*xs# height = height*ys# ScaleSprite sprite, width, height PositionEntity sprite, x*2-GraphicsWidth()+width, -y*2+GraphicsHeight()-height, 0 PokeInt img, 12, width PokeInt img, 16, height End Function
Function s_ResizeImage(img, width, height) Local sprite, x, y sprite = PeekInt(img, 0) x = PeekInt(img, 4) y = PeekInt(img, 8) ScaleSprite sprite, width, height PositionEntity sprite, x*2-GraphicsWidth()+width, -y*2+GraphicsHeight()-height, 0 PokeInt img, 12, width PokeInt img, 16, height End Function
Function s_TurnImage(img, rot) Local sprite, rotation sprite = PeekInt(img, 0) rotation = PeekInt(img, 20) rotation = (360+rotation+rot) Mod 360 RotateSprite sprite, rotation PokeInt img, 20, rotation End Function
Function s_RotateImage(img, rotation) Local sprite sprite = PeekInt(img, 0) rotation = rotation Mod 360 RotateSprite sprite, rotation PokeInt img, 20, rotation End Function
Function s_PositionImage(img, x, y) Local sprite, width, height sprite = PeekInt(img, 0) width = PeekInt(img, 12) height = PeekInt(img, 16) PositionEntity sprite, x*2-GraphicsWidth()+width, -y*2+GraphicsHeight()-height, 0 PokeInt img, 4, x PokeInt img, 8, y End Function
Function s_MoveImage(img, move) Local sprite, x, y, width, height, rotation sprite = PeekInt(img, 0) x = PeekInt(img, 4) y = PeekInt(img, 8) width = PeekInt(img, 12) height = PeekInt(img, 16) rotation = PeekInt(img, 20) x = x+Cos(rotation)*move y = y+Sin(rotation)*move PositionEntity sprite, x*2-GraphicsWidth()+width, -y*2+GraphicsHeight()-height, 0 PokeInt img, 4, x PokeInt img, 8, y End Function
Function s_FreeImage(img) Local sprite sprite = PeekInt(img, 0) FreeEntity sprite FreeBank img Return 0 End Function
Function s_EndGraphics(cam) FreeEntity cam SetBuffer FrontBuffer() SeedRnd 1 EndGraphics End Function
Function s_GetImageHandle(img) Return PeekInt(img, 0) End Function
Function s_AlphaImage(img, alpha#) EntityAlpha PeekInt(img, 0), alpha# End Function
Function s_ColorImage(img, r, g, b) EntityColor PeekInt(img, 0), r, g, b End Function
Function s_ZOrder(img, z) EntityOrder PeekInt(img, 0), z End Function
Function s_ImageParent(img, parent, glob=1) EntityParent PeekInt(img, 0), parent, glob End Function
Function s_ShowImage(img) ShowEntity PeekInt(img, 0) End Function
Function s_HideImage(img) HideEntity PeekInt(img, 0) End Function
Mfg Xenon
|