@Fred
With your Code (the DrawingEx functions) i have a smal prob.
All the drawing functions from PB works but not the DrawText() function.
The x and y param in the function DrawText() don´t work with the EX functions.
Example:
Code: Select all
Structure PB_2DDrawingInfo
*hDC
; There is more stuff here, but we try to keep this private
EndStructure
Import "kernel32.lib" ; It's not in the kernel32.lib, but it's the one always linked :)
PB_2DDrawing_GlobalStructure.PB_2DDrawingInfo ; For non-threaded
PB_2DDrawing_Globals ; For threadedsafe mode
PB_Object_GetThreadMemory(*Globals)
EndImport
Procedure StartDrawingEx(hWindow)
CompilerIf #PB_Compiler_Thread
*Globals.PB_2DDrawingInfo = PB_Object_GetThreadMemory(PB_2DDrawing_Globals)
*Globals\hdc = GetDC_(hWindow)
CompilerElse
PB_2DDrawing_GlobalStructure\hdc = GetDC_(hWindow)
CompilerEndIf
ProcedureReturn 1
EndProcedure
Procedure StopDrawingEx(hWindow)
CompilerIf #PB_Compiler_Thread
*Globals.PB_2DDrawingInfo = PB_Object_GetThreadMemory(PB_2DDrawing_Globals)
ReleaseDC_(hWindow, *Globals\hdc)
CompilerElse
ReleaseDC_(hWindow, PB_2DDrawing_GlobalStructure\hdc)
CompilerEndIf
EndProcedure
If OpenWindow(0, 100, 200, 300, 200, "2D Drawing Test")
If StartDrawingEx(WindowID(0))
Circle(100,100,50,RGB(0,0,255))
Box(150,20,20,20, RGB(0,255,0))
FrontColor(RGB(255,0,0))
For k=0 To 20
LineXY(10,10+k*8,200, 0)
Next
DrawingMode(1)
BackColor(RGB(0,155,155))
FrontColor(RGB(255,255,255))
;here is the prob with DrawText(), the x and y cord´s dont work
DrawText(20,150,"Hello, this is a test")
StopDrawingEx(WindowID(0))
EndIf
Repeat
EventID = WaitWindowEvent()
Until EventID = #PB_Event_CloseWindow
EndIf
End