AllBASIC

BASIC Developer & Support Resources => Translators => JADE => Topic started by: AIR on November 08, 2013, 01:40:44 PM

Title: JADE - A Sneak Peek
Post by: AIR on November 08, 2013, 01:40:44 PM
Comments on the code style welcome:

Code: [Select]
#include "../jade.h"
#include "sdl2.inc"

// SCREEN DIMENSIONS
CONSTANT INT SCREEN_WIDTH = 640;
CONSTANT INT SCREEN_HEIGHT = 480;

MAIN
    DIM AS PWINDOW window = NULL;
    DIM AS PSURFACE screenSurface = NULL;
    DIM AS BOOL quit = false;
    DIM AS SDL_Event e;
   
    IF ( SDL_Init( SDL_INIT_VIDEO ) < 0 ) THEN
        PRINT( SDL_GetError() );
    ELSE
        //Create Window
        window = SDL_CreateWindow( "SDL Simple Window",
                                    SDL_WINDOWPOS_UNDEFINED,
                                    SDL_WINDOWPOS_UNDEFINED,
                                    SCREEN_WIDTH,
                                    SCREEN_HEIGHT,
                                    SDL_WINDOW_SHOWN);
       
        IF ( window == NULL ) THEN
            PRINT( SDL_GetError() );
        ELSE
            // Get Window Surface
            screenSurface = SDL_GetWindowSurface( window );

           
            WHILE (NOT quit) BEGIN
                WHILE ( SDL_PollEvent( ADDR e) != 0 ) BEGIN
                    SELECT (e.type) BEGIN
                        CASE SDL_QUIT:
                            quit = true;
                        ENDCASE
                    ENDSELECT
                WEND
                // Fill the surface with White
                SDL_FillRect( screenSurface, NULL, SDL_MapRGB( screenSurface->format, 255, 255, 255 ) );
                // Update the Surface
                SDL_UpdateWindowSurface( window );
           
            WEND
        ENDIF
    ENDIF
   
    //Destroy Window
    SDL_DestroyWindow( window );
   
    // Shutdown SDL
    SDL_Quit();
   
    RETURN 0;
   
END
Title: Re: JADE - A Sneak Peek
Post by: John on November 08, 2013, 03:07:52 PM
Hard to believe that is C++.  8)
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 08, 2013, 05:53:03 PM
You know what I think, SUPERB!!!
Title: SDL Windows, MingW and Code::Blocks Users
Post by: kryton9 on November 08, 2013, 11:15:10 PM
This is for the original SDL and not SDL2.

I don't know how it is on Macs or Linux at the moment,
but in Windows you usually have your #include for SDL includes
depending on extensions you are adding as:
#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include "SDL/SDL_mixer.h"
#include "SDL/SDL_ttf.h"
#include "SDL/SDL_net.h"

On windows if you are using Code::Blocks and MingW
your linker settings should look like this, in the order you see it:
mingw32
SDL_net
SDL_ttf
SDL_mixer
SDL_image
SDLmain
SDL.dll
user32
gdi32
winmm
dxguid

Attached is a screenshot from one of the frames of Jade:sdl_test by AIR
Title: Re: SDL Windows, MingW and Code::Blocks Users
Post by: AIR on November 08, 2013, 11:52:20 PM
This is for the original SDL and not SDL2.

I don't know how it is on Macs or Linux at the moment,
but in Windows you usually have your #include for SDL includes
depending on extensions you are adding as:
#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include "SDL/SDL_mixer.h"
#include "SDL/SDL_ttf.h"
#include "SDL/SDL_net.h"

Not necessarily true, if you set up your include paths properly you don't need to preface the include files.
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 09, 2013, 12:25:17 AM
True AIR, but in Windows you usually see it like that in all the tutorials on the web for Windows development and SDL. Just wanted to give a heads up when users using all that I listed in the Subject when they get errors.

I haven't gotten the link settings for SDL2 to work yet, as soon as I do I will put them up too.
Title: SDL2 Windows Mingw Code::Blocks users
Post by: kryton9 on November 09, 2013, 12:58:28 AM
If you use 32 bit, you need to use: i686-w64-mingw32 includes, libs and bins for SDL2.
If you use 64 bit, you need to use: x86_64-w64-mingw32 includes, libs and bins for SDL2.

Like SDL original, in Windows you are seeing this for SDL2:
#include "SDL2/SDL.h"
#include "SDL2/SDL_image.h"
#include "SDL2/SDL_mixer.h"
#include "SDL2/SDL_ttf.h"
#include "SDL2/SDL_net.h"

Linker settings as follows:
On windows if you are using Code::Blocks and MingW
your linker settings should look like this, in the order you see it:
mingw32
SDL2_net
SDL2_ttf
SDL2_mixer
SDL2_image
SDL2main
SDL2.dll
SDL2
user32
gdi32
winmm
dxguid

This is what you should see when you compile and run Jade:SDL2
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 09, 2013, 01:08:26 AM
AIR I will make a SFML demo for Jade.

I moved from SDL1.x to SFML, but this was before SDL2 came out. I really like Laurent Gomila's programming style and his has been the nicest library I have seen yet in C++.
He documents everything really well and covers all aspects of using his libraries, from installing, setting up different IDE's etc.

When I had my gaming pc, I had a Mac OS Lion VM, Mint VM and of course my Windows 7. I broke my arm and so during that time, I wrote  a pong game so I could play something with one arm,  using SFML it cross-compiled really nicely in all three OS's.  I couldn't use Code::Blocks in Lion, just too buggy, so I compiled in XCode and it compiled fine.

I would use the pong game but being 1 handed at the time, the code is a mess to look at and I hate putting up terrible looking code.

I like your coding style too, it is like Laurent's and the way I like too. So I think SFML will make a good addition to Jade.

Anyways I will work on that and let you know when I run into errors with Jade. I do get a few warnings with both sdl demos. I will document them better tomorrow, getting too sleepy at the moment.

Thanks for Jade, it let's me use C++ without eye strain :)
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 09, 2013, 06:01:28 PM
Air, I am getting too confused with Git and also getting things working in Code::Blocks in Windows on my local computer keeping up the project files with the repositories is confusing.

What I am going to do tonight is finish setting up my development environment in my Mint Virtual Machine and do all development on Jade for now in there.

Wow you really are moving along at an incredible pace. I see you added a lot today, thanks. I will get setup and test all the new things and report any issues from Mint development.

Once we are finished, I will then test everything in Windows.
Title: Re: JADE - A Sneak Peek
Post by: AIR on November 09, 2013, 06:34:52 PM
That's why I do everything at a command prompt, even on Windows.  Using the Git for Windows version of Bash (via sh.exe), I can even use the configure scripts that you could usually only use with *.nix operating systems.

Command Prompt and Vim (also comes with Git for Windows!) is all i need.   ;D

A.
Title: JADE - AIR Pong
Post by: John on November 09, 2013, 06:41:27 PM
JADE - Ubuntu 64 bit

(http://files.allbasic.info/JADE/pong.png)


JADE - Android

(http://files.allbasic.info/JADE/airpong.png)

Code: [Select]
#include "header.inc"
#include "runtime.inc"
#include "sdl2.inc"
#include <SDL.h>


MAIN
  /* Variable declarations, SDL2 initialization */
    Init(SDL_INIT_VIDEO);
    DIM AS PWINDOW window;
    DIM AS PRENDERER renderer;
    DIM AS BOOL p1_up = false;
    DIM AS BOOL p1_down = false;
    DIM AS BOOL p2_up = false;
    DIM AS BOOL p2_down = false;

    DIM AS INT p1_y = 199;
    DIM AS INT p2_y = 199;

    DIM AS INT p1_vel = 0;
    DIM AS INT p2_vel = 0;

    DIM AS BOOL quit = false;

    DIM AS INT ball_x = 639 / 2;
    DIM AS INT ball_y = 479 / 2;

    DIM AS INT ball_w = 8;
    DIM AS INT ball_h = 8;

    DIM AS INT ball_x_vel = 5;
    DIM AS INT ball_y_vel = 0;

    DIM AS INT delay = 30;

    DIM AS INT p1_score = 0;
    DIM AS INT p2_score = 0;

    DIM AS INT BALL_WIDTH = 10;
    DIM AS INT BALL_HEIGHT = 10;

    CONSTANT INT Y_MIN = 0;
    CONSTANT INT Y_MAX = 399;

    CONSTANT INT P1_X = 0;
    CONSTANT INT P2_X = 629;

    CONSTANT INT VEL_POS = 10;
    CONSTANT INT VEL_NEG = 0 - VEL_POS;

    window = CreateWindow("Pong",
                              SDL_WINDOWPOS_CENTERED,
                              SDL_WINDOWPOS_CENTERED,
                              640,
                              480,
                              SDL_WINDOW_SHOWN);

    renderer = CreateRenderer(window, -1, 0);

    PRINT("Press Q to quit.");

    /* Main Game Loop */
    WHILE (NOT quit) BEGIN
        EVENT event;

        WHILE (PollEvent(ADDR event)) BEGIN
            SELECT (event.type) BEGIN
                CASE KEYDOWN:
                    SELECT (event.key.keysym.sym) BEGIN
                        CASE SDLK_w:
                          p1_vel = VEL_NEG;
                        ENDCASE

                        CASE SDLK_s:
                          p1_vel = VEL_POS;
                        ENDCASE

                        CASE SDLK_UP:
                          p2_vel = VEL_NEG;
                        ENDCASE

                        CASE SDLK_DOWN:
                          p2_vel = VEL_POS;
                        ENDCASE

                        CASE SDLK_q:
                          quit = true;
                        ENDCASE

                        CASE SDLK_EQUALS:
                          INCR delay;
                        ENDCASE

                        CASE SDLK_MINUS:
                          IF (delay > 1) DECR delay;
                        ENDCASE

                        CASE_ELSE:
                        ENDCASE
                    ENDSELECT
                ENDCASE

                CASE KEYUP:
                    SELECT (event.key.keysym.sym) BEGIN

                        CASE SDLK_w:
                          IF (p1_vel == VEL_NEG) p1_vel = 0;
                        ENDCASE

                        CASE SDLK_s:
                          IF (p1_vel == VEL_POS) p1_vel = 0;
                        ENDCASE

                        CASE SDLK_UP:
                          IF (p2_vel == VEL_NEG) p2_vel = 0;
                        ENDCASE

                        CASE SDLK_DOWN:
                          IF (p2_vel == VEL_POS) p2_vel = 0;
                        ENDCASE

                        CASE_ELSE:
                        ENDCASE
                    ENDSELECT
                ENDCASE

                CASE_ELSE:
                ENDCASE

            ENDSELECT
        WEND

        /* Clears the screen */
        SetRenderDrawColor(renderer, 0, 0, 0, 255);
        RenderClear(renderer);
        DIM AS RECT midline = {640/2-4, 0, 9, 479};
        SetRenderDrawColor(renderer, 90, 90, 90, 255);
        RenderDrawRect(renderer, &midline);
        RenderFillRect(renderer, &midline);

        /* Manipulate paddle positions */
        p1_y = p1_y + p1_vel;
        p2_y = p2_y + p2_vel;
        IF (p1_y < Y_MIN) p1_y = Y_MIN;
        IF (p1_y > Y_MAX) p1_y = Y_MAX;
        IF (p2_y < Y_MIN) p2_y = Y_MIN;
        IF (p2_y > Y_MAX) p2_y = Y_MAX;


        /* Draw the paddles */
        SetRenderDrawColor(renderer, 255, 255, 255, 255);
        DIM AS Rect rect1 = {P1_X, p1_y, 10, 80};
        DIM AS Rect rect2 = {P2_X, p2_y, 10, 80};
        RenderDrawRect(renderer, &rect1);
        RenderDrawRect(renderer, &rect2);
        RenderFillRect(renderer, &rect1);
        RenderFillRect(renderer, &rect2);

        /* Manipulate the ball position */
        ball_x = ball_x + ball_x_vel;
        ball_y = ball_y + ball_y_vel;

        IF (ball_x + 4 >= 630 AND ball_x <= 639 AND ball_y + 4 < p2_y + 80 AND ball_y - 4 > p2_y) THEN
            ball_x_vel = -ball_x_vel;
            ball_y_vel = ball_y_vel + (ball_y - (p2_y + 40)) / 10;
            IF (ball_x_vel < 0) ball_x_vel--;
            IF (ball_x_vel > 0) ball_x_vel++;
        ENDIF

        IF (ball_x - 4 <= 9 AND ball_x >= 0 AND ball_y + 4 < p1_y + 80 AND ball_y - 4 > p1_y) THEN
            ball_x_vel = -ball_x_vel;
            ball_y_vel = ball_y_vel + (ball_y - (p1_y + 40)) / 10;
            IF (ball_x_vel < 0 AND ball_x_vel > -8) ball_x_vel--;
            IF (ball_x_vel > 0 AND ball_x_vel < 8) ball_x_vel++;
        ENDIF

        IF (ball_y - 4 <= 0 OR ball_y + 4 >= 479) THEN
          ball_y_vel = -ball_y_vel;
        ENDIF

        RenderDrawLine(renderer, ball_x, ball_y - 4, ball_x, ball_y + 4);
        RenderDrawLine(renderer, ball_x - 4, ball_y, ball_x + 4, ball_y);

        IF (ball_x < 0) THEN
          INCR p2_score;
          ball_x = 639 / 2;
          ball_y = 439 / 2;
          ball_x_vel = -6;
          ball_y_vel = 0;
          p1_y = 199;
          p2_y = 199;
        ENDIF

        IF (ball_x > 639) THEN
          INCR p1_score;
          ball_x = 639 / 2;
          ball_y = 439 / 2;
          ball_x_vel = 6;
          ball_y_vel = 0;
          p1_y = 199;
          p2_y = 199;
        ENDIF

        /* Draw everything to the screen */
        RenderPresent(renderer);

        Delay(delay);
    WEND

    Quit();
    RETURN 0;
ENDMAIN
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 09, 2013, 07:20:23 PM
@Air, Vim will be too much to learn. I installed SciTe, I am familiar with it from using oxgenBasic. It is a nice GUI based, small but powerful text editor.

@John, did you compile for Android using C for Android?
Title: Re: JADE - A Sneak Peek
Post by: John on November 09, 2013, 07:23:16 PM
Quote
@John, did you compile for Android using C for Android?

C4droid + SDL2
Title: Re: JADE - A Sneak Peek
Post by: AIR on November 09, 2013, 07:29:57 PM
@Air, Vim will be too much to learn. I installed SciTe, I am familiar with it from using oxgenBasic. It is a nice GUI based, small but powerful text editor.

Vim isn't only commandline, there's gVim for both Windows and Linux.  A Windows Portable version can be found at: http://portableapps.com/apps/development/gvim_portable


That site has a bunch of other portable stuff that I run off of thumb drives, so all my apps/data are with me anywhere.

SciTe I used back when I was working on the Hotbasic Linux port.  I still use it on Windows when occasionally coding stuff in AutoIT3.

You might want to take a look at Geany (Portable Apps has that too, I have it on my thumb drive), which is a much more complete editor.

A.

Title: Re: JADE - A Sneak Peek
Post by: John on November 09, 2013, 07:35:52 PM
I use Ultra Edit for both Windows & Wine. gedit gets used for casual text editing and when in a console only environment, vi comes through.
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 09, 2013, 08:40:45 PM
I was looking at Geany, but it setup project files also, at least in the screenshots I looked through.
I guess I can play around with them all and see which works best. Thanks for the suggestions.
Title: Re: JADE - A Sneak Peek
Post by: AIR on November 09, 2013, 08:53:41 PM
I was looking at Geany, but it setup project files also, at least in the screenshots I looked through.

I don't use Project files in Geany.  See attached screenshot to see how I use it.
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 09, 2013, 08:56:06 PM
I got some recommendations on syntax changes that I see so far.

1.
Reason against:
DIM AS:  I don't see the need for this as C/C++:  type variable; is clear, short and sweet:  int a;  as opposed to DIM AS INTEGER a;

Reason for keeping:
If we supported Keywords that related to DIM, REDIM, CLEAR and ERASE for instance. But this day and age, we don't need them unless doing micro-controller coding, but then we would use C Basic instead. And C has malloc, realloc, calloc and free which matched BASIC's DIM, REDIM, CLEAR and ERASE and would be easy to wrap.

2.
Reason against:
BEGIN: I don't think we need it with any block that has its own ENDBLOCKTYPE Keyword. For example:
FUNCTION ENDFUNCTION, SUB ENDSUB, SELECT ENDSELECT and so on.

It should just be used in Blocks that have just END, so BEGIN  END

3.
Reason against:
CONSTRUCTOR and DESTRUCTOR:  These are too long and used often. CTOR and DTOR are nice short names that you see often.
CLASS and ENDCLASS match well with CTOR and DTOR in terms of readability, if you ask me.
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 09, 2013, 08:58:14 PM
I was looking at Geany, but it setup project files also, at least in the screenshots I looked through.

I don't use Project files in Geany.  See attached screenshot to see how I use it.

Looks nice, will definitely try it out, thanks for the nice screenshot AIR.
Title: Re: JADE - A Sneak Peek
Post by: AIR on November 09, 2013, 08:59:48 PM
Beauty of this approach is that you have a choice!

Those are just syntactic sugar for those that don't know about CTOR/DTOR etc.  Remember, this was originally supposed to be a way for BASIC programmers to slide over to C/C++.

So if you don't want to use them, you don't have to.  Normal C++ syntax will work as well.
Title: Re: JADE - A Sneak Peek
Post by: AIR on November 09, 2013, 09:03:23 PM
John asked me to post a pic of the SDL2 PONG Demo running on OSX.  See attachment.

Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 09, 2013, 09:03:44 PM
I will fork from my repo and try alternate sugar coating to see how it looks in actual code as to not mess up the Jade smooth way fork and main repo.
Title: Re: JADE - A Sneak Peek
Post by: AIR on November 09, 2013, 09:04:50 PM
Create a TESTING branch and mess around in there.  Easier to switch back and forth without extra clutter on your drive.
Title: Re: JADE - A Sneak Peek
Post by: John on November 09, 2013, 09:10:09 PM
@Kent - We are waiting to the Windows version of Pong. I have Linux and Android covered and AIR does OSX.

Quote
So if you don't want to use them, you don't have to.  Normal C++ syntax will work as well.

That is the simple truth. It's what your eyes are more comfortable viewing.
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 09, 2013, 09:12:31 PM
always nice to see screenshots, looks nice and brings back memories from how excited all of us got when we saw that game.

About Apple and Coding on Macs, I felt like a slave chained to Apple via itunes to do coding. I guess that is how they maintain the uniform and quality control to Apple customers, but it felt very strangling after coming from Windows.

About linux, man, I am having a heck of time installing SDL2. Arrggggg oooooffff.
SDL2 site about installing SDL on linux:
Linux:
Please contact your distribution maintainer for updates.

So I search the package manager nothing.
Then I do:
apt-get update
apt-cache search libSDL2
nothing... try
apt-cache search SDL2
find stuff from java

I guess I have to manually download each tar file and do it like you do on Windows. So no benefit there.
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 09, 2013, 09:15:22 PM
Ok John, I will work in Windows.

Probably safer for me and less hair loss, or of what is left-- keeping it from turning more grey :)
Title: Re: JADE - A Sneak Peek
Post by: AIR on November 09, 2013, 09:18:59 PM
I wrote a shell script to automate this.

Save this as "getSDL2.sh":

Code: [Select]
#!/bin/bash

FILES=(http://libsdl.org/release/SDL2-2.0.1.tar.gz
   http://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.0.tar.gz
   http://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.0.tar.gz
   http://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.12.tar.gz)
   

for FILE in ${FILES[@]};do
FNAME=$(basename $FILE)
echo "Downloading "$FNAME
wget $FILE
echo "Unpacking "$FNAME
tar xzvf $FNAME
FOLDER=${FNAME%.tar.*}
echo "Changing to "$FOLDER "And Compiling"
pushd $FOLDER
./configure && make && sudo make install
popd
echo
done

After saving it, you need to set it so it's executable:  chmod a+x getSDL2.sh

Copy or move it to a scratch folder, and run it like this:  sudo ./getSDL2.sh

All of this is done in a TERMINAL, no clicky-feely here.

A.
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 09, 2013, 09:27:31 PM
Thanks AIR will try in a moment...  Brilliant, it is working away as I edit this!!  THANKS.
You should put that on the web in a blog post or something or submit it to the SDL2 folks, they sure need this!


Updated: I got an error when getting SDL-ttf, probably a glitch in the internet. Will try again later.

Attached is JadeWinPong.jpg
Title: Re: JADE - A Sneak Peek
Post by: John on November 09, 2013, 10:30:26 PM
There you have it folks. All the major OSs running the same C++ program that looks like BASIC.

No one has joined the All BASIC mailing list or bothered to use the chat except AIR, Kent and I. (Aurel said HI) I wonder what everyone else is doing that is so much better?

Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 10, 2013, 12:51:42 AM
I'm a worrier and I know it is early in the adventure, but I think we need to nail down a name, because this project is really flying along and it is going to be something that a lot of people are going to find very interesting.

I like the name Jade, but there is another programming language by that name and usually when you see programming languages with a  J, you think of Java and/or some port from or to Java.

I thought Air++ would be cool, but searching tonight I came across Adobe AIR and a presentation about Adobe AIR++.
Clean is already taken. a search for Clear, came out OK and so did Clear++

Title: Re: JADE - A Sneak Peek
Post by: John on November 10, 2013, 12:54:28 AM
C++ BASIC

Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 10, 2013, 01:53:25 AM
I did a search for Basic++ and came up with this. It is interesting.
http://www.spiketronics.com/daten/xbpp.html

Got a start on SFML2 and Jade, but need to work on it a bit more before I upload it. But here is version 1 of how it looks.
Title: Re: JADE - A Sneak Peek
Post by: AIR on November 10, 2013, 07:38:12 AM
I'm a worrier and I know it is early in the adventure, but I think we need to nail down a name, because this project is really flying along and it is going to be something that a lot of people are going to find very interesting.

I like the name Jade, but there is another programming language by that name and usually when you see programming languages with a  J, you think of Java and/or some port from or to Java.

I thought Air++ would be cool, but searching tonight I came across Adobe AIR and a presentation about Adobe AIR++.
Clean is already taken. a search for Clear, came out OK and so did Clear++

I'm sorry, but those are just silly. ;D

It's important to state what THIS Jade is not:  A Programming Language.

What it is, is a Programming Aide.  A few custom c++ string wrapper functions I've written, and a bunch of #defines that gives the illusion of using a different syntax to code in c++.  That's all.

Once I make this available to the public (within the next week), I don't think the name will be a real issue.

Jade = "Jade's a Developing Experiment". I think that pretty much sums things up.

Just refer to it as J.A.D.E. and I think you'll be fine.  8)


On a different note:  Which license would you suggest that this be released under?  I'm leaning towards MIT or NCSA, which seem the least restrictive.  You can compare the different licenses at: http://opensource.org/licenses/category

A.
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 10, 2013, 11:31:39 AM
Well here is something else that came to me while sleeping and it stemmed from what you said before
Quote
Remember, this was originally supposed to be a way for BASIC programmers to slide over to C/C++.
That is all well and good, but now that we have been experimenting we have opened a door to many things. What about the people that use python, lua, and ruby, they are probably more in number than old basic users. And what about new people coming to c/c++, Jade has shown that we can offer wrappers for all of these folks.

So JADE as it is now is perfect for the original goal BASIC to C/C++.
But I think we could have more wrappers as you say that can bring more people the power of c/c++

I guess they could be all named differently, maybe there are different kind of Jade's, let me check... yeah there are different kind of Jades:
http://www.travelchinaguide.com/intro/arts/jade.htm  even nice shorter chinese names for them.

About licencing, I used MIT before and was happy with that.

I will make a nicer SFML2 demo then using JADE official syntax and then fork off a version with another type of Jade, for new comers to C++ from python, ruby and lua (less verbose, but still nice and Basicy)
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 10, 2013, 11:41:26 AM
To save you guys from having to read that whole article and pick out the names here is what I pulled out quickly:

Jade  Yu

Jadeite It contains an iron component which appears red, chromium that appears green, and many other colored types. Known as the 'king of jade', it is usually a more expensive type.

Nephrite Jade  according to color: white, grey, green, topaz, and black jade.

Serpentine jade  Xiu yu coloured in various shades of green. Usually serpentine jade is semi-transparent or even opaque like wax.

Lantian jade colors of yellow or light green
Nanyang jade also known as Dushan jade you will find rare purple, blue and red ones.

The reason I want to nail it down is I want to work on some graphics.

Do you have a color in mind for JADE, it seems to come in many colors AIR?
Title: Re: JADE - A Sneak Peek
Post by: John on November 10, 2013, 11:48:13 AM
Personally I'm more interested in what's in the box rather than how you wrap it and the pretty bow you use. If JADE is a naming issue than call C++ BASIC as a generic reference until AIR settles on an official name.

Title: Re: JADE - A Sneak Peek
Post by: AIR on November 10, 2013, 11:54:36 AM
Name your forks what you like, I'm sticking with JADE.

Focus on writing some code, instead of all this other stuff for now.

A.
Title: Re: JADE - A Sneak Peek
Post by: John on November 10, 2013, 12:31:31 PM
Quote
Name your forks what you like, I'm sticking with JADE.

Go AIR. I'll be hanging out here at ...

(http://www.jadeloungepdx.com/JadeLogo.png)
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 10, 2013, 12:40:18 PM
I guess I like to plan and build on steps.

A name is very important, but it is your project so, ok no logos or 3d then I won't waste my time since not important.

I'll be a good silent code monkey :)

Nice artwork John!
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 10, 2013, 01:55:07 PM
Here is SFML2 for Jade. I am attaching the latest version here. Just put the unzipped folder into your Jade folder: Jade/SFML2
Git is too confusing uploading, asking for pulls and all that stuff. It is great for getting the latest version however. I will use it that way.

removed source attachment as it has been added to Jade.
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 10, 2013, 06:21:48 PM
Air, wow-- how many libraries do you have installed in total? 1.FLTK, 2.WX, 3.SDL1, 4.SDL2...?
Title: Re: JADE - A Sneak Peek
Post by: AIR on November 10, 2013, 06:25:06 PM
The beauty of compiling from source is that they're just a "make uninstall" away from removal....

Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 10, 2013, 06:27:20 PM
ahhh I see thanks for the secret.
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 10, 2013, 09:15:29 PM
AIR, have you ever tried JUCE?  I have always drooled over it from what I read, but could never get it setup in Windows to use.
http://www.juce.com/features
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 10, 2013, 10:57:12 PM
FLTK in Linux Mint 15 virtual machine.
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 10, 2013, 11:23:38 PM
Jade WXWidgets in Linux Mint 15 VM.
Title: Re: JADE - A Sneak Peek
Post by: John on November 10, 2013, 11:24:34 PM
Been there, done that.

Where is the WINBox version?
Title: Re: JADE - A Sneak Peek
Post by: John on November 11, 2013, 09:51:46 AM
I'm going to be spending my time with the C BASIC side of this effort going forward. AIR has made outstanding progress with the C++ version called JADE. It would be great if others would join in and help bring JADE to a release state. Much of AIR's efforts can be shared with the C BASIC project.

I have found while converting the Wetspot II game to C BASIC that a SB script (eventually a C BASIC program) could do the conversion work and allow the C BASIC project to have a wider variety of examples to use and learn from. My hope is that Charles will find the time to continue with his C emitter project which is how C BASIC was born and provides the missing BASIC functionality that core C depends on external libraries for. I also plan to include the CERN CINT (C interpreter/debugger) as an integral part of the C BASIC solution.



Title: Re: JADE - A Sneak Peek
Post by: AIR on November 11, 2013, 11:42:21 AM
FLTK Windows Screenshot.

Compiled under MinGW32 with:
Code: [Select]
g++ -Os fltkdemo.cpp -I /c/Users/arivera1271/FLTK-WIN32/include/ -L /c/
Users/arivera1271/FLTK-WIN32/lib/ -lfltk -mwindows -lole32 -luuid -lcomctl32  -o fltkdemo-win


Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 11, 2013, 01:50:52 PM
BASIC programmers aren't going to really do any of the advanced C++ stuff, like OOP, Templates  and such.
Air has already shown JADE can work with any c/c++ library, so no need to keep adding more examples in my opinion.

I am going to start working on my fork that will be geared towards people coming from OOP type scripting languages
to C++ and for users like me who have been using C++, but want to work with soothing looking code and not has symbolic.
Title: Re: JADE - A Sneak Peek
Post by: kryton9 on November 11, 2013, 05:10:20 PM
Congrats AIR on the JADE release, hope people take the time to check it out.
Title: JADE - AIR C++ BASIC
Post by: John on April 16, 2015, 06:38:50 AM
James posted message about AIR's JADE project and I thought it might be helpful to mention this existing thread. I agree with James that JADE needs more attention.

Title: Re: JADE - AIR C++ BASIC
Post by: John on April 16, 2015, 06:43:07 AM
I think the work AIR has done with JADE (framework) and the KoolB BASIC translator married could be an interesting pair.

Quote from: James Fuller
Don't use guilt by association as a reason to not try it, because AIR is one outstanding coder.

I feel the same way about your fork of BCX. You were also a great programmer/contributor at one time until you joined the BBB. (Bitter BASIC Bunch)

Quote from: Paul Dunn
Didn't JRS start something like that a while ago? IIRC he abandoned it because he couldn't get it to work properly or some such.

Misinformed again Paul. You really need to let go of the past. The C BASIC (https://bitbucket.org/ScriptBasic/c-basic) project which JADE was a fork of, is standard equipment in Script BASIC (basext.h) to extend the already existing #define and macro syntax Peter Verhas instigated.
 
(http://kopozky.net/images/43.gif)
Title: Re: JADE - A Sneak Peek
Post by: AIR on December 19, 2018, 04:51:35 PM
Resurrecting this for a quick update:

I've wanted to implement a "FOR..IN" style loop that can be used over container types (like arrays).

Here is an example of it in use (you'll see the old FOR loop commented out):

Code: C
  1. /* CHANGE THIS PATH TO WHERE "jade.h" IS LOCATED */
  2. #include "jade.h"
  3.  
  4. MAIN
  5.         CSTRING s = "This is an example that should be split!";
  6.  
  7.         STRARRAY ret = SPLIT(s);
  8.  
  9.         //   FOR (UINT i = 0 TO i < ret.size() STEP i++) BEGIN
  10.         //          PRINT( ret[i] );
  11.         //   END
  12.  
  13.  
  14.         FOR (CSTRING tst IN ret) BEGIN
  15.                 PRINT(tst);
  16.         END
  17.        
  18.         RETURN 0;
  19. ENDMAIN

[riveraa@MPD /Users/Shared/src/Jade] $ ./split-test
This
is
an
example
that
should
be
split!


Much cleaner.

CURRENT JADE SOURCE (https://git.binarymagic.net/AIR/Jade.git)  This REQUIRES the "-std=c++11" flag to avoid nagging from the g++ compiler.

AIR.
Title: Re: JADE - A Sneak Peek
Post by: John on December 19, 2018, 06:10:07 PM
I would be lost in SB if SPLITA didn't exist.

Allowing a variable length delimiter is also handy.
Title: Re: JADE - A Sneak Peek
Post by: AIR on December 19, 2018, 07:16:01 PM
Code: C
  1. /* CHANGE THIS PATH TO WHERE "jade.h" IS LOCATED */
  2. #include "jade.h"
  3.  
  4. MAIN
  5.         CSTRING s = "Hello World! This is: JADE, splitting strings; using multiple delimiters! Just-for-you!";
  6.  
  7.         STRARRAY ret = SPLIT(s,".,:;!?-");
  8.  
  9.         FOR (CSTRING tst IN ret) BEGIN
  10.                 PRINT(tst);
  11.         END
  12.  
  13.         RETURN 0;
  14. ENDMAIN

Code: [Select]
Hello World
This is
JADE
splitting strings
using multiple delimiters
Just
for
you
Title: Re: JADE - A Sneak Peek
Post by: John on December 19, 2018, 07:27:10 PM
Cool but can you do more than one character at a time?

Code: ScriptBasic
  1. SPLITA xml BY "<food>" TO food
  2.  
Title: Re: JADE - A Sneak Peek
Post by: AIR on December 20, 2018, 01:41:20 AM
Code: C++
  1. /* CHANGE THIS PATH TO WHERE "jade.h" IS LOCATED */
  2. #include "jade.h"
  3.  
  4. MAIN
  5.         CSTRING s = "Hello World! This is JADE, splitting strings using strings delimiters! Just-for-you!";
  6.  
  7.         STRARRAY ret = SPLIT(s,"This is|strings|,|!");
  8.  
  9.         FOR (CSTRING tst IN ret) BEGIN
  10.                 PRINT(tst);
  11.         END
  12.  
  13.         RETURN 0;
  14. ENDMAIN

Code: [Select]
[riveraa@MPD /Users/Shared/src/Jade] $ g++ -std=c++11 split-test.cpp -o split-test
[riveraa@MPD /Users/Shared/src/Jade] $ ./split-test
Hello World
JADE
splitting
using
delimiters
Just-for-you

With this implementation, you can split on multiple delimiters, both full word and single characters, as long as they are separated by the pipe symbol.  You can also split using REGEX syntax if you want to really go crazy.

Code: C++
  1.         s = "Thu Dec 20 04:22:24 EST 2018";
  2.  
  3.         ret = SPLIT(s,"\\D+");
  4.  
  5.         FOR (CSTRING tst IN ret) BEGIN
  6.                 PRINT(tst);
  7.         END    

The snippet above tells SPLIT to split on all non-numeric items (words and punctuation), returning only numbers:

Code: [Select]
20
04
22
24
2018



AIR.
Title: Re: JADE - A Sneak Peek
Post by: AIR on December 23, 2018, 10:25:43 PM
I implemented a REPEAT$ function, with an optional delimiter.

Code: C
  1. #include "jade.h"
  2.  
  3. MAIN
  4.     PRINT(REPEAT$("ABC",3));
  5.     PRINT(REPEAT$("ABC",3,", "));
  6.     PRINT(REPEAT$("ABC",3,"\t"));
  7. END
  8.  

$ ./repeat
ABCABCABC
ABC, ABC, ABC
ABC   ABC   ABC


AIR.
Title: Re: JADE - A Sneak Peek
Post by: John on December 24, 2018, 12:06:39 AM
That's a nice combo of features!
Title: Re: JADE - A Sneak Peek
Post by: AIR on December 26, 2018, 07:32:33 PM
Added an option to create a static lib (libjade.a), which will speed up compilation.

It's located in the 'jadelib' folder in the repo.  You will need to use the 'jade.hpp' file located in that folder if you choose to use the static lib.

AIR.
Title: Re: JADE - A Sneak Peek
Post by: John on December 27, 2018, 01:23:15 AM
Where is the repo for JADE?