I tried everything and the only class that has get_gc() is CL_Canvas, but its not working, it crashes when formed level map surface must be created from drawn canvas:

CL_ResourceManager resource = CL_ResourceManager( tileresourcefile );
CL_Sprite tilesprite = CL_Sprite( tilespritename.c_str(), &resource );

char *tokenPtr;
int tmp;

int map_pos_x = 0;
int map_pos_y = 0;

while( !levelFile.eof() ) {
levelFile >> tmp;
//cout << tmp;
tilesprite.set_frame( tmp );
tilesprite.draw( map_pos_x, map_pos_y, canvas.get_gc() );

if( map_pos_x == Width ) {
map_pos_x = 0;
map_pos_y += tileHeight;
} else {
map_pos_x += tileWidth;
}
}

_levelMap = new CL_Surface( canvas.get_pixeldata() ); // this is where the crashing starts


Here's call stack:

#0 004468BA CL_PixelBuffer::get_width(this=0x427bf58) (pixel_buffer.cpp:89)
#1 00412597 CL_OpenGLTarget::create_surface(this=0x3db728, provider=@0x22f420, flag=0) (opengl_target.cpp:70)
#2 0043C848 CL_Surface::CL_Surface(this=0x4278ef0, provider=@0x22f520, flag=0) (surface.cpp:59)
#3 00404F5A CLevel::CreateLevel(this=0x22fa80, levelNum=1) (C:/useful/wxWidgets/samples/projekat ClanLib Rebelium/CLevel.cpp:101)
#4 004045F8 CGame::PlayTheGame(this=0x22fa70) (C:/useful/wxWidgets/samples/projekat ClanLib Rebelium/CGame.cpp:81)
#5 004044D0 CGame::Run(this=0x22fa70) (C:/useful/wxWidgets/samples/projekat ClanLib Rebelium/CGame.cpp:64)
#6 005B31D8 Rebelium::main(this=0x658010, argc=1, argv=0x3db168) (C:/useful/wxWidgets/samples/projekat ClanLib Rebelium/App.cpp:78)
#7 0041228E WinMain(hInstance=0x400000, hPrevInstance=0x0, lpCmdLine=0x241f2f "", nCmdShow=10) (Win32/clanapp.cpp:84)
#8 005A68EA main() (c:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_list.h:1164)

it crashed at Display\pixel_buffer.cpp line 89 (return impl->width


I'm hammering my head with this for 2 days, will I ever be able to finish this game? You made things to be simple and I should be able to follow even with low knowledge of C++. I have experience with SDL and there I was able to draw one surface, or part of one surface, onto another surface and form and position the map before flipping. While your classes allow me greater flexibility and makes other things easier, I don't understand how to do this.