@Fred, Please publish some PB structures...
Posted: Wed Oct 01, 2008 7:13 am
... it will help to write additional features (which are currently missed) for PB.
And I belive it will help also to make PureBasic as the first choice of a basic language once more.
Like this one: Thanks S.M. for that.
And I belive it will help also to make PureBasic as the first choice of a basic language once more.
Like this one: Thanks S.M. for that.
S.M. wrote:This code should return the current DC:A few other variables:Code: Select all
Procedure DrawingDC() !extrn _PB_2DDrawing_GlobalStructure !MOV EAX,[_PB_2DDrawing_GlobalStructure] ProcedureReturn Endprocedure
Code: Select all
----------------------------------------------------------------------- 2DDrawing --------- _PB_2DDrawing_GlobalStructure _PB_2DDrawing_Globals ; internal functions _PB_2DDrawing_SwitchToDC@0 _PB_2DDrawing_SwitchToDC_THREAD@0 Structure DrawingInfoStruct Type.l ; Type of the DC Window.l ; Window associated to the DC (if any) DC.l ; DC (Display Device Context) ReleaseProcedure.l ; Address to a procedure to release the DC when StopDrawing() is called PixelBuffer.l ; Address of the memory pixel buffer (DirectX) Pitch.l ; Bytes per line (DirectX) Width.l Height.l Depth.l EndStructure ----------------------------------------------------------------------- SimpleList ---------- _PB_FreeSimpleLists@0 _PB_InitSimpleList@0 _PB_SimpleList_Add _PB_SimpleList_AddAfter _PB_SimpleList_Count _PB_SimpleList_Heap _PB_SimpleList_IsID _PB_SimpleList_Remove ----------------------------------------------------------------------- Image ----- _PB_Image_Globals _PB_Image_Objects Structure PB_Image Bitmap.l ; OS Bitmap pointer (HBITMAP) Width.w ; Width in pixel of the image Height.w ; Height in pixel of the image Depth.w ; Depth in bpp of the image ColorArray.l ; Memory pointer on a color array for 256 colors pictures unknown.w EndStructure ----------------------------------------------------------------------- Object ------ ; functions: _PB_Object_Init@12 _PB_Object_FreeID@8 _PB_Object_EnumerateStart@4 _PB_Object_EnumerateNext@8 _PB_Object_IsObject@8 _PB_Object_GetObject@8 _PB_Object_GetOrAllocateID@8 ; returns a pointer to an entry (the ObjectsArea is extended, if needed) _PB_Object_InitThreadMemory@12 _PB_Object_GetThreadMemory@4 ; Each object has the following structure: Structure PB_Object Size.l ; Size of one entry in the ObjectsArea (in Bytes) StepSize.l ; The number of enties which are allocated at once NumEntries.l ; Current number of Entires Unknown.l[4] ObjectsArea.l ; pointer to the first entry Unknown2.l[2] EndStructure ; Example for allocating space for a Image: Procedure IMAGE_GetOrAllocImageSpace(Image) !extrn _PB_Image_Objects !extrn _PB_Object_GetOrAllocateID@8 !Push dword[Esp+4] !Push dword[_PB_Image_Objects] !CALL _PB_Object_GetOrAllocateID@8 ProcedureReturn EndProcedure ----------------------------------------------------------------------- Sprite ------ _PB_Screen_Width ; width of the current buffer selected with UseBuffer() _PB_Screen_Height ; height of the current buffer selected with UseBuffer() _PB_Screen_Depth ; depth (in bpp) of the current buffer selected with UseBuffer() _PB_Screen_RealWidth ; width of the back buffer _PB_Screen_RealHeight ; height of the back buffer _PB_Screen_Window ; ScreenID() (HWND) _PB_Screen_Windowed _PB_Screen_IsActive _PB_Screen_WindowedYOffset _PB_Screen_WindowedXOffset _PB_Screen_AutoStretch _PB_Screen_WindowedRightBorder _PB_Screen_WindowedBottomBorder _PB_Screen_ModesArray ; pointer to an array of PB_ScreenMode elements _PB_Screen_FlipBuffers _PB_DirectX_CurrentDC _PB_DirectX_FullScreenWindow ; ScreenID() when full screen is used (HWND) _PB_DirectX_PixelFormat ; Pixel format (see DrawingBufferPixelFormat() ) of the current buffer selected with UseBuffer() _PB_DirectX_PrimaryBuffer ; Directdraw visible buffer (IDirectDrawSurface7) _PB_DirectX_BackBuffer ; Directdraw back buffer (IDirectDrawSurface7) _PB_DirectX_FrameRate ; Frame rate set with SetFrameRate(FrameRate) _PB_DirectX_RefreshRate ; Refresh rate set with SetRefreshRate(RefreshRate) _PB_DirectX_WindowedFrameRate _PB_DirectX_WindowClipper ; IDirectDrawClipper for windowed screen _PB_DirectX_ActualRefreshRate _PB_DirectX_PreciseTimerDelta _PB_DirectX_PreciseTimerOldValue _PB_DirectX_SaveAllSpritesSurfaces _PB_Sprite_Objects _PB_Sprite_CheckFXBuffer _PB_Sprite_ColorKey _PB_Sprite_CurrentDC _PB_Sprite_BufferDC _PB_Sprite_SpecialEffectMode _PB_Sprite_AlphaBlueModifier _PB_Sprite_AlphaGreenModifier _PB_Sprite_AlphaRedModifier _PB_Sprite_TranslucentLUT _PB_Sprite_FillDrawingInfo _PB_Sprite_SpriteInfo _PB_Sprite_CurrentBitmapInfo _PB_Sprite_FXBufferInfo ; the pointer to a DDSURFACEDESC2 structure _PB_Sprite_SpriteFX _PB_Sprite_CurrentBitmap ; DirectDrawSurface7 pointer of the current buffer (set with UseBuffer()) _PB_Sprite_FXBuffer ; DirectDrawSurface7 pointer which is used with StartSpecialFX()...StopSpecialFX() _PB_Sprite_LimitFrameRate _PB_Sprite_DEBUG_GetSurfaceData _PB_Screen_V_Quit _PB_Screen_V_FlipWindowedBuffers _PB_Screen_V_FlipBuffers _PB_Screen_V_GetDirectDraw7 _PB_Screen_V_GetBackBuffer _PB_Screen_V_OpenScreen3D ; Internal functions _PB_Sprite_GetTrueRGBColor@12 _PB_Sprite_InitDirectXScreen@0 _PB_Sprite_CreateEmptySprite@20 _PB_Sprite_CleanUpAll@0 _PB_Sprite_SaveAllSpritesSurfaces@0 _PB_Sprite_RestoreAllSpritesSurfaces@0 _PB_Sprite_ReleaseScreenOutput@0 _PB_Sprite_SetPixelFormat@0 Structure PB_Sprite Sprite.IDirectDrawSurface7 ; DirectDrawSurface7 pointer Width.w ; Current width of the sprite (could change if ClipSprite() is used) Height.w ; Current height of the sprite (could change if ClipSprite() is used) Depth.w ; depth of the file. (in bits) Mode.w ; Sprite mode, as described in LoadSprite() FileName.l ; Pointer on the filename, if any RealWidth.w ; Original width of the sprite when it was loaded RealHeight.w ; Original height of the sprite when it was loaded ClipX.w ; X offset if ClipSprite() ClipY.w ; Y offset if ClipSprite() EndStructure Structure PB_ScreenMode ScreenModeWidth.w ; Width of the Screen (in pixel) ScreenModeHeight.w ; Height of the Screen (in pixel) ScreenModeDepth.w ; Depth of the Screen (in bits per pixel) ScreenModeRefreshRate.w ; Refresh rate of the Screen (in Hz) EndStructure ; DirectDraw7 Structures: Structure DDPIXELFORMAT dwSize.l dwFlags.l dwFourCC.l dwRGBBitCount.l dwRBitMask.l dwGBitMask.l dwBBitMask.l dwRGBAlphaBitMask.l EndStructure Structure DDCOLORKEY dwColorSpaceLowValue.l dwColorSpaceHighValue.l EndStructure Structure DDSCAPS2 dwCaps.l dwCaps2.l dwCaps3.l dwCaps4.l EndStructure Structure DDSURFACEDESC2 dwSize.l dwFlags.l dwHeight.l dwWidth.l lPitch.l dwBackBufferCount.l dwRefreshRate.l dwAlphaBitDepth.l dwReserved.l lpSurface.l ddckCKDestOverlay.DDCOLORKEY ddckCKDestBlt.DDCOLORKEY ddckCKSrcOverlay.DDCOLORKEY ddckCKSrcBlt.DDCOLORKEY ddpfPixelFormat.DDPIXELFORMAT ddsCaps.DDSCAPS2 dwTextureStage.l EndStructure ----------------------------------------------------------------------- Sprite3D -------- _PB_D3DBase ; IDirect3D7 _PB_Direct3D_Device ; IDirect3DDevice7 _PB_Direct3D_Start3DState ; contains 1 if Start3D() was successfully called (Start3D() creates the D3DDevice7) _PB_3DViewPort ; points to a D3DVIEWPORT7 structure _PB_Sprite3D_Quality ; the value set by Sprite3DQuality(Quality) _PB_Sprite3D_Objects Structure PB_Sprite3D Texture.IDirectDrawSurface7 ; DirectDrawSurface7 Vertice.D3DTLVERTEX[4] ; The 4 vertices for the rectangle sprite Width.w ; width set with ZoomSprite3D() Height.w ; height set with ZoomSprite3D() unknown.l EndStructure ; Direct3D7 structures: Structure D3DTLVERTEX sx.f ; X value of the vertex (in pixels) sy.f ; Y value of the vertex (in pixels) sz.f rhw.f ; reciprocal of homogeneous w color.l ; diffuse color specular.l ; specular color tu.f ; horizontal texture coordinate of the vertex tv.f ; vertical texture coordinate of the vertex EndStructure Structure D3DVIEWPORT7 dwX.l dwY.l dwWidth.l dwHeight.l dvMinZ.f dvMaxZ.f EndStructure ----------------------------------------------------------------------- Sprite OpenGL Subsystem ----------------------- _PB_Sprite_ObjectsNumber ; number of entries in _PB_Sprite_ObjectsArea _PB_Sprite_ObjectsArea ; pointer to an array of PB_Sprite elements _PB_Screen_RealWidth ; width of the back buffer _PB_Screen_RealHeight ; height of the back buffer _PB_Screen_Window ; ScreenID() (HWND) _PB_Screen_Windowed _PB_Screen_Target _PB_Screen_IsActive _PB_Screen_WindowedYOffset _PB_Screen_WindowedXOffset _PB_Screen_AutoStretch _PB_Screen_WindowedRightBorder _PB_Screen_WindowedBottomBorder _PB_DirectX_SaveAllSpritesSurfaces ; ? _PB_Sprite_ColorKey _PB_Sprite_SpecialEffectMode ; Internal functions _PB_Sprite_EnumerateAll _PB_Sprite_FreeID _PB_Sprite_GetObject _PB_Sprite_GetOrAllocateID _PB_Sprite_ListFirstElement _PB_Sprite_CreateEmptySprite@20 _PB_Sprite_CleanUpAll@0 _PB_Sprite_SetPixelFormat@0 Structure PB_Sprite Texture.l ; SpriteID Width.w ; Current width of the sprite (could change if ClipSprite() is used) Height.w ; Current height of the sprite (could change if ClipSprite() is used) Depth.w ; depth of the file. (in bits) Mode.w ; Sprite mode, as described in LoadSprite() FileName.l ; Pointer on the filename, if any RealWidth.w ; Original width of the sprite when it was loaded RealHeight.w ; Original height of the sprite when it was loaded ClipX.w ; X offset if ClipSprite() ClipY.w ; Y offset if ClipSprite() EndStructure ----------------------------------------------------------------------- Sprite3D OpenGL Subsytem ------------------------ _PB_Direct3D_Device ; contains everytime zero _PB_Sprite3D_Quality ; the value set by Sprite3DQuality(Quality) _PB_Sprite3D_ObjectsNumber ; number of entries in _PB_Sprite3D_ObjectsArea _PB_Sprite3D_ObjectsArea ; pointer to an array of PB_Sprite3D elements _PB_Sprite3D_CurrentDC ; internal functions: _PB_Sprite3D_FreeID _PB_Sprite3D_GetObject _PB_Sprite3D_GetOrAllocateID _PB_Sprite3D_CurrentObject _PB_Sprite3D_ListFirstElement Structure GLVERTEX2D X.f ; X value of the vertex (in pixels) Y.f ; Y value of the vertex (in pixels) EndStructure Structure PB_Sprite3D Texture.l ; SpriteID ( the same as PeekL(IsSprite3D(#Sprite)) ) Vertice.GLVERTEX2D[4] ; The 4 vertices for the rectangle sprite Width.w ; width set with ZoomSprite3D() Height.w ; height set with ZoomSprite3D() Unknown.l EndStructure