Jump to content
  • Advertisement
Sign in to follow this  
Scourage

SDL_CreateCursor Access Violation?

This topic is 4842 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

For some reason this code causes an access violation (segmentation fault) when it runs. It occurs on the line with the SDL_CreateCursor call in it. I'm not sure exactly why that is, I've tried quite a few things and can't figure what memory is getting stomped on. Anybody with any ideas? The rest of my project works fine without the pointer code in it. Cheers, Bob
void NIGHT_system::load_cursors()
{
//your standard pointy cursor

    static unsigned char pointer_bit_map[]={			
			0x03,  0x00, 0x05,  0x00, 0x09,  0x00, 0x11,  0x00,
			0x21,  0x00, 0x41,  0x00, 0x81,  0x00, 0x01,  0x01,
			0x01,  0x02, 0xc1,  0x03, 0x49,  0x00, 0x8d,  0x00,
			0x8b,  0x00, 0x10,  0x01, 0x90,  0x01, 0x60,  0x00
		};
    static unsigned char pointer_bit_mask[]={	
            0x03,  0x00,  0x07,  0x00,  0x0f,  0x00,  0x1f,  0x00,
			0x3f,  0x00,  0x7f,  0x00,  0xff,  0x00,  0xff,  0x01,
			0xff,  0x03,  0xff,  0x03,  0x7f,  0x00,  0xff,  0x00,
			0xfb,  0x00,  0xf0,  0x01,  0xf0,  0x01,  0x60,  0x00 
		};
		
    SDL_Cursor* temp_cursor;
    	
    temp_cursor=SDL_CreateCursor(pointer_bit_map, pointer_bit_mask, 16,16,6,7);

..etc through the rest of the cursors. 

Share this post


Link to post
Share on other sites
Advertisement
I supose it goes without saying that you initialized SDL?

Looking at: SDL Wiki - Create Cursor
I wonder about your height/width values vs the actual data you provided.
I may be reading it wrong, but it seems like it doesn't add up...

Good Luck!

Share this post


Link to post
Share on other sites
I am stupid.

I had the cursor initiation in my application class constructor for some reason. I have an initialization function as well that initializes everything else. Once it got moved back to the right place, everything was happy. I should have caught that sooner.

Thanks for your help.

Cheers,

Bob

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!