锘??xml version="1.0" encoding="utf-8" standalone="yes"?>91亚洲国产成人久久精品,热99RE久久精品这里都是精品免费,久久综合给合久久国产免费http://www.shnenglu.com/lf426/category/6743.htmlGame Design Using C++ and SDLzh-cnMon, 19 May 2008 13:17:20 GMTMon, 19 May 2008 13:17:20 GMT60MixSoundClasshttp://www.shnenglu.com/lf426/archive/2008/04/20/47642.htmllf426lf426Sat, 19 Apr 2008 17:49:00 GMThttp://www.shnenglu.com/lf426/archive/2008/04/20/47642.htmlhttp://www.shnenglu.com/lf426/comments/47642.htmlhttp://www.shnenglu.com/lf426/archive/2008/04/20/47642.html#Feedback0http://www.shnenglu.com/lf426/comments/commentRss/47642.htmlhttp://www.shnenglu.com/lf426/services/trackbacks/47642.html
//UVi Soft ( 2008 )
//Long Fei ( lf426 ), E-mail: zbln426@163.com
//Laboratory of ZaiBieLiunNian
//http://www.shnenglu.com/lf426/

//FileName: MixSoundClass.hpp

#ifndef MIX_SOUND_CLASS_HPP
#define MIX_SOUND_CLASS_HPP

#include 
<iostream>
#include 
<string>
#include 
"SDL/SDL.h"
#include 
"SDL/SDL_mixer.h"

class BaseMixSound
{
private:
    
static int MixNUM;
protected:
    BaseMixSound();
public:
    
virtual ~BaseMixSound();
};

class EffectSound: public BaseMixSound
{
private:
    Mix_Chunk
* sound;
public:
    EffectSound(
const std::string& sound_fileName);
    
~EffectSound();
    
void play() const;
};

class MusicSound: public BaseMixSound
{
private:
    Mix_Music
* music;
public:
    MusicSound(
const std::string& music_fileName);
    
~MusicSound();
    
void play() const;
    
void stop() const;
};

#endif

//UVi Soft ( 2008 )
//Long Fei ( lf426 ), E-mail: zbln426@163.com
//Laboratory of ZaiBieLiunNian
//http://www.shnenglu.com/lf426/

#include 
"MixSoundClass.hpp"

//*******************************
//class BaseMixSound

int BaseMixSound::MixNUM = 0;

BaseMixSound::BaseMixSound()
{
    
if ( MixNUM == 0 ){
        
if( Mix_OpenAudio( 22050, MIX_DEFAULT_FORMAT, 24096 ) == -1 ){
            std::cerr 
<< "Mix_Open ERROR" << std::endl;
            exit(
-1);
        }
    }
    MixNUM
++;
}

BaseMixSound::
~BaseMixSound()
{
    MixNUM
--;
    
if ( MixNUM == 0 ){
        Mix_CloseAudio();
    }
}

//*******************************



//*******************************
//class EffectSound

EffectSound::EffectSound(
const std::string& sound_fileName)
{
    sound 
= Mix_LoadWAV(sound_fileName.c_str());
    
if ( sound == 0 ){
        std::cerr 
<< sound_fileName << " : load failed!" << std::endl;
    }
}

EffectSound::
~EffectSound()
{
    Mix_FreeChunk(sound);
}

void EffectSound::play() const
{
     
if( Mix_PlayChannel(-1, sound, 0== -1 ){
         std::cerr 
<< "Mix_PlayChannel() ERROR" << std::endl;
     }
}

//*******************************



//*******************************
//class MusicSound

MusicSound::MusicSound(
const std::string& music_fileName)
{
    music 
= Mix_LoadMUS(music_fileName.c_str());
    
if (  music == 0 ){
        std::cerr 
<< music_fileName << " : load failed!" << std::endl;
    }
}

MusicSound::
~MusicSound()
{
    Mix_FreeMusic(music);
}

void MusicSound::play() const
{
    
if( Mix_PlayingMusic() == false ){
        
if( Mix_PlayMusic( music, -1 ) == -1 ){
            std::cerr 
<< "Mix_PlayMusic() ERROR" << std::endl;
        }
    } 
else {
        
if( Mix_PausedMusic() == 1) {
            Mix_ResumeMusic();
        }
        
else {
            Mix_PauseMusic();
        }
    }
}

void MusicSound::stop() const
{
    Mix_HaltMusic();
}

//***************************************

lib: SDL.lib, SDLmain.lib
     SDL_mixer.lib

dll: SDL.dll
     libogg-0.dll, libvorbis-0.dll, libvorbisfile-3.dll, SDL_mixer.dll, smpeg.dll

last update: 2008-04-20

lf426 2008-04-20 01:49 鍙戣〃璇勮
]]>
ButtonClasshttp://www.shnenglu.com/lf426/archive/2008/04/15/47156.htmllf426lf426Tue, 15 Apr 2008 13:29:00 GMThttp://www.shnenglu.com/lf426/archive/2008/04/15/47156.htmlhttp://www.shnenglu.com/lf426/comments/47156.htmlhttp://www.shnenglu.com/lf426/archive/2008/04/15/47156.html#Feedback0http://www.shnenglu.com/lf426/comments/commentRss/47156.htmlhttp://www.shnenglu.com/lf426/services/trackbacks/47156.html闃呰鍏ㄦ枃

lf426 2008-04-15 21:29 鍙戣〃璇勮
]]>
StringDatahttp://www.shnenglu.com/lf426/archive/2008/04/14/47040.htmllf426lf426Mon, 14 Apr 2008 06:11:00 GMThttp://www.shnenglu.com/lf426/archive/2008/04/14/47040.htmlhttp://www.shnenglu.com/lf426/comments/47040.htmlhttp://www.shnenglu.com/lf426/archive/2008/04/14/47040.html#Feedback2http://www.shnenglu.com/lf426/comments/commentRss/47040.htmlhttp://www.shnenglu.com/lf426/services/trackbacks/47040.html#ifndef STRING_DATA_HPP
#define STRING_DATA_HPP

#include 
<clocale>
#include 
<string>
#include 
<vector>
#include 
"GNU/libintl.h"

class StringData
{
private:
    std::vector
<std::string> data;
public:
    StringData(
const std::string& type);
    std::
string operator [](const unsigned int& n) const;
};

#endif
#include "StringData.hpp"

StringData::StringData(
const std::string& type)
{
    setlocale(LC_ALL, 
"");
    bindtextdomain(
"StringData""./po");
    textdomain(
"StringData");

    
if ( type == "type1" ){
        
//0, 
        data.push_back(gettext(" "));
        
//1
        data.push_back(gettext(" "));
        
//
    }
    
else if ( type == "type2" ){
        
//0, other
        data.push_back(gettext(" "));
        
//1
        data.push_back(gettext(" "));
        
//
    }
    
else if ( type == "type3" ){
        
//0
        data.push_back(gettext(" "));
        
//1
        data.push_back(gettext(" "));
        
//
    else {
        
//0
        data.push_back(gettext("NULL"));
    }
}

std::
string StringData::operator [](const unsigned int& n) const
{
    
if ( n >= data.size() )
        
return 0;
    
return data[n];
}

lib: libintl.lib

dll: libiconv2.dll, libintl3.dll

last update: 2008-04-14

lf426 2008-04-14 14:11 鍙戣〃璇勮
]]>
SurfaceClasshttp://www.shnenglu.com/lf426/archive/2008/04/14/47038.htmllf426lf426Mon, 14 Apr 2008 06:03:00 GMThttp://www.shnenglu.com/lf426/archive/2008/04/14/47038.htmlhttp://www.shnenglu.com/lf426/comments/47038.htmlhttp://www.shnenglu.com/lf426/archive/2008/04/14/47038.html#Feedback0http://www.shnenglu.com/lf426/comments/commentRss/47038.htmlhttp://www.shnenglu.com/lf426/services/trackbacks/47038.html闃呰鍏ㄦ枃

lf426 2008-04-14 14:03 鍙戣〃璇勮
]]>
SDL_render_Chinesehttp://www.shnenglu.com/lf426/archive/2008/04/14/47033.htmllf426lf426Mon, 14 Apr 2008 05:24:00 GMThttp://www.shnenglu.com/lf426/archive/2008/04/14/47033.htmlhttp://www.shnenglu.com/lf426/comments/47033.htmlhttp://www.shnenglu.com/lf426/archive/2008/04/14/47033.html#Feedback0http://www.shnenglu.com/lf426/comments/commentRss/47033.htmlhttp://www.shnenglu.com/lf426/services/trackbacks/47033.htmlWindows only. Linux needn't.

//UVi Soft ( 2008 )
//Long Fei ( lf426 ), E-mail: zbln426@163.com
//Laboratory of ZaiBieLiunNian
//http://www.shnenglu.com/lf426/

//FileName: SDL_render_Chinese.h
//For Windows only

#ifndef RENDER_CHINESE_H
#define RENDER_CHINESE_H

#include 
"gb2312_to_Unicode.h"
#include 
"SDL/SDL_ttf.h"

SDL_Surface
* myTTF_RenderString_Blended(TTF_Font* font, const std::string& str, SDL_Color fg);
SDL_Surface
* myTTF_RenderString_Solid(TTF_Font* font, const std::string& str, SDL_Color fg);
SDL_Surface
* myTTF_RenderString_Shaded(TTF_Font* font, const std::string& str, SDL_Color fg, SDL_Color bg);

#endif

//UVi Soft ( 2008 )
//Long Fei ( lf426 ), E-mail: zbln426@163.com
//Laboratory of ZaiBieLiunNian
//http://www.shnenglu.com/lf426/

//FileName: SDL_render_Chinese.cpp
//For Windows only

#include 
"SDL_render_Chinese.h"

SDL_Surface
* myTTF_RenderString_Blended(TTF_Font* font, const std::string& str, SDL_Color fg)
{
    SDL_Surface
* textbuf;
    
//Get Unicode
    std::vector<Uint16> unicodeUnit;
    
if ( getUnicode(str, unicodeUnit) == false )
        
return 0;
    
int arraySize = unicodeUnit.size();
    Uint16
* perOne = new Uint16[arraySize+1];
    
for ( int i = 0; i < arraySize; i++ )
        perOne[i] 
= unicodeUnit[i];
    perOne[arraySize] 
= 0;

    
    
//Render the new text
    textbuf = TTF_RenderUNICODE_Blended(font, perOne, fg);

    
//Free the text buffer and return
    delete [] perOne;
    
return textbuf;
}

SDL_Surface
* myTTF_RenderString_Solid(TTF_Font* font, const std::string& str, SDL_Color fg)
{
    SDL_Surface
* textbuf;
    
//Get Unicode
    std::vector<Uint16> unicodeUnit;
    
if ( getUnicode(str, unicodeUnit) == false )
        
return 0;
    
int arraySize = unicodeUnit.size();
    Uint16
* perOne = new Uint16[arraySize+1];
    
for ( int i = 0; i < arraySize; i++ )
        perOne[i] 
= unicodeUnit[i];
    perOne[arraySize] 
= 0;

    
    
//Render the new text
    textbuf = TTF_RenderUNICODE_Solid(font, perOne, fg);

    
//Free the text buffer and return
    delete [] perOne;
    
return textbuf;
}

SDL_Surface
* myTTF_RenderString_Shaded(TTF_Font* font, const std::string& str, SDL_Color fg, SDL_Color bg)
{
    SDL_Surface
* textbuf;
    
//Get Unicode
    std::vector<Uint16> unicodeUnit;
    
if ( getUnicode(str, unicodeUnit) == false )
        
return 0;
    
int arraySize = unicodeUnit.size();
    Uint16
* perOne = new Uint16[arraySize+1];
    
for ( int i = 0; i < arraySize; i++ )
        perOne[i] 
= unicodeUnit[i];
    perOne[arraySize] 
= 0;

    
    
//Render the new text
    textbuf = TTF_RenderUNICODE_Shaded(font, perOne, fg, bg);

    
//Free the text buffer and return
    delete [] perOne;
    
return textbuf;
}

lib: iconv.lib
     SDL_ttf.lib
     SDL.lib, SDLmain.lib

dll: iconv.dll
     SDL_ttf.dll, libfreetype-6.dll, zlib1.dll
     SDL.dll

last update: 2008-05-12

lf426 2008-04-14 13:24 鍙戣〃璇勮
]]>
gb2312_to_Unicodehttp://www.shnenglu.com/lf426/archive/2008/04/14/47032.htmllf426lf426Mon, 14 Apr 2008 05:23:00 GMThttp://www.shnenglu.com/lf426/archive/2008/04/14/47032.htmlhttp://www.shnenglu.com/lf426/comments/47032.htmlhttp://www.shnenglu.com/lf426/archive/2008/04/14/47032.html#Feedback0http://www.shnenglu.com/lf426/comments/commentRss/47032.htmlhttp://www.shnenglu.com/lf426/services/trackbacks/47032.htmlWindows only. Linux needn't.

//UVi Soft ( 2008 )
//Long Fei ( lf426 ), E-mail: zbln426@163.com
//Laboratory of ZaiBieLiunNian
//http://www.shnenglu.com/lf426/

//FileName: gb2312_to_Unicode.h
//For Windows only


#ifndef GB2312_TO_UNICODE_H_
#define GB2312_TO_UNICODE_H_

#include 
<iostream>
#include 
<vector>
#include 
"GNU/iconv.h"

//if not include "SDL/SDL.h"
#ifndef _SDL_H
typedef unsigned 
short int Uint16;
#endif

bool getUnicode(const std::string& str, std::vector<Uint16>& unicodeVectorArray);

#endif

//UVi Soft ( 2008 )
//Long Fei ( lf426 ), E-mail: zbln426@163.com
//Laboratory of ZaiBieLiunNian
//http://www.shnenglu.com/lf426/

//FileName: gb2312_to_Unicode.cpp
//For Windows only

#include 
"gb2312_to_Unicode.h"

int myUTF8_to_UNICODE(Uint16* unicode, unsigned char* utf8, int len);

bool getUnicode(const std::string& str, std::vector<Uint16>& unicodeVectorArray)
{
    
const int CHAR_SIZE = 256;
    
//GB2312 src
    const unsigned char* src = (const unsigned char*)(str.c_str());
    size_t src_len 
= strlen((char*)src);
    
//Unicode dst to get
    unsigned char dst[CHAR_SIZE] = {0};
    size_t dst_len 
= sizeof(dst);
    
//iconv arg
    const unsigned char* in = src;
    unsigned 
char* out = dst;

    iconv_t cd;
    
//GB2312 to UTF-8
    cd = iconv_open("UTF-8""GB2312");
    
if ((iconv_t)-1 == cd){
        
return false;
    }
    
//conversion
    iconv(cd, (const char**)&in&src_len, (char**)&out&dst_len);

    
//UTF-8 to Unicode
    int utf8Len = strlen((char*)dst);
    Uint16 unicodeData[CHAR_SIZE] 
= {0};
    
int unicodeLen = myUTF8_to_UNICODE(unicodeData, dst, utf8Len);
    
for (int i = 0; i < unicodeLen; i++) {
        unicodeVectorArray.push_back(unicodeData[i]);
    }
    
    iconv_close(cd); 
    
return true;
}

int myUTF8_to_UNICODE(Uint16* unicode, unsigned char* utf8, int len)
{
    
int length;
    unsigned 
char* t = utf8;

    length 
= 0;
    
while (utf8 - t < len){
        
//one byte.ASCII as a, b, c, 1, 2, 3 ect
        if ( *(unsigned char *) utf8 <= 0x7f ) {
            
//expand with 0s.
            *unicode++ = *utf8++;
        }
        
//2 byte.
        else if ( *(unsigned char *) utf8 <= 0xdf ) {
            
*unicode++ = ((*(unsigned char *) utf8 & 0x1f<< 6+ ((*(unsigned char *) (utf8 + 1)) & 0x3f);
            utf8 
+= 2;
        }
        
//3 byte.Chinese may use 3 byte.
        else {
            
*unicode++ = ((int) (*(unsigned char *) utf8 & 0x0f<< 12+
                ((
*(unsigned char *) (utf8 + 1& 0x3f<< 6+
                (
*(unsigned char *) (utf8 + 2& 0x3f);
            utf8 
+= 3;
        }
        length
++;
    }

    
*unicode = 0;
    
    
return (length);
}

lib: iconv.lib
dll: iconv.dll

last update: 2008-05-12

lf426 2008-04-14 13:23 鍙戣〃璇勮
]]>
久久亚洲中文字幕精品一区| 久久久久久久人妻无码中文字幕爆 | 久久精品亚洲精品国产色婷| 亚洲AV日韩AV天堂久久| 久久精品视频网| 香蕉99久久国产综合精品宅男自 | 久久久久四虎国产精品| 亚洲午夜福利精品久久| 麻豆精品久久久一区二区| 美女久久久久久| 久久婷婷五月综合97色| 久久久亚洲欧洲日产国码是AV| 久久ZYZ资源站无码中文动漫| 色噜噜狠狠先锋影音久久| 久久久久久精品无码人妻| 久久久精品午夜免费不卡| 国产成人综合久久精品红| 欧美久久一区二区三区| 久久久久久夜精品精品免费啦| 亚洲乱码日产精品a级毛片久久| 国产情侣久久久久aⅴ免费| 欧洲人妻丰满av无码久久不卡| 国产99久久九九精品无码| 久久大香香蕉国产| 久久久久久国产精品无码下载| 99久久精品国产一区二区三区| 成人精品一区二区久久久| 欧美喷潮久久久XXXXx| 99久久做夜夜爱天天做精品| 99热热久久这里只有精品68| 国产精品一久久香蕉国产线看观看 | 成人精品一区二区久久久| 色噜噜狠狠先锋影音久久| 99久久国产综合精品麻豆| 99久久免费只有精品国产| 色偷偷偷久久伊人大杳蕉| 久久国产色av免费看| 久久国产劲爆AV内射—百度| 久久久久久久女国产乱让韩| 久久精品国产欧美日韩99热| 日韩精品久久无码人妻中文字幕|