• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
kg3unforgn

SDL IMG_LOAD not working with DLLs

5 posts in this topic

Hey everyone I am new to SDL, and I saw and read a topic about the IMG_Load function in SDL2. I am currently going through the book SDL2 Game Development with Shawn Mitchell. I am currently on Chapter 2. I could not load BMP images without installing the SDL2 Image Header, everything seemed to be working fine, until I ran into other BMP, JPEG, PNG files were not loading. I researched and found I needed more dlls, so I placed all the Image dlls in the debug folder, but no luck. Nothing pretty much seems to be working here. I created a initImage Function to handle the Image Initialization, it currently works, though, the loading of the images do not. I am not sure what is problem, I tried at least 10 different images, none of them work expect the bmp images I previously had before I installed the header files.  I even tired going on LazyFoo's website and following those directions. I know the images are not corrupted or anything, I mean I can open and close them just fine. I just can't Load them.
 
Here is the source code to my Function, but I am pretty sure it isn't the issue:

 
void Game::initImage()
{
SDL_Surface* pTempSurface = IMG_Load("Assets/kyoko.gif"); // Not working at the moment
gTexture =SDL_CreateTextureFromSurface(gRenderer,pTempSurface);
SDL_FreeSurface(pTempSurface);
 
SDL_QueryTexture(gTexture,NULL,NULL,&gSourceRectangle.w,&gSourceRectangle.h);
gDestinationRectangle.x = gSourceRectangle.x = 100;
gDestinationRectangle.y = gSourceRectangle.y = 100;
gDestinationRectangle.w = gSourceRectangle.w;
gDestinationRectangle.h = gSourceRectangle.h;
}
 
 
0

Share this post


Link to post
Share on other sites

 

Hey everyone I am new to SDL, and I saw and read a topic about the IMG_Load function in SDL2. I am currently going through the book SDL2 Game Development with Shawn Mitchell. I am currently on Chapter 2. I could not load BMP images without installing the SDL2 Image Header, everything seemed to be working fine, until I ran into other BMP, JPEG, PNG files were not loading. I researched and found I needed more dlls, so I placed all the Image dlls in the debug folder, but no luck. Nothing pretty much seems to be working here. I created a initImage Function to handle the Image Initialization, it currently works, though, the loading of the images do not. I am not sure what is problem, I tried at least 10 different images, none of them work expect the bmp images I previously had before I installed the header files.  I even tired going on LazyFoo's website and following those directions. I know the images are not corrupted or anything, I mean I can open and close them just fine. I just can't Load them.
 
Here is the source code to my Function, but I am pretty sure it isn't the issue:

 
void Game::initImage()
{
SDL_Surface* pTempSurface = IMG_Load("Assets/kyoko.gif"); // Not working at the moment
gTexture =SDL_CreateTextureFromSurface(gRenderer,pTempSurface);
SDL_FreeSurface(pTempSurface);
 
SDL_QueryTexture(gTexture,NULL,NULL,&gSourceRectangle.w,&gSourceRectangle.h);
gDestinationRectangle.x = gSourceRectangle.x = 100;
gDestinationRectangle.y = gSourceRectangle.y = 100;
gDestinationRectangle.w = gSourceRectangle.w;
gDestinationRectangle.h = gSourceRectangle.h;
}

 

 

Stating that "Nothing pretty much seems to be working here" really doesn't help. You have to describe the issue in more detail. For example:

- What is the OS and compiler?

- Does your program compile fine? Does it link succesfully?

- In case it compiles and links fine, does the program work until a particular point and then crash? Or something else happens?

 

I've read that book (I have some complaints about it) and I'm working through LazyFoo's tutorials right now. Off the top of my head:

- Did you remember to call IMG_Init() prior to calling IMG_Load()?

- Have you tried to investigate what is wrong by calling IMG_GetError()?

 

It could also be that you made a mistake when you set up your project. In case you're running Visual Studio 2013, I've made an SDL2 application template that I've attached to this reply; it has a Post-Build Event that copies the DLLs from $SDL2_HOME\lib\x86 to the output folder, so that would be one less possible source of problems to worry about. Here's how to install and use it:

1) Create a system environment variable called SDL2_HOME pointing to the folder where you installed SDL2.
2) Copy the attached ZIP file to Documents\Visual Studio 2013\Templates\ProjectTemplates under your home folder.
3) Open Visual Studio and click FILE, New Project... The "SDL2 Application" Visual C++ template is now available. Create your project.
4) The project is all set up, and the small bundled sample program is ready to compile.

Edited by georger.araujo
0

Share this post


Link to post
Share on other sites


I researched and found I needed more dlls, so I placed all the Image dlls in the debug folder, but no luck.

 

Have you tried placing the .dll files in the same folder as your header and source files? Placing them in the debug folder will only matter if you run your game from application file in that folder.

-2

Share this post


Link to post
Share on other sites

 

 

Hey everyone I am new to SDL, and I saw and read a topic about the IMG_Load function in SDL2. I am currently going through the book SDL2 Game Development with Shawn Mitchell. I am currently on Chapter 2. I could not load BMP images without installing the SDL2 Image Header, everything seemed to be working fine, until I ran into other BMP, JPEG, PNG files were not loading. I researched and found I needed more dlls, so I placed all the Image dlls in the debug folder, but no luck. Nothing pretty much seems to be working here. I created a initImage Function to handle the Image Initialization, it currently works, though, the loading of the images do not. I am not sure what is problem, I tried at least 10 different images, none of them work expect the bmp images I previously had before I installed the header files.  I even tired going on LazyFoo's website and following those directions. I know the images are not corrupted or anything, I mean I can open and close them just fine. I just can't Load them.
 
Here is the source code to my Function, but I am pretty sure it isn't the issue:

 
void Game::initImage()
{
SDL_Surface* pTempSurface = IMG_Load("Assets/kyoko.gif"); // Not working at the moment
gTexture =SDL_CreateTextureFromSurface(gRenderer,pTempSurface);
SDL_FreeSurface(pTempSurface);
 
SDL_QueryTexture(gTexture,NULL,NULL,&gSourceRectangle.w,&gSourceRectangle.h);
gDestinationRectangle.x = gSourceRectangle.x = 100;
gDestinationRectangle.y = gSourceRectangle.y = 100;
gDestinationRectangle.w = gSourceRectangle.w;
gDestinationRectangle.h = gSourceRectangle.h;
}

 

 

Stating that "Nothing pretty much seems to be working here" really doesn't help. You have to describe the issue in more detail. For example:

- What is the OS and compiler?

- Does your program compile fine? Does it link succesfully?

- In case it compiles and links fine, does the program work until a particular point and then crash? Or something else happens?

 

I've read that book (I have some complaints about it) and I'm working through LazyFoo's tutorials right now. Off the top of my head:

- Did you remember to call IMG_Init() prior to calling IMG_Load()?

- Have you tried to investigate what is wrong by calling IMG_GetError()?

 

It could also be that you made a mistake when you set up your project. In case you're running Visual Studio 2013, I've made an SDL2 application template that I've attached to this reply; it has a Post-Build Event that copies the DLLs from $SDL2_HOME\lib\x86 to the output folder, so that would be one less possible source of problems to worry about. Here's how to install and use it:

1) Create a system environment variable called SDL2_HOME pointing to the folder where you installed SDL2.
2) Copy the attached ZIP file to Documents\Visual Studio 2013\Templates\ProjectTemplates under your home folder.
3) Open Visual Studio and click FILE, New Project... The "SDL2 Application" Visual C++ template is now available. Create your project.
4) The project is all set up, and the small bundled sample program is ready to compile.

 

Thanks for Replying. Your correct I just cannot say it does not work, there is always a reason. ESP. for a programmer. I am using Visual Studios 2012 at the moment, and I am on Windows 7.  The program complies just fine, although it has a warning  "warning LNK4090 default 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library"

I also have not tried IMG_GetError() or IMG_Init(). I am going to try those righ tnow and see what happens. as well research in to more in depth of what is going on and what I am I doing wrong.

0

Share this post


Link to post
Share on other sites

 


I researched and found I needed more dlls, so I placed all the Image dlls in the debug folder, but no luck.

 

Have you tried placing the .dll files in the same folder as your header and source files? Placing them in the debug folder will only matter if you run your game from application file in that folder.

 

I have tried that, but that did not work either before. Let me try that one more time to see if that works too.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0