Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
79 user(s) are online (69 user(s) are browsing Forums)

Members: 1
Guests: 78

Caras, more...
Support us!
Recent OS4 Files
OS4Depot.net
Report message:*
 

Re: SDL1 open issues

Subject: Re: SDL1 open issues
by kas1e on 2018/1/14 8:53:24

@Capehill
Yep, trying only width as well, same.

Anyway, done simple test case with main code as in grafx, and while test case can be wrong , it show kind of same distortion as we have in the grafx.

I.e. it didn't show "the SDL 1 pixel transparent cursor" as intendent by code, but instead some garbled stuff of 16x16 area or so. On win32 that code works correctly,

#include <SDL/SDL.h>

int mousexmousey;
static 
SDL_Cursorcur NULL;
static 
uint8_t cursorData 0;


SDL_Surfaceinit_sdl(int widthint height)
{
    
SDL_Init(SDL_INIT_VIDEO);
    return 
SDL_SetVideoMode(widthheight0SDL_HWSURFACE SDL_DOUBLEBUF);
}

void exit_sdl(SDL_Surfacesurface)
{
    
SDL_FreeSurface(surface);
    
SDL_Quit();
}

// Chopped down even function
int events()
{
    
SDL_Event event;
    while(
SDL_PollEvent(&event))
    {
        switch(
event.type)
        {
            case 
SDL_MOUSEMOTION:
                
mousex event.motion.x;

                
mousey event.motion.y;
            break;


            case 
SDL_QUIT: return 0;
        }
    }
    return 
1;
}


int main()
{

    
SDL_Surface *surf init_sdl(640480);
    
SDL_FreeCursor(cur); 
    
cur SDL_CreateCursor(&cursorData, &cursorData1,1,0,0);

    while(
events())
    {
        if (
cur != NULL
        { 
            
SDL_SetCursor(cur); 
            
SDL_ShowCursor(SDL_ENABLE); // show the SDL 1 pixel transparent cursor 
        

        else 
        { 
            
//failed to create the 1 pixel transparent cursor 
            
SDL_ShowCursor(SDL_DISABLE); // Hide the SDL mouse cursor, we use our own internal one 
        

    }

    
exit_sdl(surf);
}


Compile as: pc-amigaos-gcc test.c -o test -lSDL -lpthread
Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project