GLBasic forum

Main forum => GLBasic - en => Topic started by: Hark0 on 2012-Feb-10

Title: External IDE (Sublime Text Editor or another)
Post by: Hark0 on 2012-Feb-10
Hi!


About http://www.sublimetext.com/ or another code editor's are avaliable for use with GLB?


On positive reply... how configure/parameters?

TIA, Hark0
;)

Title: Re: External IDE (Sublime Text Editor or another)
Post by: Moru on 2012-Feb-10
There was a few threads about that but can't seem to find them at the moment.

In general there is nothing stopping you just opening the gbas files in whatever editor you want, saving and switching to GLBasic to compile. However there was some problem involving GLBasic not using the changes to the files. Maybe that is fixed now? I haven't really tried it at all. I would love to learn to use the Sublime text editor. I have it installed at work but since I never have time to learn it, I can't use it effectively... and so I can't use it :-)
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Slydog on 2012-Feb-10
I just checked out Sublime, and I like it.
I love the 'minimap' feature on the side!
GLBasic syntax colouring would be nice.
And, it does have a 'Build' feature, so configuring it with GLBasic's compiler would be awesome, if possible!

The bug with the compiler not picking up changed files seems to be working better lately. 
It was only checking the first 10 files or so in your project, but I'm not 100% sure if Gernot fixed that yet.

It would be nice to have a guide on how to configure other text editors to edit and compile GLBasic projects.
Include topics such as a KEYWORDS list, compiler location and parameters, etc.
Eventually we could have configurations available for the most popular editors.
(If it's even possible, that is!)
Title: Re: External IDE (Sublime Text Editor or another)
Post by: MrTAToad on 2012-Feb-10
The problem with other IDEs  is that it would need to be able to handle XML project files and the batch file for compiling stuff...
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Slydog on 2012-Feb-10
Dang, you're right!  Forgot about multiple project source files, plus all the other project settings!

At some point, does GLBasic IDE convert the project file into a 'make' file?
Maybe a button in GLBasic to build the make file for us would help?
We should only have to update this file when we change the project.

First 'build' converts the GLBasic code into C, then compiles the C into an executable?
I really have no idea how all this works behind the scene, so no point in me speculating.
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Hark0 on 2012-Feb-11
Quote from: Moru on 2012-Feb-10
There was a few threads about that but can't seem to find them at the moment.
Yes yes... I know ;-)

Quote
In general there is nothing stopping you just opening the gbas files in whatever editor you want, saving and switching to GLBasic to compile. However there was some problem involving GLBasic not using the changes to the files. Maybe that is fixed now? I haven't really tried it at all. I would love to learn to use the Sublime text editor. I have it installed at work but since I never have time to learn it, I can't use it effectively... and so I can't use it :-)

Yes, any text editor are avaliable for write gbas files... but, (and sorry me for GLB IDE developer) comparing features about our IDE vs othe IDE's... no color.

Like you I very interest in use Sublime with GLB.

;-)
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Hark0 on 2012-Feb-11
Quote from: Slydog on 2012-Feb-10
I just checked out Sublime, and I like it.
I love the 'minimap' feature on the side!
GLBasic syntax colouring would be nice.
And, it does have a 'Build' feature, so configuring it with GLBasic's compiler would be awesome, if possible!

The bug with the compiler not picking up changed files seems to be working better lately. 
It was only checking the first 10 files or so in your project, but I'm not 100% sure if Gernot fixed that yet.

It would be nice to have a guide on how to configure other text editors to edit and compile GLBasic projects.
Include topics such as a KEYWORDS list, compiler location and parameters, etc.
Eventually we could have configurations available for the most popular editors.
(If it's even possible, that is!)

+1
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Hark0 on 2012-Feb-11
Quote from: MrTAToad on 2012-Feb-10
The problem with other IDEs  is that it would need to be able to handle XML project files and the batch file for compiling stuff...

hmmmm "batch file" hmmmmm

:P
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Hark0 on 2012-Feb-11
Quote from: Slydog on 2012-Feb-10
Dang, you're right!  Forgot about multiple project source files, plus all the other project settings!

At some point, does GLBasic IDE convert the project file into a 'make' file?
Maybe a button in GLBasic to build the make file for us would help?
We should only have to update this file when we change the project.

First 'build' converts the GLBasic code into C, then compiles the C into an executable?
I really have no idea how all this works behind the scene, so no point in me speculating.

... maybe the second build are "standard" makefile depending of platform exe?
Title: Re: External IDE (Sublime Text Editor or another)
Post by: bigsofty on 2012-Feb-11
I suggested this as a way to get the GLB to handle all the nitty-gritty stuff of using an external IDE... http://www.glbasic.com/forum/index.php?topic=6429.0
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Hark0 on 2012-Feb-13
Quote from: bigsofty on 2012-Feb-11
I suggested this as a way to get the GLB to handle all the nitty-gritty stuff of using an external IDE... http://www.glbasic.com/forum/index.php?topic=6429.0

Thanks for this link!!!

=D
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Hark0 on 2012-Feb-13
Following the link posted by bigsofty Kitty Hello says:

Quote
I think it would have to be a console program like "glbasic.exe" that can do:
glbasic.exe /PLAT=WIN32 /DEBUG "path to gbap file"

Any plan for this in near future?
=D
Title: Re: External IDE (Sublime Text Editor or another)
Post by: MrTAToad on 2012-Feb-13
Should be easy enough for Gernot :)
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Hark0 on 2012-Feb-14
Gernot listen please!

;)
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Kitty Hello on 2012-Feb-14
that's a pretty nice idea. There's a project that can read the glbasic gbap xml files, already. So I think we should write an GLBasic project that can do this.
Title: Re: External IDE (Sublime Text Editor or another)
Post by: ampos on 2012-Feb-14
Perhaps we someone can make another editor to compile for windows (95% of the time), and when the proyect is "over" and we need different targets, switch to original GLB editor...
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Hark0 on 2012-Feb-14
Quote from: Kitty Hello on 2012-Feb-14
that's a pretty nice idea. There's a project that can read the glbasic gbap xml files, already. So I think we should write an GLBasic project that can do this.

THANKS!!!!
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Hark0 on 2012-Feb-14
Quote from: ampos on 2012-Feb-14
Perhaps we someone can make another editor to compile for windows (95% of the time), and when the proyect is "over" and we need different targets, switch to original GLB editor...

Maybe writted by GLB?  :P
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Albert on 2012-Apr-21
I've found a PureBasic package for Sublime Text 2. I've modified to adapt for glBasic.

(http://dl.dropbox.com/u/292449/glbasic/sublime/sublime.jpg)

There is still a lot of work to do, but you get some basic autocompletion and I added some snippet (try 'func' and press tab, then fill out the fields pressing tab)

Download from here:
http://dl.dropbox.com/u/292449/glbasic/sublime/GLBasic.zip (http://dl.dropbox.com/u/292449/glbasic/sublime/GLBasic.zip)

You can follow this workflow:
* Open your project in glBasic and close all of the open files in it, only left 1 file open.
* Open the neccessery files in Sublime Text Editor (you also get cross-file auto completion)
* Edit and save all the files in Sublime Text 2.
* Compile and Debug in GLBasic

ps: I'd really like to see someone expand this plugin. There is still a lot of PureBasic stuff in here, and lot of GLBasic Constans and Keyword are missing.
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Schranz0r on 2012-Apr-21
looking realy good right now :D
I like the style from that IDE!
Title: Re: External IDE (Sublime Text Editor or another)
Post by: MrTAToad on 2012-Apr-22
Excellent - It would allow the editor to be used in Windows, Mac and more importantly Linux...

The scripting language used to deal with everything though is hideous though...  I'll see if I can at least get all the commands in the auto-completion list

Either code completion is a bit different, or something is dodgy, but I tried it with :

Code (glbasic) Select
{
"scope": "source.glbasic",

// GLBasic, GLBasic Functions
"completions":
[
{ "trigger": "?DEFINE","contents": "?DEFINE $(1:var) = $(2:value)"},
{ "trigger": "?ELSE", "contents": "?ELSE"},
{ "trigger": "?ENDIF","contents": "?ENDIF"},
{ "trigger": "?ERROR","contents": "?ERROR $(1:Text)"},
{ "trigger": "?IF","contents": "?IF $(1:var) = $(2:value)"}
]
}


And it either didn't find the correct code completion keyword or selecting a keyline (in the editor) just wipes out the text...  Nor could I get it to compile...
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Albert on 2012-Apr-22
Regexp? Then try \?
Title: Re: External IDE (Sublime Text Editor or another)
Post by: MrTAToad on 2012-Apr-22
No, it's regarded as an invalid escape code :)
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Enigma on 2012-Jun-12
Is this still being worked on as I would really like to use Sublime Text 2 as my main editor?
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Albert on 2012-Jun-12
I'm managed to set-up a simple command line environment to compile glBasic stuff with gcc (only the gcc compile part, I skipped the preprocess).
What I wanted to achieve is: create the minimal .cpp and .h files which are necessary to succesfully compile and run a precompiled and stripped down GLBasic project.

If one add the precompile part then we can easily create a build system for Sublime Text 2.

So here it is what I did:

You can configure your project in config.bat, setting the glBasic path
Config.bat
Code (glbasic) Select

@set GLBASIC=%programfiles%\glbasic\
@set path=%path%;%GLBASIC%\compiler\platform\win32\bin
@set PROJECT_PATH=.
@set SOURCEFILES=*.cpp


You must copy your glblicence.inc file to the project folder from c:\Users\username\AppData\Local\Temp\glbasic\

Then you can compile your project with compile.bat and link with link.bat

The main program in the test.cpp, which is a stripped down gpc_temp0.cpp
Code (glbasic) Select
#include "gpc_temp.h"
void __GQuitNProfile()
{
   __PPExportProf("profile.csv", __DATE__, __TIME__);
}

namespace __GLBASIC__{
void __glb_init_globals();
int __MainGameSub_(void)
{   __PPRegisterFunction
    __glb_init_globals();

PRINT( CGStr("STUFF"), 1, 1, true);
SHOWSCREEN();
MOUSEWAIT();

END();
return 0;
} // end main
// ------------------------ //
DGInt __end_main__foo__()
{
   __PPRegisterFunction
return 0;
}
void __GLB_Defaults(){
__DG_RESX=640;
__DG_RESY=480;
__DG_FULLSCREEN=0;
__DG_MULTISAMPLE=0;
__DG_FRAMERATE=40;
__DG_DEBUG=1;
__DG_WANTMOUSE=GLB_WANTMOUSE_AT_START;
__DG_SCHOOLVER=0;
__glb_AppName()= "test";
}

#include "glblicence.inc"
} // namespace


Download: https://dl.dropbox.com/u/292449/glbasic/sublime/GLBasic_gcc_compiler_scripts.zip
Title: Re: External IDE (Sublime Text Editor or another)
Post by: kanonet on 2012-Jun-12
Maybe im wrong, but this shouldnt be necessary, cuz you can call the GLB (pre-)compile with a few parameters and it will do the work for you. So at least under Windows it should be easy to use an other IDE.
Does your solution work under Linux too?
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Albert on 2012-Jun-12
Sure, replace all the set to export, and change the target system to linux.
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Slydog on 2012-Jun-12
This is from the help file, not sure if it's of any help:
(under the 'Contents' tab, 'GLBasic interm' node, then 'GPC-GLBasic Precompiler')

GPC-GLBasic Precompiler
The heart of the GLBasic development environment is the GPC precompiler. It takes a list of .gbas files and converts them to .cpp files that you can compile with a g++ (gcc) C++ compiler to machine code. Since version 8 the GPC is freely accessible and thus can be used from a 3rd party IDE, which is not recommended since the GLBasic IDE offers a lot of GLBasic specific aid.
The following syntax is used when calling the GPC:

GPC.exe
-N"Project Name" (for names with spaces, directly connect the quotes to the parameter)
-O"Output prefix (with path)"
-P"Project path" (without trailing "\")
-D - Debug version
-F - Fullscreen
-X640 - Width
-Y480 - Height
-R60 - Frame rate
-M0 - Multisample factor
-EXPLICIT - Explicit declarations
-pNAME=value - Preprocessor definitions (e.g. -pGLB_CONSOLE=1 -pWIN32=1 -pGLB_VERSION=8.01)
-L - License info bits 0=2D, 1=3D, 2=NET (only relevant for warnings)
Title: Re: External IDE (Sublime Text Editor or another)
Post by: FutureCow on 2012-Jun-13
I'm not sure how the debug version would work - I can't see how you could introduce breakpoints and do a debug run of your code through an external IDE.
Title: Re: External IDE (Sublime Text Editor or another)
Post by: mentalthink on 2012-Jun-13
This IDE it´s genial, will be very interesting have for GLBasic...
Title: Re: External IDE (Sublime Text Editor or another)
Post by: erico on 2012-Jun-13
Quote from: FutureCow on 2012-Jun-13
I'm not sure how the debug version would work - I can't see how you could introduce breakpoints and do a debug run of your code through an external IDE.

yep, I guess it would be nice to upgrade on the current GLB ide to have features people enjoy.
It may be more important to have our current ide running on mac/linux too.
...and then try to improve on it?

It sounds like a lot of work to me. Good thing the current ide is all I need :)
But the map/scroll on the right side of this one really looks interesting. :good:
Title: Re: External IDE (Sublime Text Editor or another)
Post by: Kitty Hello on 2012-Jun-13
There's no way to debug a program outside of the editor. I might think about using the gpc-debugger one day. But I have no idea if it's possible.