how to use a directx function ?

Windows specific forum
Mesa
Enthusiast
Enthusiast
Posts: 345
Joined: Fri Feb 24, 2012 10:19 am

how to use a directx function ?

Post by Mesa »

Is there a trick to use a simple directx function, like fillpolygon(), easily ?

This code doesn't work.

Code: Select all

ImportC ""
  fillpolygon(*brush, *allpoints, fillmode)
EndImport

InitSprite()


flag = #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget
If OpenWindow(0,0,0,600,400, "fillpolygon", Flag)
  
  If OpenWindowedScreen(WindowID(0), 0,0,600,400)
  EndIf
  
  brush=LoadSprite(0,#PB_Compiler_Home +"Examples/Sources/Data/PureBasicLogo.bmp")
  Dim Pt.POINT(7)
  pt(1)\x = 50
  pt(1)\y = 50
  pt(2)\x = 100
  pt(2)\y = 25
  pt(3)\x = 200
  pt(3)\y = 5
  pt(4)\x = 250
  pt(4)\y = 50
  pt(5)\x = 300
  pt(5)\y = 100
  pt(6)\x = 350
  pt(6)\y = 200
  pt(7)\x = 250
  pt(7)\y = 250
  
  Repeat
    
    Repeat
      EventID     = WindowEvent()
      If EventID= #PB_Event_CloseWindow 
        quit = 1
      EndIf   
    Until eventID = 0 Or quit = 1
    
    
    
    ClearScreen(RGB(200,200,200))
    
    fillpolygon(@brush, @points, #WINDING)
    
    FlipBuffers()
    
  Until Quit = 1
  
EndIf


Thanks.

M.