boxcl

BOXcl: a single-script Sokoban clone in Tcl/Tk 8.6
git clone git://git.luxferre.top/boxcl.git
Log | Files | Refs

commit 764ff4ad4fb2c86cd8a2705d580ef5c32334ee21
parent 57ae69eb3656fcdbced9a7799884c035cd316f57
Author: Luxferre <lux@ferre>
Date:   Thu, 10 Oct 2024 09:44:49 +0300

Made it start from the levelsets dir

Diffstat:
Mboxcl.tcl | 11++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/boxcl.tcl b/boxcl.tcl @@ -10,6 +10,14 @@ package require textutil package require Tk +set scriptpath [ file normalize [ info script ] ] +set appdir [ file dirname $scriptpath ] +# check if we're running from a starpack +if [string match *app-boxcl $appdir] { + set appdir [ file normalize [ file join $appdir ".." ".." ".." ] ] +} +set leveldir [ file join $appdir "levelsets" ] + # hardcoded tile sizes set tilew 64 set tileh 64 @@ -265,11 +273,12 @@ proc prevlevel {} { # open a levelsetfile proc openlevel {} { + global leveldir set types { {{Plain text levelset} {.txt} TEXT} {{Sokoban YASC levelset} {.sok} TEXT} } - return [tk_getOpenFile -filetypes $types -title {Choose a Sokoban levelset file}] + return [tk_getOpenFile -initialdir $leveldir -filetypes $types -title {Choose a Sokoban levelset file}] } # define the tiles