Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
GIDEROS C++ — Gideros Forum

GIDEROS C++

MoKaLuxMoKaLux Member
edited November 2022 in Suggestions & requests
How are you doing :) ?
I am trying to help developing Gideros o:) so I got myself into playing with c++ (I only touch the win32 part of Gideros to start with).
I cannot get LFS working on win32 export so I implemented this in the application:get() (for win32 only):
        }else if (strcmp(what, "pathfileexists") == 0) // new 20221116 XXX
        {
            std::wstring path = ws(args[0].s.c_str());
            int m = 0; // modes: 0=Existence only, 2=Write-only, 4=Read-only, 6=Read and write
            if (args.size() >= 2) {
                m = args[1].d;
                if (m != 0 || m != 2 || m != 4 || m != 6)
                    m = 0;
            }
            int retValue = _waccess(path.c_str(), m); // 0 = OK, else -1
            if (retValue == 0) {
                r.type=gapplication_Variant::DOUBLE;
//              r.d=retValue; // 0 = OK, else -1, not so good in lua!?
                r.d=1; // for lua 1=OK otherwise nil, looks better?!
                rets.push_back(r);
            }
            /*------------------------------------------------------------------*/
It checks if a folder or a file exists. Return 1 if true or nil.
my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
Tagged:

Comments

  • MoKaLuxMoKaLux Member
    edited November 2022
    luau usage:
    if application:get("pathfileexists", "c:\\temp") == nil then
    	-- folder doesn't exist create it
    	application:set("mkDir", "c:\\temp")
    end
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • MoKaLuxMoKaLux Member
    edited November 2022
    with modes:
    application:get("pathfileexists", "c:\\temp\\mytext.txt", 6) -- rw, result = 1 OK

    Likes: talis

    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
    +1 -1 (+1 / -0 )Share on Facebook
  • MoKaLuxMoKaLux Member
    edited November 2022
    implemented and tested pathfileexists for win64 (Qt) OK :) MAC I cannot do :'(

    Likes: talis

    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
    +1 -1 (+1 / -0 )Share on Facebook
  • MoKaLuxMoKaLux Member
    edited November 2022
    trying to implement win32 mouse cursor but it doesn't work :-(
        else { // SET
            if (strcmp(what, "cursor") == 0)
            {
            	/* TODO */
                std::string &shape = args[0].s;
                HCURSOR cursor;
                if (shape == "arrow") {
                    cursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
                    SetCursor(cursor);
                } else if (shape == "upArrow") {
                    printf("** cursor uparrow\n"); // LUA DEBUG OK BUT ARROW SHAPE DOESN'T CHANGE :-(
                    cursor = LoadCursorA(NULL, (LPCSTR)IDC_UPARROW);
                    SetCursor(cursor);
                }
              /*------------------------------------------------------------------*/
            }else if (strcmp(what, "windowPosition") == 0)
    How do I access wndclass from win32_example/win32.cpp please?
      WNDCLASSEX  wndclass ;
      int ret;
    ...
      wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
    ...
      RegisterClassEx (&wndclass) ;
    PS: also tried to add min max app size but failed :o
    PS2: I personaly don't use those functions (cursor and min max) for win32 for now so I leave them as is.
    PS3: spoiler alert ... hgy29 added gideros gltf animations :p

    Viva Gideros luau c++ :)
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • MoKaLuxMoKaLux Member
    edited November 2022
    Is CBump working as it should?
    For example I see in the c++ code some TODO, do they alter how bump.lua is working?
    static bool rect_getSegmentIntersectionIndices(double x, double y, double w,
    		double h, double x1, double y1, double x2, double y2, double &ti1,
    		double &ti2, double &nx1, double &ny1, double &nx2, double &ny2) {
    	//ti1, ti2 = ti1 or 0, ti2 or 1 TODO
    	double dx = x2 - x1;
    	double dy = y2 - y1;...
    static bool rect_detectCollision(double x1, double y1, double w1, double h1,
    		double x2, double y2, double w2, double h2, double goalX, double goalY,
    		Collision &col) {
    	//goalX = goalX or x1 TODO
    	//goalY = goalY or y1
     
    	double dx = goalX - x1, dy = goalY - y1;...
    Should I try this:
    	//ti1, ti2 = ti1 or 0, ti2 or 1 TODO
    	if (ti1 == NULL)
    		ti1 = 0;
    	if (ti2 == NULL)
    		ti2 = 1;
    or it is not necessary? the TODOs are misleading me :*
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
Sign In or Register to comment.