# SDL: Draw_Line error

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

## 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

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5

• 9
• 14
• 9
• 9
• 9
• ### Forum Statistics

• Total Topics
632922
• Total Posts
3009216
• ### Who's Online (See full list)

There are no registered users currently online

×