Good call! The code (shown below) still runs dry on GPU.
I think I'll let the only way to save the image be to take a screenshot. Incidentally, this fits the program, since the canvas you're drawing on is the exact size of your screen.
I know it's gimmicky like the Dickens, but I really like the idea of a drawing program without a saving function. It's permadeath for art!
Anyone got a cool title for this?
// Project: test-share-img
// Created: 2020-09-12
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "test-share-img" )
SetWindowSize( 768,1024, 0, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 768, 1024 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
setClearColor(255,255,255)
rem Save
Global saveTID as integer
saveTID = CreateText(chr(10)+"Share..."+chr(10)+" ")
SetTextSize(saveTID, 80.0)
SetTextColor(saveTID, 0, 0, 0, 255)
SetTextLineSpacing( saveTID, 0.0 )
SetTextAlignment( saveTID, 0 ) // 0 = left 1 = centered 2 = right
SetTextPosition( saveTID, 180.0, 600.0)
setTextDepth ( saveTID, 1)
Global renderImg as integer = 395 // pixelart image we render the scene to
do
if getPointerPressed()
if getTextHitTest(saveTID, getPointerX(), getPointerY())
setTextString(saveTID,chr(10)+"Share... (working)"+chr(10)+" ")
renderImg = CreateRenderImage( GetMaxDeviceWidth(), GetMaxDeviceHeight(), 0, 0 )
SetRenderToImage( renderImg, 0) //set the world to render to the Texture Image
ClearScreen()
render()
SetRenderToScreen()
SaveImage( renderImg, "fingerpaint_tmp.png" )
ShareImage( "fingerpaint_tmp.png" )
DeleteImage( renderImg )
setTextString(saveTID,chr(10)+"Share... (done)"+chr(10)+" ")
endif
endif
Print( ScreenFPS() )
Sync()
loop