Results 1 to 8 of 8

Thread: Upside down sprites

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Lesser Wizard
    Join Date
    Jun 2007
    Posts
    109

    Default

    Confusion might come from OpenGL standard using the bottom left as the origin point (if I recall correctly).

    I actually like that ClanLib uses the top left for its Sprite Class. It's traditional for 2d.

    Just don't use CL_Sprite if that drives you crazy. I did an entire project without it when I was using raw GL in a 2d environment. There's nothing particularly special about CL_Sprite that forces you to use it. Also, it's kind of funny how instead of fixing your projection you try to fix ClanLib

    The irony of my project was I'm pretty sure I did my own corrections to assume 0,0 is the top left. =)

    But i'm a bit confused why you are using set_projection like this.
    If you are only using it to move the camera. I would leave the coordinate system to the top left, and use gc.set_translate() to translate the ModelView matrix.
    I had a similar thought...

    I wouldn't worry so much about what you're "supposed" to do and what works. I found this to be an easy solution to moving camera + stationary GUI elements. I'm using only CL_Sprites, basically.. Main loop:

    Code:
    while(!quit)
    {
    	timer();
    
    	if(!lock_input)
    		get_input(window.get_ic());
    
    	gui_update();
    	
    	gc.clear(CL_Colorf(0.0f,0.0f,0.0f));
    	gc.set_map_mode(CL_MapMode(cl_map_2d_upper_left));
    
    	if(area.is_initialized())
    	{
    		area.update(micro_second);
    		gc.pop_modelview();
    		gc.set_translate(-area.get_camera().x, -area.get_camera().y);
    		area.draw();
    		gc.pop_modelview();
    		gc.set_translate(area.get_camera().x, area.get_camera().y);
    	}
    
    	gc.pop_modelview();
    	hud_draw();
    
    	// GUI
    	gui.exec(false);
    	gui_draw_windows(gc, wm);
    	if(area.is_initialized())
    		gc.set_translate(-area.get_camera().x, -area.get_camera().y);
    
    	window.flip(0);		// TODO: V-sync toggle
    	CL_System::sleep(0);
    	frames++;
    }
    Kinda brutish, but works...
    Last edited by catch22; 04-05-2010 at 05:44 PM.

Similar Threads

  1. Uhhh upside down funny??/
    By darknet12282 in forum Novashell Game Creation System
    Replies: 2
    Last Post: 05-24-2012, 01:50 AM
  2. The upside down problem
    By Judas in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 10-17-2010, 03:30 PM
  3. Sprites and more...
    By Ledorax in forum Novashell Game Creation System
    Replies: 8
    Last Post: 09-28-2009, 04:47 PM
  4. Sprites
    By lixopmstp in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 01-21-2007, 02:36 AM
  5. sprites
    By seyah3 in forum Dink Smallwood HD
    Replies: 0
    Last Post: 02-03-2006, 03:05 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •