DrawImage() on SpriteOutput does not work

Just starting out? Need help? Post your questions and find answers here.
Foz
Posts: 20
Joined: Mon Feb 24, 2014 11:25 pm

DrawImage() on SpriteOutput does not work

Post by Foz »

Uncaught TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': No function was found that matched the signature provided.

Code: Select all

Global DisplayWidth.i = 0, DisplayHeight.i = 0

Procedure RenderFrame()
  ClearScreen($000077)
  
  DisplaySprite(1, 20, 20 )
  
  FlipBuffers()
EndProcedure


ExamineDesktops()
DisplayWidth = DesktopWidth(0) / 2
DisplayHeight = DesktopHeight(0) /2

OpenWindow (0, 0, 0, DisplayWidth, DisplayHeight, "", #PB_Window_ScreenCentered | #PB_Window_BorderLess)
OpenWindowedScreen(WindowID(0), 0, 0, DisplayWidth, DisplayHeight, 0, 0, 0)

SetFrameRate(3)

BindEvent(#PB_Event_RenderFrame, @RenderFrame())

CreateImage(0, 32, 48)
StartDrawing(ImageOutput(0))
Circle(0,0,16, $ff0000)
StopDrawing()

CreateSprite(1, DisplayWidth, DisplayHeight)
StartDrawing(SpriteOutput(1))
DrawImage(0, 10, 10)  ; <-- comment this out and it works
Box(50, 50, 50, 50, $ffffff)
StopDrawing()

FlipBuffers(); // start the rendering
Fred
Site Admin
Posts: 1506
Joined: Mon Feb 24, 2014 10:51 am

Re: DrawImage() on SpriteOutput does not work

Post by Fred »

DrawImage() expects an ImageID, not a number.
Post Reply