Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove console window with SDL application

Tags:

c

gcc

mingw

sdl

I have this code:

#include <stdio.h>
#include "SDL/SDL.h"

SDL_Surface *screen = NULL;

int main(int argc, char* args[]) {

    SDL_Init(SDL_INIT_EVERYTHING);

    screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);

    SDL_Delay(2000);

    SDL_Quit();
    return 0;
}

And I compile using this command line (Mingw is my compiler):

gcc source.c -o bin.exe -lmingw32 -lSDLmain -lSDL

But when I run the application, although a nice graphical box shows up, an ugly console window also shows up. How can I remove this, to leave just a true graphical application?

Also, how can I revert the mouse back to default? It seems to be using this ugly custom mouse when I hover over the window. I read here that I have to do this myself:

http://www.gamedev.net/topic/297710-change-mouse-cursor-sdl/

Is this really true? Is there no inbuilt functionality to disable using the custom black cursor?

like image 736
Jimmay Avatar asked Sep 02 '26 02:09

Jimmay


1 Answers

Compiling with -mwindows fixed it.

like image 98
Jimmay Avatar answered Sep 03 '26 17:09

Jimmay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!