Page 1 of 1

DrawImage() on SpriteOutput does not work

Posted: Thu Mar 06, 2014 7:03 pm
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

Re: DrawImage() on SpriteOutput does not work

Posted: Tue Mar 18, 2014 2:13 pm
by Fred
DrawImage() expects an ImageID, not a number.