Merge pull request #1 from Kiritow/vs-dev

Accept Changes From Branch vs-dev
This commit is contained in:
Kirigaya Kazuto 2017-03-24 11:12:24 +08:00 committed by GitHub
commit 813de57b40
3 changed files with 44 additions and 3 deletions

View File

@ -573,6 +573,11 @@ namespace MiniEngine
font.reset(temp, TTF_CloseFont);
return 0;
}
bool Font::isReady()
{
return (font.get() != nullptr);
}
Texture Font::renderText(Renderer rnd, std::string Text, RGBA fg)
{
@ -740,6 +745,16 @@ namespace MiniEngine
}
}
void SDLSystem::StartTextInput()
{
SDL_StartTextInput();
}
void SDLSystem::StopTextInput()
{
SDL_StopTextInput();
}
AudioPlayer::AudioPlayer()
{
if (!_sysAudioCounter)

View File

@ -219,6 +219,7 @@ namespace MiniEngine
Font() = default;
Font(std::string FontFileName, int size) throw(ErrorViewer);
int use(std::string FontFileName, int size);
bool isReady();
Texture renderText(Renderer rnd, std::string Text, RGBA fg);
Texture renderTextWrapped(Renderer rnd, std::string Text, RGBA fg, int WrapLength);
Texture renderTextShaded(Renderer rnd, std::string Text, RGBA fg, RGBA bg);
@ -256,6 +257,9 @@ namespace MiniEngine
static Platform GetPlatform();
static void StartTextInput();
static void StopTextInput();
class Android
{
public:

View File

@ -1,7 +1,7 @@
#include "MiniEngine.h"
using namespace std;
#include "windows.h"
#include <windows.h>
//GBK编码转换到UTF8编码
int _GBKToUTF8(unsigned char * lpGBKStr,unsigned char * lpUTF8Str,int nUTF8StrLen)
@ -83,7 +83,7 @@ int _UTF8ToGBK(unsigned char * lpUTF8Str,unsigned char * lpGBKStr,int nGBKStrLen
string UTF8ToGBK(string UTF8String)
{
int sz=UTF8String.size()+32;
int sz=UTF8String.size()*2/3+256;
auto utf8str=new unsigned char[sz];
memset(utf8str,0,sz);
memcpy(utf8str,UTF8String.c_str(),UTF8String.size());
@ -102,7 +102,7 @@ string UTF8ToGBK(string UTF8String)
string GBKToUTF8(string GBKString)
{
int sz=GBKString.size()+32;
int sz=GBKString.size()*3/2+32;
auto gbkstr=new unsigned char[sz];
memset(gbkstr,0,sz);
memcpy(gbkstr,GBKString.c_str(),GBKString.size());
@ -118,3 +118,25 @@ string GBKToUTF8(string GBKString)
delete[] utf8str;
return s;
}
#ifdef _MSC_VER
bool isexist(std::string Path)
{
return false;
}
bool canread(std::string Path)
{
return false;
}
bool canwrite(std::string Path)
{
return false;
}
bool canexecute(std::string Path)
{
return false;
}
#endif /// End of _MSC_VER