atlas text file generator by Cliff Mellangard 3DEGS14th Apr 2018 14:48
|
---|
Summary Got tired to write this by hand everytime i experiment with Power by 2 tiles. Description It generates a basic text file for a atlas file for tiles. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com // Project: Atlas text file maker // Created: 2018-04-14 // show all errors SetErrorMode(2) // set window properties SetWindowTitle( "Atlas text file maker" ) SetWindowSize( 200, 400, 0 ) SetWindowAllowResize( 1 ) // allow the user to resize the window // set display properties SetVirtualResolution( 100, 200 ) // 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 id=1 x=0 y=40 createeditbox(id) seteditboxtext(id,"image size") seteditboxposition(id,x,y) inc id inc y , 40 createeditbox(id) seteditboxtext(id,"tile size") seteditboxposition(id,x,y) id = 1 createtext(id,"use power by 2") settextsize(id,14) id = 2 createtext(id,"space to create") settextsize(id,14) settextposition(id,0,110) id = 3 createtext(id,"Atlas text file maker.") settextsize(id,14) settextposition(id,0,130) id = 4 createtext(id,"File created in apps"+chr(10)+"media folder") settextsize(id,14) settextposition(id,0,150) do if GetRawKeyReleased(32) then exit Sync() loop SetEditBoxFocus(1,0) SetEditBoxFocus(2,0) max=val(geteditboxtext(1)) tile=val(geteditboxtext(2)) x=0 y=0 id=1 file = OpenToWrite( "raw:"+GetDocumentsPath()+"\myAtlas subimages.txt" ) writeline(file,"// generated atlas text file") writeline(file,"//--- y row 0 ---//") for t=1 to 1000 writeline(file,str(id)+":"+str(x)+":"+str(y)+":"+str(tile)+":"+str(tile)) inc id inc x,tile if x=>max x=0 inc y,tile writeline(file,"//--- y row "+str(y)+" ---//") endif if y=max then t=1001 next t CloseFile ( file ) deleteeditbox(1) deleteeditbox(2) deletealltext() |