Jump to content
  • Advertisement
Sign in to follow this  
gameXcore

SDL: Draw_Line error

This topic is 3610 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

Im having a problem with the Draw_Line function from SDL_Draw, ive come across this problem before, in which case it simply "dissapeared" and the program was working fine until now, when it has stopped working again. This is the code:
	if(m_drawGrid)
	{
		for(int i = 1; i < GRID_SPACES_WIDE; ++i)
			Draw_Line(
				XVideoUpdate::sm_screen,
				i * m_cellWidth,
				0,
				i * m_cellWidth,
				XVideoUpdate::sm_scrHeight,
				m_color);

		for(int i = 1; i < GRID_SPACES_TALL; ++i)
			Draw_Line(
				XVideoUpdate::sm_screen,
				0,
				i * m_cellHeight, 
				XVideoUpdate::sm_scrWidth, 
				i * m_cellHeight, 
				m_color);
	}

The problem occurs during the first loop (the loop to draw vertical lines down the screen, however the second Draw_Line() function works fine. XVideoUpdate::sm_scrHeight is a static int, and is = to the height of my window (600), i'm assuming this is the problematic part, if i change XVideoUpdate::sm_scrHeight to 600 i get the same error, wheras if i change it to 599 it will work. The error i get is: Unhandled exception at 0x0046cf0e in XEngine 2.0.exe: 0xC0000005: Access violation writing location 0x016b5100. For now, since this is mostly for debug and testing use (its drawing the cells of my collision grid onto the screen) I can simply comment it out, however any help getting to the bottom of why im getting this error is greatly appreciated. Thanks, Scott

Share this post


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

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!