Page 1 of 4 123 ... LastLast
Results 1 to 10 of 38

Thread: Ubuntu Games Developer Resource Wiki

  1. #1
    Join Date
    Apr 2006
    Beans
    1,030
    Distro
    Ubuntu 9.10 Karmic Koala

    Arrow Ubuntu Games Developer Resource Wiki

    Hi

    You may have noticed a large amount of HOWTO relating to SDL and games programming on this part of the forum, well, guess what! we've made a Wiki to store all these lovely articles.

    We will continue to post on the forum about any questions and we will announce every new HOWTO as they are released.

    If you have any ideas for HOWTOs or you have a HOWTO of your own that you would like to contribute, let us know and we will be happy to include anything you give.

    The URL for our new Wiki is: http://ubuntu-gamedev.pbwiki.com/

    Mike

  2. #2
    Join Date
    Nov 2005
    Location
    Taunton, England
    Beans
    931
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Ubuntu Games Developer Resource Wiki

    following your first tutorial, libsdl OSS wants to get rid of libsdl ALSA

    is there a reason why i want OSS over ALSA

    will removing ALSA break things?

  3. #3
    Join Date
    Nov 2005
    Location
    Taunton, England
    Beans
    931
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Ubuntu Games Developer Resource Wiki

    ok the second tutorial, in the wiki it says SDL_Flip(); but it needs to be SDL_Flip(screen);

    also, i made this

    Code:
    #include "SDL/SDL.h"
    
    int main(int argc, char* argv[])
    {
    	// start sdl
    	SDL_Init(SDL_INIT_EVERYTHING);
    	
    	// load an image
    	
    	SDL_Surface* loaded_image = NULL;
    	loaded_image = SDL_LoadBMP("MyImage.bmp");
    	
    	// convert it to the right format
    	
    	SDL_Surface* compatible_image = NULL;
    	compatible_image = SDL_DisplayFormat(loaded_image);
    	SDL_FreeSurface(loaded_image);
    	
    	// set up the screen
    	
    	const int SCREEN_WIDTH = 800;
    	const int SCREEN_HEIGHT = 600;
    	const int SCREEN_BPP = 32;
    	
    	SDL_Surface* screen = NULL;
    	
    	screen = SDL_SetVideoMode(	SCREEN_WIDTH, 
    					SCREEN_HEIGHT, 
    					SCREEN_BPP, 
    					SDL_SWSURFACE);
    	
    	// put image on screen
    	
    	SDL_Rect position;
    	position.x = 0;
    	position.y = 0;
    	
    	SDL_BlitSurface(	compatible_image,
    				NULL,
    				screen,
    				&position);
    	
    	SDL_Flip(screen);
    	
    	//Wait 2 seconds
    	SDL_Delay( 2000 );
    	
    
    	// Destroy remaining surfaces
    	SDL_FreeSurface( compatible_image );
    	
    	
    	// quit sdl
    	SDL_Quit();
    	
    	return 0;
    }
    and it compiles but it just displays a black window. my image is NOT displayed. why is this? the image is in the same directory as the binary

  4. #4
    Join Date
    Apr 2006
    Beans
    1,030
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Ubuntu Games Developer Resource Wiki

    Quote Originally Posted by Choad View Post
    following your first tutorial, libsdl OSS wants to get rid of libsdl ALSA

    is there a reason why i want OSS over ALSA

    will removing ALSA break things?
    No reason i can think of, you might have problems i fthe system you want to run the program on need OSS instead of ALSA. I'm not too sure theres much likelihood of that though unless someone else knows of something that might make a difference.

    Go with OSS I would say, but only because I read somewhere that its a better sound system.

    Mike

  5. #5
    Join Date
    Apr 2006
    Beans
    1,030
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Ubuntu Games Developer Resource Wiki

    Quote Originally Posted by Choad View Post
    ok the second tutorial, in the wiki it says SDL_Flip(); but it needs to be SDL_Flip(screen);

    also, i made this

    Code:
    #include "SDL/SDL.h"
    
    int main(int argc, char* argv[])
    {
    	// start sdl
    	SDL_Init(SDL_INIT_EVERYTHING);
    	
    	// load an image
    	
    	SDL_Surface* loaded_image = NULL;
    	loaded_image = SDL_LoadBMP("MyImage.bmp");
    	
    	// convert it to the right format
    	
    	SDL_Surface* compatible_image = NULL;
    	compatible_image = SDL_DisplayFormat(loaded_image);
    	SDL_FreeSurface(loaded_image);
    	
    	// set up the screen
    	
    	const int SCREEN_WIDTH = 800;
    	const int SCREEN_HEIGHT = 600;
    	const int SCREEN_BPP = 32;
    	
    	SDL_Surface* screen = NULL;
    	
    	screen = SDL_SetVideoMode(	SCREEN_WIDTH, 
    					SCREEN_HEIGHT, 
    					SCREEN_BPP, 
    					SDL_SWSURFACE);
    	
    	// put image on screen
    	
    	SDL_Rect position;
    	position.x = 0;
    	position.y = 0;
    	
    	SDL_BlitSurface(	compatible_image,
    				NULL,
    				screen,
    				&position);
    	
    	SDL_Flip(screen);
    	
    	//Wait 2 seconds
    	SDL_Delay( 2000 );
    	
    
    	// Destroy remaining surfaces
    	SDL_FreeSurface( compatible_image );
    	
    	
    	// quit sdl
    	SDL_Quit();
    	
    	return 0;
    }
    and it compiles but it just displays a black window. my image is NOT displayed. why is this? the image is in the same directory as the binary
    Do you have a bmp file in the same folder called 'MyImage.bmp'?

    If you don't then you could make one with GIMP or some other image software and place it in that folder. It is a windows bmp btw.

    Mike

  6. #6
    Join Date
    Nov 2005
    Location
    Taunton, England
    Beans
    931
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Ubuntu Games Developer Resource Wiki

    yes i do.

  7. #7
    Join Date
    Aug 2005
    Location
    Toronto, Ontario
    Beans
    302
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Ubuntu Games Developer Resource Wiki

    Quote Originally Posted by Choad View Post
    yes i do.
    Put some error checking in and have it output the error message you're getting to the terminal. It'll give you some insight into where you're going wrong. Plus, it's just good code to put in redundant checks.

  8. #8
    Join Date
    Apr 2006
    Beans
    1,030
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Ubuntu Games Developer Resource Wiki

    The only thing that I can see that strikes me as different from our example is that you convert the image BEFORE you set the video surface.

    Try doing it after you set the screen up and see what happens.

    Mike

  9. #9
    Join Date
    Nov 2005
    Location
    Taunton, England
    Beans
    931
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Ubuntu Games Developer Resource Wiki

    Quote Originally Posted by seethru View Post
    Put some error checking in and have it output the error message you're getting to the terminal. It'll give you some insight into where you're going wrong. Plus, it's just good code to put in redundant checks.
    yeah i would have, but i was following the tutorial

    dont you think the tutorial should be updated?

    i dont actually know how to put error checking in. is it just checking the return value of each function for a positive or negative number?

  10. #10
    Join Date
    Nov 2005
    Location
    Taunton, England
    Beans
    931
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Ubuntu Games Developer Resource Wiki

    Quote Originally Posted by Mickeysofine1972 View Post
    The only thing that I can see that strikes me as different from our example is that you convert the image BEFORE you set the video surface.

    Try doing it after you set the screen up and see what happens.

    Mike
    that did it

Page 1 of 4 123 ... LastLast

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
  •