Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - tokiwotomare

Pages: 1 [2]
16
General / Unresolved linker externals
« on: April 08, 2011, 12:53:49 am »
I left both as they were on default -- FORCE_STATIC_VCRT is false; the runtime is multithreaded debug DLL.

I tried changing it to multithreaded debug, and I tried setting FORCE_STATIC_VCRT to true (I also tried changing one and not the other, and vice versa).

The problem still remains. :(

17
General / Unresolved linker externals
« on: April 07, 2011, 05:33:41 am »
Since I'm sure you guys get tons and tons of linker questions, I'll try and keep this snappy!

Environment:
- SFML 2 (latest Git download as of ~2330 EST on april 6th)
- Used CMake to generate a VS2010 project
- Used make and make-install in said VS2010 project; everything appeared to propagate correctly (odd sidenote: VS2010 didn't load an appropriate "make clean" build?)

Settings:
Preprocessor: SFML_STATIC
Linked files:
Code: [Select]
sfml-window-s-d.lib
sfml-graphics-s-d.lib
sfml-system-s-d.lib
sfml-audio-s-d.lib

Build type: Debug

The build output:
EDIT: Since the output was waaaaay larger than I thought, I put it all in a pastebin here.

18
Audio / libsndfile-1.dll causing a heap corruption?
« on: April 07, 2011, 03:46:35 am »
Well, now I feel like I have egg on my face!

I updated the two .dlls to the 2.0 versions available in the Git tree and it seems to be working fine.

I wish I could delete this now defunct topic :)

19
Audio / libsndfile-1.dll causing a heap corruption?
« on: April 07, 2011, 03:36:48 am »
So I have in my program the line:

Code: [Select]

file_cabinet.h:

sound_map["ground_collide"].LoadFromFile("Sounds\\Land.wav");
sf::SoundBuffer &get_sound_buffer(std::string filename);



sound_map is a map<std::string, sf::SoundBuffer>.

later in another file:

Code: [Select]

sf::Sound sound;
sound.SetBuffer(file_cabinet.get_sound_buffer("Sounds\\Land.wav"));
sound.Play();


If I leave everything in, the application throws a heap corruption.

If I uncomment everything but the LoadFromFile line, it still throws it. If I uncomment only that line, it doesn't throw it, which says to me that something in LoadFromFile is going wrong.

The call trace:
Code: [Select]


  ntdll.dll!76e64513()
  msvcrt.dll!763198cd()
  libsndfile-1.dll!6f145dc1()
> Mindjob.exe!wmainCRTStartup()  Line 371 C
  kernel32.dll!76231194()
  ntdll.dll!76dfb429()
  ntdll.dll!76dfb3fc()



I triple-checked to make sure that there aren't any conflicting versions of libsndfile-1.dll or openal32.dll.

edit: To answer what I'm sure are common questions ...
- I made sure early on in the project that I haven't mixed up debug and release versions of the SFML libraries (I had to recompile them since the FAQ said that there were no current versions available for VC 2010).
- I'm using the libsndfile-1.dll and openal32.dll that are linked in the VC 2008 version of the C++ 1.6 package.

20
Graphics / Blank (white) Sprite -- can I pass a SubRect?
« on: March 30, 2011, 11:14:16 pm »
Aha! Worked like a charm. Thanks for the response.

I started working on an image management class, figuring that I'd need one at some point anyway. I figured it'd be best to truly only ever have one sf::Image, so when I need to pass it around the program, I'll pass references to it.

Is there anything I should watch out for? Does Sprite.SetImage do wonky things with references, or should that be okay?

21
Graphics / Blank (white) Sprite -- can I pass a SubRect?
« on: March 30, 2011, 09:19:24 pm »
Hello friends,

My code's process is (in a nutshell) like so:
- a Player class declares and initializes an Animator class
- the Animator class holds said Player's sprite sheet, and is, among other things, responsible for passing back the appropriate sprite to draw at any given time
- the game requests said sprite whenever it needs to draw.

My sprite is showing up as a blank white box. My current theory is that the sprite's image is going out of scope at some point, but I can't figure out where.

Here are (I hope all of) the relevant bits (a bunch of fluff taken out unless requested):

mj_animator.h
Code: [Select]
class mj_animator
{
public:
    mj_animator(const std::string &Filename ... );
    mj_animator();
    sf::Sprite get_sprite();
private:
    sf::Sprite sprite_sheet;
    sf::Image img;
}


mj_animator.cpp
Code: [Select]
mj_animator::mj_animator(const std::string &Filename, ...) {
    if(! img.LoadFromFile(Filename)) {
        // error handling stuff
    }
    sprite_sheet.SetImage(img);
}

sf::Sprite mj_animator::get_sprite() {
    // some calculations to determine x1, y1, x2, y2 of an IntRect
    sprite_sheet.SetSubRect(sf::IntRect(x1, y1, x2, y2));
    return sprite_sheet;
}


mj_player.cpp
Code: [Select]
mj_player::mj_player(sf::Image sheet) {
    //animators is an array of mj_animators objects (in mj_player.h)
    animators[0] = mj_animator("file.jpg", ...);
    animators[1] = mj_animator("file.jpg", ...);
    current_animator = 1; //an int to track which animator currently being used
}

// ... some functions to determine which animator we need to have going at any given time, etc

mj_player::Draw(sf::RenderWindow &App) {
    // some calculations to determine current position
    sf::Sprite draw_sprite = animators[current_animator].get_sprite();
    draw_sprite.SetPosition(position.x, position.y);
    App.Draw(draw_sprite);
}


If there's anything you think you need, I'll put it -- I didn't include a lot of what I think is unrelated because it's already a fairly bloated post. :)

My best guess, as I said, is that either somewhere in the process, the image goes out of scope, or that I can't pass sprite_sheet back as I think I can.

Any guesses? Thanks.

edit:
I should note that through some debugging (read: a bunch of couts), I did determine that the math that I didn't include here is actually all correct -- that the SubRect is being correctly calculated, so it's not trying to draw some weird part of the image that doesn't exist or anything like that.

Pages: 1 [2]
anything