Thread: Image over the whole screen!

  1. #1
    Freak! IM!'s Avatar
    Join Date
    Dec 2004
    Location
    Zagreb, Croatia
    Posts
    30

    Cool Image over the whole screen!

    Hi, well since I got more familiar with header files and libaries from my last project with SQLite (ended up well ) I had another crazy idea! I want to create a prog. which would show a 1024*768 image over the whole screen when I run it. Can somebody point me to a good libary? Because I searched at Google but I got so many of them that I don't know what to use? Can I do his from command line, because I hate the Win API I work in DevC++...maybe someone knows a good Devpak?
    Check out my Linux/C++ Programming DC++ HUB!
    5 GB min.// 2 slots// 1 GB must be Linux/C++

    HackLinux++

    Cya there!

  2. #2
    Spaced Cadet
    Join Date
    Aug 2003
    Posts
    110
    <a href="http://www.libsdl.org">SDL</a>

  3. #3
    Freak! IM!'s Avatar
    Join Date
    Dec 2004
    Location
    Zagreb, Croatia
    Posts
    30
    I downloaded their Win32 zip package and the SDL_image libary, but there are just dlls in it, whats with the header files? I use DevC++, there is some VC++ version?
    Last edited by IM!; 03-19-2005 at 12:41 PM.
    Check out my Linux/C++ Programming DC++ HUB!
    5 GB min.// 2 slots// 1 GB must be Linux/C++

    HackLinux++

    Cya there!

  4. #4
    Freak! IM!'s Avatar
    Join Date
    Dec 2004
    Location
    Zagreb, Croatia
    Posts
    30
    I managed to fix everything you rock man, the only prob is, when I display a bitmap it appears in a window, how can I show it over the screen? Like a PowerPoint presentation...just a example to what I want to do...
    Check out my Linux/C++ Programming DC++ HUB!
    5 GB min.// 2 slots// 1 GB must be Linux/C++

    HackLinux++

    Cya there!

  5. #5
    ---
    Join Date
    May 2004
    Posts
    1,379
    Just pass the flag to SDL_SetVideoMode()
    Code:
    SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE|SDL_FULLSCREEN);

  6. #6
    Freak! IM!'s Avatar
    Join Date
    Dec 2004
    Location
    Zagreb, Croatia
    Posts
    30
    OK next question, here the code:

    Code:
    #include "stdlib.h"
    #include "SDL/SDL.h"
    
    int main(int argc, char *argv[])
    {
    	SDL_Surface *screen;	//This pointer will reference the backbuffer
    	SDL_Surface *image;	//This pointer will reference our bitmap sprite
    	SDL_Surface *temp;	//This pointer will temporarily reference our bitmap sprite
    	SDL_Rect src, dest;	//These rectangles will describe the source and destination regions of our blit
    	
    	//We must first initialize the SDL video component, and check for success
    	if (SDL_Init(SDL_INIT_VIDEO) != 0) {
    		printf("Unable to initialize SDL: %s\n", SDL_GetError());
    		return 1;
    	}
    	
    	//When this program exits, SDL_Quit must be called
    	atexit(SDL_Quit);
    	
    	//Set the video mode to fullscreen 1024x768 with 16bit colour and double-buffering
    	screen = SDL_SetVideoMode(1024, 768, 16, SDL_DOUBLEBUF | SDL_FULLSCREEN);
    	if (screen == NULL) {
    		printf("Unable to set video mode: %s\n", SDL_GetError());
    		return 1;
    	}
    	
    	//Load the bitmap into a temporary surface, and check for success
    	temp = SDL_LoadBMP("screen.bmp");
    	if (temp == NULL) {
    		printf("Unable to load bitmap: %s\n", SDL_GetError());
    		return 1;
    	}
    	
    	//Convert the surface to the appropriate display format
    	image = SDL_DisplayFormat(temp);
    	
    	//Release the temporary surface
    	SDL_FreeSurface(temp);
    	
    	//Construct the source rectangle for our blit
    	src.x = 0;
    	src.y = 0;
    	src.w = image->w;	//Use image->w to display the entire width of the image
    	src.h = image->h;	//Use image->h to display the entire height of the image
    	
    	//Construct the destination rectangle for our blit
    	dest.x = 0;		//Display the image at the (X,Y) coordinates (0,0)
    	dest.y = 0;
    	dest.w = image->w;	//Ensure the destination is large enough for the image's entire width/height
    	dest.h = image->h;
    	
    	//Blit the image to the backbuffer
    	SDL_BlitSurface(image, &src, screen, &dest);
    	
    	//Flip the backbuffer to the primary
    	SDL_Flip(screen);
    	
    	//Release the surface
    	SDL_FreeSurface(image);
    	
    	return 0;
    }
    Well can somebody tell me the wy how do I tell the prog. to display this image until I press enter or something? I don't want to use system("PAUSE") , I tried to put getch(); before return 0;, i Included conio.h but the prog. just runed on and right then off? What's the problem?
    Check out my Linux/C++ Programming DC++ HUB!
    5 GB min.// 2 slots// 1 GB must be Linux/C++

    HackLinux++

    Cya there!

  7. #7
    Freak! IM!'s Avatar
    Join Date
    Dec 2004
    Location
    Zagreb, Croatia
    Posts
    30
    oK...i'M DESPARATE...i tried everything, nothing seems to work exept system("PAUSE");...please give me a solution...
    Check out my Linux/C++ Programming DC++ HUB!
    5 GB min.// 2 slots// 1 GB must be Linux/C++

    HackLinux++

    Cya there!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading tiff image files?
    By compz in forum C++ Programming
    Replies: 9
    Last Post: 10-30-2009, 04:17 AM
  2. How to get image from the screen and then save it to a file?
    By nomer in forum Windows Programming
    Replies: 2
    Last Post: 05-25-2006, 08:46 AM
  3. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 04:56 PM
  4. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM
  5. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM