-- <<<- ------------------------------------------------------------------------ ------------------------------------------------------------------------ -- Load this build script "!mkstart.sx" into a fresh invocation of ScriptX, -- to compile the Dream startup action and build the "dream.sxt" title, -- which depends on the "dream.sxl" LibraryContainer. -- The Dream splash screen, the DreamStartup module, and the Dream -- startup action are stored in this TitleContainer. The startup action -- kicks off the Dream title, by displaying the splash screen, -- initialiazing the title, loading rooms and products, and starting -- the simulation. ------------------------------------------------------------------------ -- Open the Dream library container. open LibraryContainer \ dir: (parentDir theScriptDir) \ path: "dream.sxl" \ mode: @readable open LibraryContainer \ dir: (parentDir theScriptDir) \ path: "dreamimp.sxl" \ mode: @readable ------------------------------------------------------------------------ -- Make our own special startup module, to store in the TitleContainer. module DreamStartup uses Dream uses ScriptX end module DreamOuterStartup uses ScriptX end in module DreamStartup ------------------------------------------------------------------------ ( local startTime := theCalendarClock.time -- Save the directory that this script was loaded from. local dir := theScriptDir local outDir := (parentDir theScriptDir) -- Find the folder containing media. local mediaDir := spawn dir "media" -- Subdue the garbage collector. setGCIncrement 30 -- Compile the startup action, by loading "startup.sx" into the -- DreamStartup module. local action := fileIn dir \ name: "startup.sx" \ module: (getModule @DreamStartup) \ debugInfo: false -- Create the "dream.sxt" TitleContainer. local tc := new TitleContainer \ dir: outDir \ path: "dream.sxt" \ mode: @create \ targetCollection: #(:) -- Give it a name. tc.name := "DreamStartup" -- Import the splash screen bitmap. local str := getStream mediaDir "splash.bmp" @readable local bm := importMedia theImportExportEngine \ str @image @dib @bitmap \ colormap: theDefault8Colormap -- Convert it to the default colormap, by making a new bitmap -- and transfering it. local splash := new BitmapSurface \ bbox: (copy bm.bbox) \ colorMap: theDefault8Colormap transfer splash (bm as BitmapSurface) bm.bbox (new TwoDMatrix) -- Store the DreamStartup module, splash screen, and startup action -- in the "dream.sxt" TitleContainer. tc[@module] := (getModule @DreamStartup) tc[@splash] := splash as Bitmap tc[@startupAction] := action -- The outer startupAction will open the "dream.sxl" and "dreamimp.sxl" -- library containers, load the title container, module, and inner startup -- action, then call the inner startup action on the title container. -- It's carefully defined in DreamOuterStartup, by using fileIn -- on a string with a module: argument, so there are no evil -- module references in the code. local mod := getModule @DreamOuterStartup tc.startupAction := fileIn "(tc -> ( open LibraryContainer \ dir: tc.directory \ path: \"dream.sxl\" \ mode: @readable open LibraryContainer \ dir: tc.directory \ path: \"dreamimp.sxl\" \ mode: @readable load tc load tc[@module] load tc[@startupAction] tc[@startupAction] tc ) & )" module: mod garbageCollect() -- Hold the lever down for long enough for it to get going. close tc local endTime := theCalendarClock.time print #("Time for !mkstart", endTime - startTime) ) ------------------------------------------------------------------------ ok -- >>>