Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Feature parity for win32 version — Gideros Forum

Feature parity for win32 version

keszeghkeszegh Member
edited October 14 in General questions
In long term win32 version should be kept on par with the qt version of win exported app. For this reason i thought that it would be good to have a place where the differences (i.e., what is missing from win32 export) are collected.

Let me start with a few ones, the first of which is hopefully easy to add to win32 version:
1. application:setFullScreen() DONE (version coming after 2022.09)
2. multiple screens with Screen class
3. media plugin
4. camera plugin
5. midi plugin

if you write me more, i can add it, also i can state it DONE whenever it is added to win32 version too.
+1 -1 (+3 / -0 )Share on Facebook
«1

Comments

  • I think it would be best if these where in the github issues section - if you create an issue then it can be ticked off when fixed?
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • keszeghkeszegh Member
    edited August 2017
    sure, also at github, but here we could collect them together to see what is missing, if someone starts to make a desktop app he can check quickly if he can get all the features he needs. and also one can upvote here features.

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
  • john26john26 Maintainer
    edited August 2017
    Firstly I'm glad people are using the win32 version. When I first programmed it, some people said it was a waste of time as it offered few/no advantages over the Qt-based desktop version. Since then of course, many other people have added to my original code so I can't claim ownership anymore.

    I think it's a very good idea to maintain a list of what features are lacking from the win32 version somewhere. Just having bug fixes in Github doesn't group these things together but this forum thread can easily get lost also. In the documentation there are currently icons showing what features work where (eg lots of things work on iOS only or Android only) so maybe that's the best place. We will need another win32 icon. And while we're at it we should say what works on the other new OS's like WinRT....

    As far as media plugin is concerend I can't help as I don't know about these things. It seems some of the features can be provided by MS WIA system. If anyone out there is an expert on this, please send us a pull request. :-)

    https://msdn.microsoft.com/en-us/library/windows/desktop/ms630368(v=vs.85).aspx
    https://msdn.microsoft.com/en-us/library/ms629859(v=vs.85).aspx

    "multiple screens with Screen class". This was done by @hgy29, can you fix this Nico?

    I think fullscreen kind of works except there is still a Windows border around the full-screen window. Is that the issue?
  • @john26, evidently win32 version is very important. while the qt version works well, using it may have licensing issues. actually when i realized this difference of the exports, it struck me that for mac there is not even an alternative to qt currently.

    so yes, i believe win32 and a native mac export should be priorities, otherwise gideros does not fully have desktop exports.

    i think it's a good idea to put in reference for each class all the platform it is supported on.

    about the fullscreen issue, for me setting application to fullscreen does not have any effect at all, so it's not just a border-issue.

    Likes: john26, antix, MoKaLux

    +1 -1 (+3 / -0 )Share on Facebook
  • MoKaLuxMoKaLux Member
    edited September 21
    keszegh said:

    In long term win32 version should be kept on par with the qt version of win exported app. For this reason i thought that it would be good to have a place where the differences (i.e., what is missing from win32 export) are collected.

    Let me start with a few ones, the first of which is hopefully easy to add to win32 version:
    1. application:setFullScreen()
    2. media plugin
    3. multiple screens with Screen class
    4. camera plugin

    if you write me more, i can add it, also i can state it DONE whenever it is added to win32 version too.

    5- LFS
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • hgy29hgy29 Maintainer
    edited September 21
    MoKaLux said:

    5- LFS

    lfs is actually compiled for win32
    EDIT: Oh, it wasn't referenced in the gplugin file. I fixed that, luasocket and sqlite were missing too: https://github.com/gideros/gideros/commit/f4150e3c2f0e9a48e32493d2d3c1e5db3a0d1257

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • @hgy29 , great, i've removed lfs from the list then.

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • MoKaLuxMoKaLux Member
    edited October 2
    if application:getDeviceInfo() == "Windows" and not application:isPlayerMode() then
    	application:set("windowPosition", (1920 - myappwidth) * 0.5, 64)
    --	application:set("windowModel", "onlyClose") -- crashes the app
    ----	application:set("windowModel", "noMaximize") -- doesn't work for me even on win64!
    	application:set("windowTitle", "GIDEROS GAME")
    	application:set("minimumSize", myappwidth, myappheight)
    	application:set("maximumSize", myappwidth, myappheight)
    	application:set("windowColor", 0, 0, 0)
    end
    None of the above are working on w32 :'(
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • @MoKaLux there was also "win32" tag before, it still existed or not i am not sure but can you try.
    device={application:getDeviceInfo()}
    print(device[1])
    print(device[2])
    print(device[3])
    print(device[4])
    print(device[5])
    if device[1]=="Win32" then 
    win32=true
    end
    Also you can look other tags from device[...] array.

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • MoKaLuxMoKaLux Member
    edited October 8
    @talis thank you but the goal is to make them work for win32 as well. I have my app which is not full screen (1200 * 900) and I want to position it somewhere about the middle of the screen with application:set("windowPosition", (1920 - myappwidth) * 0.5, 64). That works fine in windows 64 but not win32 and I am trying to port my app to win32. In win32 the app is always at 0, 0 :'(

    I am trying to fix it :)
    for reference
    - https://stackoverflow.com/questions/49608313/change-window-position-on-show-in-qt
    ...
    wrong references as win32 has nothing to do with Qt
    Sorry for posting here but I find the forum a great storing option ;)
    https://github.com/gideros/gideros/blob/master/libgid/src/qt/platform-qt.cpp#L197
    https://github.com/gideros/gideros/blob/master/libgid/src/win32/platform-win32.cpp#L88
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • hgy29hgy29 Maintainer
    Just had a look at win32 code to discover it has support for fullscreen and setting window size: https://github.com/gideros/gideros/blob/master/libgid/src/win32/platform-win32.cpp#L80
    I wonder why it doesn't work, will have a look.

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • hgy29hgy29 Maintainer
    So I gave some time today to win32 export, and there was a lot more issues than I thought. I fixed a few ones already: https://github.com/hgy29/gideros/commit/2807eeb24916aa0b8e8feef47339eb28bb69e445

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • MoKaLuxMoKaLux Member
    edited October 8
    thank you hgy29 for taking the time to look into this o:)
    What I understand is:
    1. Qt has nothing to do with win32
    2. win32 is built using mingw32 with g++? (I cannot get this working :s )
    3. after building Gideros Studio, we need to call make –f scripts/Makefile.gid win32.install to build the win32 export template
    Question, do we need those as well for win32 or are they for winRT export template?
    - FXC="/c/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x86/fxc.exe"
    - MSBUILD="/c/Program Files/Microsoft Visual Studio/2022/Community/MSbuild/Current/Bin/MSBuild.exe"

    Thank you :(

    EDIT: quote "Just had a look at win32 code to discover it has support for fullscreen and setting window size" setting window size works fine, it is the positionning that isn't implemented :(
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • hgy29hgy29 Maintainer
    @MoKaLux, to build Gideros for win32, you don’t need any external tool beside MinGW64 environment. I have updated the wiki with the new list of packages needed for MinGW64. And yes, win32 has nothing to do with QT or UWP.

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • MoKaLuxMoKaLux Member
    edited October 10
    keszegh said:

    In long term win32 version should be kept on par with the qt version of win exported app.
    1. application:setFullScreen()

    Great news application:setFullScreen() works in win32 :)
    -- fullscreen
    local isfullscreen = false
    stage:addEventListener(Event.KEY_DOWN, function(e)
    	-- modifier
    	local modifier = application:getKeyboardModifiers()
    	local alt = (modifier & KeyCode.MODIFIER_ALT) > 0
    	-- switch full screen
    	if (alt and e.keyCode == KeyCode.ENTER) or e.keyCode == KeyCode.F then
    		isfullscreen = not isfullscreen
    		application:setFullScreen(isfullscreen)
    	end
    end)
    When you press the F key it goes full screen and when you press again it is restored to its last position :)
    What is not working is with modifier: ALT+ENTER doesn't switch to fullscreen (yet).

    EDIT: my naîve attempt which kinda work :p
    win32/platform-win32.cpp;
    int getKeyboardModifiers() {
    	int m = 0;
    	if (GetKeyState(VK_SHIFT) < 0) m |= 1;
    	if (GetKeyState(VK_LMENU) < 0) m |= 2; // LEFT ALT, also VK_RMENU & VK_MENU
    	if (GetKeyState(VK_CONTROL) < 0) m |= 4;
    	return m;
    //	return 0;
    }
    EDIT2: trying to set windows position :s (hard coded) doesn't work!
    //    SetWindowPos(hwndcopy,HWND_TOP,0,0,rect.right-rect.left, rect.bottom-rect.top, SWP_NOMOVE);
        SetWindowPos(hwndcopy,HWND_TOP,64,128,rect.right-rect.left, rect.bottom-rect.top, SWP_NOMOVE);
    for reference:
    SWP_NOSIZE
    https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowpos
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • hgy29hgy29 Maintainer
    @MoKaLux, thanks for trying to fix win32, make a PR with your changes or let me integrate your findings. I will try to fix that resize issue (probably OpenGL stuff need to be recreated after resize, it is the case on other platforms). I also found an issue with miuse coordinates on high density screens, I will try to find how to get the scale factor to apply.

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • hgy29hgy29 Maintainer
    edited October 9
    Re screen turning to dark: it seems to be a 3D shader issue, some shader parameters are lost during the resize, I'll fix that.
    EDIT: Less easy than I thought... An easier fix is to call Lighting.setLight() and others similar functions that set full scene constants in shaders after an APPLICATION_RESIZE event

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • MoKaLuxMoKaLux Member
    edited October 10
    For some reason the ALT modifier (aka MENU) is not working :o
    C:\dev\gideros_hgy29\libgid\src/platform-win32.cpp
    int getKeyboardModifiers() {
    	int m = 0;
    	if (GetAsyncKeyState(VK_SHIFT))
    		m |= GINPUT_SHIFT_MODIFIER; // 1
    	if (GetAsyncKeyState(VK_MENU)) // ALT, VK_LMENU VK_RMENU VK_MENU
    		m |= GINPUT_ALT_MODIFIER; // 2
    	if (GetAsyncKeyState(VK_CONTROL))
    		m |= GINPUT_CTRL_MODIFIER; // 4
    	return m;
    }
    In the lua code below, pressing SHIFT|CTRL and ENTER are working ok :*
    -- fullscreen
    ...
    	if (ctrl and e.keyCode == KeyCode.ENTER) or (alt and e.keyCode == KeyCode.ENTER) or e.keyCode == KeyCode.F then
    		isfullscreen = not isfullscreen
    		application:setFullScreen(isfullscreen)
    	end
    end)
    CTRL+ENTER = FULLSCREEN OK, F = FULLSCREEN OK, ALT+ENTER = FULLSCREEN NOT OK :/
    PS: I open the gideros project folder in VSCode which helps a TON learning c++ :p

    EDIT: I have a question, do we need to modify the files which are in the win32_example folder? I am a bit confused here :*
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • MoKaLuxMoKaLux Member
    edited October 10
    attempt to set windows pos using application:set(setting, value) ;)
     if (strcmp(what, "cursor") == 0)
        {
            /*------------------------------------------------------------------*/
        }else if (strcmp(what, "windowPosition") == 0)
        {
          printf("*** trying to set window pos through set");
    //        MainWindow::getInstance()->move(arg1,arg2);
            //SetWindowPos(hwndcopy, 0, 128, 128, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
            SetWindowPos(hwndcopy,HWND_TOP, 128,128, 320,480, SWP_NOMOVE);
            /*------------------------------------------------------------------*/
        }else if (strcmp(what, "windowSize") == 0)
    In the console, I can see the code is executed:
    setWindowSize: 320 x 480. hwndcopy=000607fc
    X SetWindowPos: 336 519
    ***     Win32
    *** g_checkStringProperty*** g_checkStringProperty*** trying to set window pos through set
    libpng warning: iCCP: known incorrect sRGB profile
    But my SetWindowPos call doesn't work :s :)
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • hgy29hgy29 Maintainer
    @MoKaLux, I have pushed a lot of changes to win32 code right now. A lot (but not all) of application setters/getter are now implemented (I don't know if they work though).

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • MoKaLuxMoKaLux Member
    edited October 11
    I cloned your repo in a new folder but it won't build Gideros Studio :(
    make –f scripts/Makefile.gid qtapp.install
    cp libgid/external/openal-soft-1.17.2/include/AL/alc.h ./Sdk/include/AL
    ...
    cp 2dsg/*.h 2dsg/gfxbackends/*.h luabinding/*.h libgid/include/*.h ./Sdk/include/gideros
    cp libgideros/*.h emscripten/cJSON.h ./Sdk/include/gideros
    mkdir -p ./Sdk/lib/desktop
    make: *** No rule to make target 'Sdk/lib/desktop/libgideros.a', needed by 'sdk.qtlibs'.  Stop.
    I am looking into it ;)
    learning Gideros internals :o
    EDIT: I restarted from scratch and it almost built Gideros Studio but failed at the very end :o with a bunch of errors/warnings:
    EDIT2: I switched back to branch Commits on Oct 9, 2022 and I can build Gideros Studio and win32 template. Lesson learned, when you have "errors" (with all the respect due to c++ gurus) in your code it won't build :p
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • hgy29hgy29 Maintainer
    Yes, I am afraid my own branch is often unstable, since I use it to save my wip no matter if everything works or not

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • MoKaLuxMoKaLux Member
    edited October 12
    oh la la c++, I can now build Gideros and win32 export template :)
    Example for reference:
    C:\dev\gideros_hgy29\libgid\src\win32\platform-win32.cpp
    void g_setProperty(const char* what, const char* arg){
    //    QString argGet = QString::fromUtf8(arg);
        std::string argGet = arg;
        int arg1 = 0;
        int arg2 = 0;
        int arg3 = 0;
        std::string argString = "";
     
        if ( g_checkStringProperty(true,what)){
            argString = argGet;
    //        argString.replace("\\","\\\\");
    //        std::replace(argString.begin(), argString.end(), "\\", "\\\\");
        }else{
    //        QStringList arrayArg = argGet.split("|",Qt::KeepEmptyParts);
    //        std::vector split = 
    //        arg1 = arrayArg.at(0).toInt();
    //        arg2 = arrayArg.at(1).toInt();
    //        arg3 = arrayArg.at(2).toInt();
        }
     
      if (strcmp(what, "windowPosition") == 0)
      {
    //    if (args.size()>=2) {
          printf("*** windowPosition X ***");
    //    SetWindowPos(wnd,HWND_TOP,rect.left,rect.top, rect.right-rect.left, rect.bottom-rect.top, SWP_NOSIZE);
    //      SetWindowPos(hwndcopy,0,args[0].d,args[1].d,0,0,SWP_NOSIZE);
    //      }
      }else if (strcmp(what, "windowSize") == 0)
      {
      }
    }
    The console prints my logs ok. Next steps are to translate Qt to c++ :#
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • MoKaLuxMoKaLux Member
    edited October 12
    EDIT: great success! I can set the window position :o but it's hard coded for now :p
      if (strcmp(what, "windowPosition") == 0) // I should move the windows here, like we do in platform-qt.cpp!
      {
    //    if (args.size()>=2) {
          SetWindowPos(hwndcopy,0,128,128,0,0,SWP_NOSIZE);
      }else if (strcmp(what, "windowSize") == 0)
      {
    Viva Gideros c++ :)

    Question: what is the folder win32_example for? I change code inside but it seems I don't have to! can we delete it :* ?

    EDIT2: I have added a wiki page where anyone can write c++ tips for Gideros Studio development. I posted the code that I have so far https://wiki.gideros.rocks/index.php/CPlusPlus_for_Gideros_Studio_Help
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • hgy29hgy29 Maintainer
    I have fixed building QT with my own gideros repo. I still need to check other platforms (android, ios, etc) do build before pushing to main gideros repo, but for playing with win32 it should be ok now

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • hgy29hgy29 Maintainer
    win32_example holds the main code for win32 export. It should be renamed to win32 I think, but not deleted

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • MoKaLuxMoKaLux Member
    edited October 12
    thank you hgy29 for your time. I am a beta tester ;)
    I have tested the following and they are ok (the ones not implemented won't crash the app):
    if (application:getDeviceInfo() == "Windows" or application:getDeviceInfo() == "Win32") and not application:isPlayerMode() then
    	print(application:get("screenSize")) -- OK !!!
    	print(application:get("documentDirectory")) -- OK
    	application:set("windowPosition", (1920 - myappwidth) * 0.5, 64) -- OK
    	application:set("windowModel", "onlyClose") -- WIP
    	application:set("windowTitle", "GIDEROS PLATFORMER CBUMP TECS") -- OK
    	application:set("minimumSize", myappwidth, myappheight) -- WIP
    	application:set("maximumSize", myappwidth, myappheight) -- WIP
    	application:set("windowColor", 0, 0, 0) -- WIP
    end
    This is just AWESOME o:)

    For some reasons ALT doesn't work for me on win32 but it works fine in Qt win :/

    Issue with win32 LFS :( when I try this code the app crashes:
    local lfs = require "lfs"
    local err = lfs.chdir("c:/") -- doesn't crash with "c:" but won't change folder
    print("***", lfs.currentdir(), "XXX", err)
    the error is:
    *callFile* stack NOT ok begin:1 end:18 delta:-1
    I am looking into those but I am a c++ noob ;)

    Thank you very much hgy29 for all the work and the time you put into Gideros

    Edit: don't worry too much about the folder win32_example ;-)
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
  • MoKaLuxMoKaLux Member
    edited October 13
    another failed attempt :s
    	#include ShlObj.h
    ...
    	}else if (strcmp(what, "directory") == 0)
            {
    /* TODO*/
                printf("*** FOLDERID_Documents ***");
                PWSTR ppszPath; // variable to receive the path memory block pointer
                HRESULT hr = SHGetKnownFolderPath(FOLDERID_Documents, 0, NULL, &ppszPath);
    //            std::wstring myPath;
                wchar_t myPath[1024];
                if (SUCCEEDED(hr)) {
    //                myPath = ppszPath; // make a local copy of the path
                    myPath = us(ppszPath); // make a local copy of the path
                    r.type=gapplication_Variant::STRING;
                    r.s=us(myPath);
                    rets.push_back(r);
                }
                CoTaskMemFree(ppszPath); // free up the path memory block
              /*------------------------------------------------------------------*/
    error: libgid/src/win32/platform-win32.cpp:411:24: error: incompatible types in assignment of 'std::string'
    {aka 'std::__cxx11::basic_string'} to 'wchar_t [1024]'
    EDIT: I don't think I should be posting my failed attempts here :D
    EDIT2: more useful info :)
    	application:set("cursorPosition", 0, 0) -- OK
    	print(application:get("cursorPosition")) -- OK
    	application:set("clipboard", "hello, Gideros!") -- OK
    	print(application:get("clipboard")) -- OK
    my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories
Sign In or Register to comment.