orx Console

edited April 2012 in Help request
I know that one can easily display messages and whatnot with the orx console, despite that I'd like to disable the console window and only show the main build .exe . I'm using visual studio and codelite if thats of any reference. Any help would be appreciated, and thanks :laugh: .

Comments

  • edited April 2012
    Yep, you want to make a console-less version of your game.
    While it's a default behavior on linux/osx, you'll have to do some work for windows. Of course, it's different with mingw/gcc and visual studio, would be too simple otherwise! ;)

    With mingw/gcc: add the -mwindows parameter to the linker command line, that should do the trick.

    With visual studio: right click on the project->properties->Linker->System and set the SubSystem field to Windows.
    When the SubSystem is set to Windows, your main() function won't get called, instead a WinMain() function will get called (whose prototype is defined here).

    From it, instead of calling orx_Execute(argc, argv, Init, Run, Exit) you'll need to call orx_WinExecute(Init, Run, Exit).
  • edited April 2012
    Hey alright, awesome stuff, just have to re-setup a couple things in my project, that's fairly easy, thx iarwain
  • edited April 2012
    Hey, my pleasure!

    Then will come the fun to embed your own icon for the executable. :D

    But I believe there's already a thread that has been started by sonicbhoc on that topic. :)
  • edited April 2012
    Yeah... and I'm still lost! :P

    I'll just wait for Iarwain to add an orx way to do it... I don't feel like fooling around with GLFW.
  • edited April 2012
    Ahah, woops.

    Well, unfortunately the process is widly different on all the platforms and happens outside of orx most of the time.

    What could be generalized in orx would be the option of changing the top left icon of a running game window for windows only. Doesn't sound all that great, heh?

    That being said, we could add tutorials on the wiki for all the different platforms. I know that faistoiplaisir successfully did it for Android and I know how to do it for windows, os x and iOS, so that could be a start. For now, I'll try focusing on coding the command system though (the timeline module is already in and working).
  • edited April 2012
    Cool. One step at a time, eh?
    Looks like when I get to making my first personal project, I'll have to check out how GLFW does that window icon... thing.
  • edited April 2012
    In terms of atleast windows icons I know that resource hackers such as res hack or anolis resourcer work great for adding little things like icons, and as far as other platforms i'm fairly sure there's an os equivalent
  • edited April 2012
    You don't need the ressource hacker tool for an icon in windows. Just make a .rc file like this :
    IDI_ICON1 ICON "blabla.ico"
    GLFW_ICON ICON "blabla.ico"
    
    and drag and drop into visual studio. The icon needs to be in the source directory and it needs to be a real .ico (not a .bmp that you renamed :laugh:)

    I think the first line will make the default icon and the glfw line will make the small icon in the top left corner of the window. You can add more lines to add more icons to chose from when you make an shortcut.
  • edited April 2012
    If I'm not using visual studio, how do I do it?
  • edited April 2012
    I don't know but it should work if you add the .rc to your project. Google the IDE you're using and see how to import the ressource file.
  • jimjim
    edited April 2012
    I know it is already answered. Back in glut days I used to add this line to my source code to hide the console window, but it works with ORX too and you don't need to change the main() function to WinMain() :)
    #pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
    

    But it is windows only.
  • edited April 2012
    Ah yep, there's still the option ok changing the entry point, but in that case I don't know what gets sent as argc/argv to the main function. Any details on that, jim?

    I'm asking as orx will use that to define the working directory and the main config file name.
  • jimjim
    edited April 2012
    Sorry, I forgot to mention that, nothing is needed to change in main function. This is my main function and it works without console window :)
    #pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
    int main( int argc, char** argv )
    {
    	orx_Execute( argc, argv, StandAlone::Init, StandAlone::Run, StandAlone::Exit );
     
    	return 0;
    }
    
  • edited April 2012
    Excellent, good to know! :)
Sign In or Register to comment.