Twinklebear / LPCGame

Working on a C++ tile based 'engine' using SDL
MIT License
18 stars 1 forks source link

Failing to find image json files. #5

Closed btstevens89 closed 11 years ago

btstevens89 commented 11 years ago

When running the program, I am getting a black window (1280x720) and then a console screen with errors.

Failed to find file: ../res/images/introback.json and then again with 200x100button.json.

Twinklebear commented 11 years ago

Well those errors at this point shouldn't have the effect of causing the program to fail to run, they're part of the data separation migration that's still underway and I haven't migrated those images yet. They should still load in the old fashion and so for debugging/logging purposes I have it just print the error to console. Upon running the program you should see something like this

http://i.imgur.com/8Xweo.png

What is happening is that it's failing to find a config file for the image which would describe the clips and such for it, but isn't actually needed at the moment for the buttons because they still use the bad way of getting the information from the state's JSON file.

In addition you may or may not be able to run the game state as it seems to be crashing as a result of using the old system for loading modules. I'm planning to migrate over tonight and hopefully it should be fixed easily. I think heh

Twinklebear commented 11 years ago

I've removed the old module system, if you update your fork everything should work. The failed to find image config stuff for the button files isn't relevant at the moment, but it will be once i migrate them heh

In addition to removing the old system, the new system now uses a lookup in an unordered_map of RegisterLua function pointers, so it should be clearer to read and faster to run.

btstevens89 commented 11 years ago

This was an issue of not having libpng installed. That's why the error was being thrown. IMG_LoadTexture was returning null.

window.cpp (104)

SDL_Texture* Window::LoadTexture(std::string file){
    SDL_Texture *tex = nullptr;
    tex = IMG_LoadTexture(mRenderer.get(), file.c_str());
    if (tex == nullptr)
        throw std::runtime_error("Failed to load image: " + file);
    return tex;
Twinklebear commented 11 years ago

Aha! Ok ya that'll do it, you posted the config file not found error, which is a very different and minor issue. That error should be getting printed too. Maybe I removed that, I'll take a look it should print that error as well. K it was gone, added now heh

Ya libpng15-15.dll is necessary

Will mark closed since it sounds like you've got it working

Also if you wanted to discuss at some point potential work for you to do, let me know. Anything on the todo list is fine to take a crack at, although some things my ideas/reasoning for how they'll work may not be clear so it may be harder to do.

btstevens89 commented 11 years ago

Yeah, I'm trying to find things to do. I went through map.cpp/map.h and changed a few things. I'm not sure if your copy was running really slow, but mine was. I made a few changes that got things running up to speed. They are in my forked repository if your interested.

Twinklebear commented 11 years ago

Ah yes, that area was one of the slowest parts of the code, if you sped it up that's awesome! I also see that you added some prettier art haha.

If you create a pull request I'll merge it in, the changes sound pretty good.

If you want to discuss via e-mail or irc or skype or something we can meet and discuss the todo list. I think the next thing i'll be working on is finishing the migration of entities, images, etc. out of the state JSON files and into their own files so they aren't bound to states and can be more re-usable. As a similar system to Unity's pre-fabs if you're familiar with that.

btstevens89 commented 11 years ago

Great.

Add me on google chat. btstevens89@gmail.com

Twinklebear commented 11 years ago

Cool, will do. My email is willusher.life@gmail.com

also, when would a good time to meet be? For reference I'm on PST

Edit: we can just email back and forth as well