ZgeSublime

Use of external libraries (DLLs) from ZGE.

Moderator: Moderators

Post Reply
User avatar
Ats
Posts: 829
Joined: Fri Sep 28, 2012 10:05 am
Contact:

ZgeSublime

Post by Ats »

ZgeSublime is not an extension for ZGameEditor, but rather a Sublime Text plugin I started to build and run .zgeproj files directly from the editor.

Installation
  1. Download ZgeSublime from: https://github.com/Txori/ZgeSublime
  2. In Sublime Text, go to Preferences > Browse Packages...
  3. This opens the Packages folder. Clone or copy the ZgeSublime folder into it.

Configuration

Edit the ZgeSublime.sublime-settings file and set the path to your ZGameEditor.exe.
Default path: C:/Dropbox/System/ZGameEditor/ZGameEditor.exe


Usage

Open your .zgeproj file in Sublime Text.
Right-click in the editor to open the context menu and choose ZGameEditor:
  • Run project
    This saves the file, then builds and runs your project.
    You can also press Ctrl+Enter to run the same command.
  • Fold/Unfold data
    This folds (or unfolds) all the XML data tags in your project, so you can focus only on the code.
  • Add code spacing
    This will standardize spacing and adds comments within specific XML <![CDATA[...]]> sections, improving code readability.
    Running multiple times will not add extra spacing; it normalizes the format.
Last edited by Ats on Wed Jun 25, 2025 2:00 pm, edited 5 times in total.
User avatar
VilleK
Site Admin
Posts: 2382
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: ZgeSublime

Post by VilleK »

Nice, thanks for sharing. I find I often edit zgeproj files directly in my favorite texteditor instead of inside ZGE so I can use the keyboard shortcuts I'm used to. Also it often makes sense to edit the whole project instead of just a single expression and even this can be done in the XML view in ZGE there are other editors that do this better.
User avatar
Ats
Posts: 829
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: ZgeSublime

Post by Ats »

I've added custom syntax highlighting to the plugin for better visualization of zgeproj files:
  • XML structure is styled similarly to PHP to de-emphasize markup
  • ZExpression sections (<Expression>, <WhileExp>, etc.) use C#-like coloring
  • Data sections (<BitmapFile>, <MeshData>) appear in grey for minimal visibility
I didn't handle the GLSL code yet. I think it will be simpler for the user to install that syntax, so I can use it in ZGameEditor syntax.
User avatar
Ats
Posts: 829
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: ZgeSublime

Post by Ats »

The syntax coloring is now almost perfect.
I also added a context menu option to fold/unfold all the data imported into the project, so we can focus only on the code.
Right now, it detects the XML tags: BitmapFile, FileEmbedded, Icon, MeshData, and SampleData. Did I catch them all?
User avatar
Kjell
Posts: 1935
Joined: Sat Feb 23, 2008 11:15 pm

Re: ZgeSublime

Post by Kjell »

Hi Ats,
Ats wrote: Tue Jun 24, 2025 9:42 amDid I catch them all?
You missed a couple of them :wink:

- Array.Values
- Music.MusicFile
- SpriteSheet.SpriteData

K
User avatar
Ats
Posts: 829
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: ZgeSublime

Post by Ats »

Thanks, Kjell. I’d never used those before :lol:
So I added them to the list of XML data tags, and also updated the syntax so they appear in gray.
I also forgot to import the `re` library, which is needed by my script to fold/unfold tags, as I was editing the file directly on GitHub. (Committing files via the command line still gives me goosebumps)

I think my next Sublime option will be to add some space around code tags, for readability.

As an example,

Code: Select all

<![CDATA[void testCollider(xptr body) {
  xptr pointer = zbtGetMainCollidedObject(body);
  if (getModelData(pointer, "count")) FireHits ++;
}]]>
Will become:

Code: Select all

<![CDATA[//

void testCollider(xptr body) {
  xptr pointer = zbtGetMainCollidedObject(body);
  if (getModelData(pointer, "count")) FireHits ++;
}

//]]>
It changes nothing to the project, but it is very handy in Sublime Text.
Post Reply