Edit: sorry my bad again I hope you don't mind my beginner questions

You can do this with DrawImage() by setting the width and height.
Code: Select all
EnableExplicit
Define.i Event, Quit
Quit = 0
InitSprite()
InitKeyboard()
CreateImage(0, 320, 240, 32)
OpenWindow(0, 0, 0, 640, 480, "Test Environment", #PB_Window_SystemMenu | #PB_Window_Maximize | #PB_Window_MaximizeGadget)
OpenWindowedScreen(WindowID(0), 0, 0, WindowWidth(0), WindowHeight(0), #False, 0 , 0, #PB_Screen_WaitSynchronization)
Repeat
; Draw the circle to the temp image buffer
StartDrawing(ImageOutput(0))
Box(0, 0, 320, 240, 8723235)
Circle(160, 120, 50, #Yellow)
StopDrawing()
; Copy the temp image buffer to the screen resizing it
StartDrawing(ScreenOutput())
DrawImage(ImageID(0), 0, 0, WindowWidth(0), WindowHeight(0))
; **********************************************************
; Why does this take so much CPU especially when maximised?
; **********************************************************
StopDrawing()
FlipBuffers()
ExamineKeyboard()
If KeyboardReleased(#PB_Key_Escape) : Quit = 1 : EndIf
Repeat
Event = WindowEvent()
If Event = #PB_Event_CloseWindow : Quit = 1 : EndIf
Until Event = 0
Until Quit
Code: Select all
EnableExplicit
Define.i Event, Quit
Quit = 0
InitSprite()
InitKeyboard()
OpenWindow(0, 0, 0, 640, 480, "Test Environment", #PB_Window_SystemMenu | #PB_Window_Maximize | #PB_Window_MaximizeGadget)
OpenWindowedScreen(WindowID(0), 0, 0, WindowWidth(0), WindowHeight(0), #False, 0 , 0, #PB_Screen_WaitSynchronization)
;create new sprite 0
CreateSprite(0,320,240)
;draw inside sprite 0 one time only
StartDrawing(SpriteOutput(0))
Box(0, 0, 320, 240, 8723235)
Circle(160, 120, 50, #Yellow)
StopDrawing()
Repeat
;zoom sprite
ZoomSprite(0,ScreenWidth(),ScreenHeight())
;display sprite
DisplaySprite(0,0,0)
FlipBuffers()
ExamineKeyboard()
If KeyboardReleased(#PB_Key_Escape) : Quit = 1 : EndIf
Repeat
Event = WindowEvent()
If Event = #PB_Event_CloseWindow : Quit = 1 : EndIf
Until Event = 0
Until Quit
Code: Select all
EnableExplicit
Define.i Event, Quit, Sprite
Quit = 0
InitSprite()
InitKeyboard()
OpenWindow(0, 0, 0, 640, 480, "Test Environment", #PB_Window_SystemMenu | #PB_Window_Maximize | #PB_Window_MaximizeGadget)
OpenWindowedScreen(WindowID(0), 0, 0, WindowWidth(0), WindowHeight(0), #False, 0 , 0, #PB_Screen_WaitSynchronization)
;create new sprite
Sprite = 257
CreateSprite(Sprite, 320, 240, #PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(Sprite))
Box(0, 0, 320, 240, RGBA(0,0,0,0))
Circle(100, 120, 10, #Blue)
StopDrawing()
StopDrawing()
Repeat
StartDrawing(ScreenOutput())
Circle(160, 120, 50, #Yellow)
StopDrawing()
;zoom sprite
ZoomSprite(Sprite,ScreenWidth(),ScreenHeight())
;display sprite
DisplayTransparentSprite(Sprite,0,0)
FlipBuffers()
ExamineKeyboard()
If KeyboardReleased(#PB_Key_Escape) : Quit = 1 : EndIf
Repeat
Event = WindowEvent()
If Event = #PB_Event_CloseWindow : Quit = 1 : EndIf
Until Event = 0
Until Quit