Author Topic: Canvas Functions  (Read 2994 times)

You got farther than me.  I got caught up in work stuff.  I'd love to see how you got that far. o-O

I don't think the extra memory usage would be a problem.  Unless it increases dramatically as you add things to the gui.

Well, I didn't have time to finish what I'd wanted to. I had intended to avoid using the default client scripts and stuff, but it crashes without them and I don't have time to figure it out right now. It works fine with the default client scripts, just uses more resources.

Anyway, here's what I have so far:
Code: (base/dediGUI.cs) [Select]
warn(" > BEGIN");
trace(1);
//exec("base/client/init.cs"); //THESE SEEM TO BE UNNEEDED
//initBaseClient();
//exec("base/client/canvas.cs");
initCanvas("Blockland Dedicated Server");
exec("base/client/message.cs"); //THIS IS TO PREVENT CONSOLE SPAM WHEN EXECUTING allClientScripts.cs
exec("base/client/scripts/allClientScripts.cs"); //COMMENT THIS OUT IF YOU WANT YOUR GAME TO CRASH (18Mb RAM)
//exec("base/client/ui/allClientGuis.gui"); //UNCOMMENT THIS TO ENABLE DEFAULT GUIs (10Mb RAM)
warn(" > loading GUI");
exec("base/DedicatedServerGUI.gui"); //EXEC MY TEST GUI
warn(" > setting content");
canvas.setContent(DedicatedServerGUI); //CRASHES HERE IF allClientScripts.cs IS NOT LOADED - I believe this is related to the CanvasCursor package
trace(0);
warn(" > DEDI GUI READY");

//FYI - the canvas uses the client config from "config/client/prefs.cs"
//it would be nice to bypass this and set up a 640x480 window, but I don't have time

Code: (dedicatedServerGUI.gui) [Select]
//--- OBJECT WRITE BEGIN ---
new GuiControl(DedicatedServerGUI) {
   profile = "GuiDefaultProfile";
   horizSizing = "right";
   vertSizing = "bottom";
   position = "0 0";
   extent = "640 480";
   minExtent = "8 2";
   enabled = "1";
   visible = "1";
   clipToParent = "1";

   new GuiSwatchCtrl() {
      profile = "GuiDefaultProfile";
      horizSizing = "width";
      vertSizing = "height";
      position = "0 0";
      extent = "640 480";
      minExtent = "8 2";
      enabled = "1";
      visible = "1";
      clipToParent = "1";
      color = "200 200 200 255";

      new GuiScrollCtrl() {
         profile = "GuiScrollProfile";
         horizSizing = "width";
         vertSizing = "height";
         position = "200 10";
         extent = "430 430";
         minExtent = "8 2";
         enabled = "1";
         visible = "1";
         clipToParent = "1";
         willFirstRespond = "0";
         hScrollBar = "dynamic";
         vScrollBar = "alwaysOn";
         constantThumbHeight = "0";
         childMargin = "0 0";
         rowHeight = "40";
         columnWidth = "30";

         new GuiConsole() {
            profile = "GuiConsoleProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "1 -7551";
            extent = "986 8172";
            minExtent = "8 2";
            enabled = "1";
            visible = "1";
            clipToParent = "1";
         };
      };
      new GuiConsoleEditCtrl(ConsoleEntry) {
         profile = "GuiTextEditProfile";
         horizSizing = "width";
         vertSizing = "top";
         position = "200 452";
         extent = "430 18";
         minExtent = "8 2";
         enabled = "1";
         visible = "1";
         clipToParent = "1";
         altCommand = "ConsoleEntry::eval();";
         maxLength = "255";
         historySize = "20";
         password = "0";
         tabComplete = "0";
         sinkAllKeyEvents = "1";
         useSiblingScroller = "1";
      };
      new GuiScrollCtrl() {
         profile = "GuiScrollProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "10 10";
         extent = "180 200";
         minExtent = "8 2";
         enabled = "1";
         visible = "1";
         clipToParent = "1";
         willFirstRespond = "0";
         hScrollBar = "alwaysOff";
         vScrollBar = "dynamic";
         constantThumbHeight = "0";
         childMargin = "0 0";
         rowHeight = "40";
         columnWidth = "30";

         new GuiTextListCtrl(DedicatedServerGUI_PlayerList) {
            profile = "GuiTextListProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "1 1";
            extent = "178 2";
            minExtent = "8 2";
            enabled = "1";
            visible = "1";
            clipToParent = "1";
            enumerate = "0";
            resizeCell = "1";
            columns = "0";
            fitParentWidth = "1";
            clipColumnText = "0";
         };
      };
   };
};
//--- OBJECT WRITE END ---

//it would be nice to bypass this and set up a 640x480 window, but I don't have time
try setScreenMode(640,480,32,0,60);