How to resolve the algorithm Hello world/Graphical step by step in the Jsish programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Hello world/Graphical step by step in the Jsish programming language

Table of Contents

Problem Statement

Display the string       Goodbye, World!       on a GUI object   (alert box, plain window, text area, etc.).

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Hello world/Graphical step by step in the Jsish programming language

Source code in the jsish programming language

extension JsiAgarGUI = { // libAgar GUI from Jsi
    /*
      Alert popup, via libAgar and Jsish CData
      tectonics:
        jsish -c JsiAgar.jsc
        gcc `jsish -c -cflags true JsiAgar.so` `agar-config --cflags --libs`
        jsish -e 'require("JsiAgar"); JsiAgar.alert("Goodbye, World!");'
    */
    #include 
    #include 

    /* Terminate on close */
    void windDown(AG_Event *event) {
        AG_Terminate(0);
    }

    function alert(msg:string):void { // Display a JsiAgar windowed message
        /* Native C code block (in a JSI function wrapper) */
        AG_Window *win;
        AG_Box *box;

        Jsi_RC rc = JSI_OK;

        if (AG_InitCore(NULL, 0) == -1 || AG_InitGraphics(0) == -1) return (JSI_ERROR);
        AG_BindStdGlobalKeys();

        win = AG_WindowNew(0);

        box = AG_BoxNew(win, AG_BOX_VERT, 0);
        AG_LabelNewS(box, AG_LABEL_HFILL, msg);
        AG_ButtonNewFn(box, AG_BUTTON_HFILL, "Ok", AGWINDETACH(win), "%p", win);

        AG_SetEvent(win, "window-detached", windDown, NULL);
        AG_WindowShow(win);

        AG_EventLoop();

        AG_DestroyGraphics();
        AG_Destroy();

        return rc;
    }
};


  

You may also check:How to resolve the algorithm Elementary cellular automaton/Random number generator step by step in the Julia programming language
You may also check:How to resolve the algorithm Gapful numbers step by step in the Tcl programming language
You may also check:How to resolve the algorithm Rosetta Code/Fix code tags step by step in the PureBasic programming language
You may also check:How to resolve the algorithm Hash join step by step in the PureBasic programming language
You may also check:How to resolve the algorithm Mouse position step by step in the PureBasic programming language