Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

121 Neutral

About Wraithe

  • Rank

Personal Information

  • Role
  • Interests
  1. I am wondering how many DirectSound buffers I should maintain to find a good balance between constant reading of sound files and hanging on to upwards of 30-50 sound effects at once? I am making a small 2D game engine using OpenGL, DirectSound and Win32 APIs. I am thinking I would only need two buffers for music so that I can fade them in and out, maybe adding a third for those instances where there is competing music (think of a character walking past someone's radio). As for sound, I originally thought I could allow myself to set the number of sound buffers at the audio classes' initialization, storing them in an array for faster access, and then keeping a queue of audio requests that take up the first free buffer. Then I worried about a string of the same sound playing and thought maybe I should keep two buffers for every currently loaded sound effect, and whenever that sound effect is called while it is already playing I could do an extremely fast fade between the two buffers set aside for that sound effect. I am sure I am just over-thinking this. I would imagine having three streaming buffers for music and a sound effects queue with 8 buffers is more than enough, but I have never really dealt with low-level sound before. What would people who have worked with lower-level audio recommend? Thank you for your time.
  2. Wraithe

    SDL_ttf runtime error

    Thank you both again for the replies!   I do not ever think to use the debugger =(, will do my best to remember.   There was some error about std::mem_copy or something similar, so it must have been vector copying errors.
  3. Wraithe

    SDL_ttf runtime error

    Sorry to post so many times in a row, but I found a solution.   The program only crashes when I use a vector of my button class. If I make it a vector of pointers, it works. Anyone know why this is?  (Not a big deal, pointers are fine, I simply don't understand why that would cause a crash).
  4. Wraithe

    SDL_ttf runtime error

    I have also tried freeing the rendered text surface immediately after creation, and the program crashes, yet the pointer is not NULL. Again, my other programs work just fine with TTF, what on earth could the issue be?   Edit: Finally got a crash report (Only does it once out of every 10 runs )   Problem signature:   Problem Event Name:    APPCRASH   Application Name:    Space Invaders.exe   Application Version:   Application Timestamp:    51e53cc5   Fault Module Name:    ntdll.dll   Fault Module Version:    6.1.7600.16385   Fault Module Timestamp:    4a5bdb3b   Exception Code:    c0000005   Exception Offset:    000335f2   OS Version:    6.1.7600.   Locale ID:    1033   Additional Information 1:    e3cc   Additional Information 2:    e3cc0ee538989a7b66ab90686b3c00a6   Additional Information 3:    d22a   Additional Information 4:    d22a3993b2d48ddd96705e026b50390c       Fault Module Name:    ntdll.dll  <-- What is this?
  5. Wraithe

    SDL_ttf runtime error

    Thanks for the replies! As far as I can tell (with error checking) the pointers are valid. I set up error checking and not a single error occurs. The program just crashes when a text rendered surface hits the blit function.     Edit:     Yes, I have even tried filling in all the render text solid parameters with solid values, generated IN that function, and the crash still occured at the blit function.
  6. I have been using SDL (pre 2.0) with SDL_ttf, SDL_image and irrKland (for audio). I have started touching on OpenGL, but that is mostly for fun at the moment. Lazy Foo is THE site to learn SDL and OpenGL. He doesn't really go into game mechanics much, but the APIs he covers very well. Then I would hit up StaysCrisps tutorials over at DreaminCode, as he has a wonderful intro game engine design tutorial series (he now also recommends a book called SDL Game Development, looks great and teaches TinyXML, I cant WAIT to get this =D ).   I have been looking for someone to program with (I am terrible at art) and my custom game engine (using SDL and irrKlang) is nearing completion, let me know if you and your friend would like an extra partner  =)   !
  7. Hello all,   Looking for a little help. I have used SDL with TTF quite a bit and I am fairly comfortable with it at this point. This error has me dumbfounded however, and I have no more ideas of how to proceed. I have tested the Font loading and TTF_RenderText_Solid. The surface returned from the rendertext function is not a null pointer, but it must be the issue, as my program crashes anytime I try to blit a text surface. I have used the same blitting function for standard images, and it works just fine.   I have also checked all my compiler linking (I am using code::blocks), it is fine. I have loaded up old programs, recompiled them, and they work just fine. I have no idea where to go from here. My button class is where I am trying to utilize text, so that is what I will be showing.   Edit: In case anyone ends up asking, I did call TTF_Init();   #include "text.h"   std::map <std::string, SDL_Color> Text::mColors; std::map <std::string, TTF_Font *> Text::mFonts; SDL_Surface * Text::applyText( std::string strText, std::string strFont, std::string strColor, int * w, int * h ) {     SDL_Surface * surface = NULL;     surface = TTF_RenderText_Solid( mFonts[ strFont ], strText.c_str(), mColors[ strColor ] );     TTF_SizeText( mFonts[ strFont ], strText.c_str(), w, h );     return surface; }       #ifndef TEXT_H #define TEXT_H #include <map> #include <string> #include "SDL/sdl_ttf.h" class Text {     public:         static SDL_Surface * applyText( std::string strText, std::string strFont, std::string strColor, int * w, int * h );         static std::map <std::string, SDL_Color> mColors;         static std::map <std::string, TTF_Font *> mFonts; }; #endif // TEXT_H       // inside of Display.cpp   void Display::loadFonts() {     initInput( "Resources/ResourceListFonts.txt" );     while( !isFile.eof() )     {         readLine();         if( !strData.empty() )         {             std::string strFont = strData;             readLine();             std::string strFontPath = strPath + strData;             int fontSize = readValue();             TTF_Font * newFont = NULL;             newFont = TTF_OpenFont( strFontPath.c_str(), fontSize );             mFonts.insert( std::pair <std::string, TTF_Font *> ( strFont, newFont ) );         }     }     freeInput(); }     // in button.cpp   Button::Button( int iX, int iY, std::string strSurf, std::string strFunc, std::string strText ) {     x = iX;     y = iY;     w = Display::getImageWidth( strSurf );     h = Display::getImageHeight( strSurf );     iTextW = 0;     iTextH = 0;     strFunction = strFunc;     strSurface = strSurf;     surfaceText = NULL;     if( !strText.empty() )     {         strSurfaceText = strText;         surfaceText = Display::applyText( strSurfaceText, "monospaceTypewriter12", "black", &iTextW, &iTextH );     }     sClipX = 0;     sClipY = 0; }     void Button::render() {     Display::applySurface( x, y, strSurface, sClipX, sClipY );     if( surfaceText != NULL )     {         Display::applySurface( ( x + ( iTextW / 2 ) ), ( y + ( iTextH / 2 ) ), surfaceText );     } }  
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!