Author Topic: nSDL showCursor  (Read 2753 times)

0 Members and 1 Guest are viewing this topic.

Offline Silversircel

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
nSDL showCursor
« on: September 26, 2014, 10:03:59 am »
Hi,

i need to display the mouse cursor in my app.
But it seem "SDL_ShowCursor(SDL_ENABLE)" does not do the job.

quick example:
Code: [Select]
int main()
{
    SDL_Surface *screen;
    bool run = true;
    SDL_Rect rect;
    Uint32 color;
   
    rect.w = 320;
    rect.h = 240;
    rect.x = 0;
    rect.y = 0;
   
    //Show Cursor
    SDL_ShowCursor(SDL_ENABLE);
   
    SDL_Init(SDL_INIT_VIDEO);
    screen = SDL_SetVideoMode(320, 240, has_colors ? 16 : 8, SDL_SWSURFACE);
   
   
    color = SDL_MapRGB(screen->format, 255, 0, 0);
   
    while(run)
    {
        SDL_Event event;
        if(SDL_PollEvent (&event))
        {
            switch(event.type)
            {
                case (SDL_QUIT):
                {
                    run = false;
                }break;

                case(SDL_KEYDOWN):
                {
                    switch(event.key.keysym.sym)
                    {
                        case(SDLK_ESCAPE):
                        {
                            run = false;
                        }break;
                    }
                }break;
            }
        }
       
        SDL_FillRect(screen, &rect, color);
        SDL_Flip(screen);
    }
}
Cursor is not shown. Does anybody knows how to enable the cursor?

Thanks ^^

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: nSDL showCursor
« Reply #1 on: September 27, 2014, 09:30:43 am »
I'm not too familiar with nSDL but I assume it doesn't have cursor support. Currently there is no way to use the native nucleus cursor in ndless apps, if you mean that.
But even if nSDL has its own touchpad mouse code, I'd assume you'd have to set a cursor bitmap first.