This commit is contained in:
sergey-miryanov
2013-12-28 21:12:07 +06:00
93 changed files with 3033 additions and 2626 deletions

View File

@@ -537,8 +537,8 @@
<lib name="${THIRDPARTY_LIBS}libz${name_extra}${SLIBEXT}" if="linux" unless="dynamic_sdl"/>
<lib name="${THIRDPARTY_LIBS}libz${name_extra}${SLIBEXT}" if="tizen" />
<lib name="${THIRDPARTY_LIBS}libSDL_mixer${name_extra}${SLIBEXT}" if="sdl" unless="dynamic_sdl" />
<lib name="${THIRDPARTY_LIBS}libSDL_image${name_extra}${SLIBEXT}" if="sdl_image" unless="emscripten" />
<lib name="${THIRDPARTY_LIBS}libSDL_mixer${name_extra}${SLIBEXT}" if="sdl" unless="dynamic_sdl || emscripten" />
<lib name="${THIRDPARTY_LIBS}libSDL_image${name_extra}${SLIBEXT}" if="sdl_image" unless="dynamic_sdl || emscripten" />
<lib name="${THIRDPARTY_LIBS}libSDL${name_extra}${SLIBEXT}" if="sdl_static" unless="blackberry" />
<lib name="${THIRDPARTY_LIBS}libSDL2${name_extra}${SLIBEXT}" if="sdl2" />
<!-- <lib name="${THIRDPARTY_LIBS}libSDL2main${name_extra}${SLIBEXT}" if="windows" unless="sdl" /> -->

View File

@@ -192,12 +192,17 @@ namespace lime
bool loadOggSample(OggVorbis_File &oggFile, QuickVec<unsigned char> &outBuffer, int *channels, int *bitsPerSample, int* outSampleRate)
{
// 0 for Little-Endian, 1 for Big-Endian
int endian = 0;
#ifdef HXCPP_BIG_ENDIAN
#define BUFFER_READ_TYPE 1
#else
#define BUFFER_READ_TYPE 0
#endif
int bitStream;
long bytes = 1;
int totalBytes = 0;
#define BUFFER_SIZE 32768
char array[BUFFER_SIZE];
//Get the file information
//vorbis data
@@ -210,23 +215,31 @@ namespace lime
}
//The number of channels
*channels = pInfo->channels;
*channels = pInfo->channels;
//default to 16? todo
*bitsPerSample = 16;
*bitsPerSample = 16;
//Return the same rate as well
*outSampleRate = pInfo->rate;
// Seem to need four times the read PCM total
outBuffer.resize(ov_pcm_total(&oggFile, -1)*4);
while (bytes > 0)
{
if (outBuffer.size() < totalBytes + BUFFER_SIZE)
{
outBuffer.resize(totalBytes + BUFFER_SIZE);
}
// Read up to a buffer's worth of decoded sound data
bytes = ov_read(&oggFile, array, BUFFER_SIZE, endian, 2, 1, &bitStream);
// Append to end of buffer
outBuffer.InsertAt(outBuffer.size(), (unsigned char*)array, bytes);
bytes = ov_read(&oggFile, (char*)outBuffer.begin() + totalBytes, BUFFER_SIZE, BUFFER_READ_TYPE, 2, 1, &bitStream);
totalBytes += bytes;
}
ov_clear(&oggFile);
outBuffer.resize(totalBytes);
ov_clear(&oggFile);
#undef BUFFER_SIZE
#undef BUFFER_READ_TYPE
return true;
}

View File

@@ -390,7 +390,7 @@ void GetSpecialDir(SpecialDir inDir,std::string &outDir)
}
else if (inDir == DIR_STORAGE)
{
outDir = "../";
outDir = "../data";
}
else if (inDir == DIR_USER || inDir == DIR_DOCS || inDir == DIR_DESKTOP)
{

View File

@@ -113,13 +113,13 @@ namespace lime {
std::string FileDialogFolder( const std::string &title, const std::string &text ) {
return "";
}
std::string FileDialogOpen( const std::string &title, const std::string &text, const std::vector<std::string> &fileTypes ) {
return "";
}
std::string FileDialogSave( const std::string &title, const std::string &text, const std::vector<std::string> &fileTypes ) {
return "";
}
}
}

View File

@@ -1,5 +1,6 @@
#include <string>
#include <cstdlib>
#include <vector>
namespace lime {
@@ -73,5 +74,18 @@ namespace lime {
}
std::string FileDialogFolder( const std::string &title, const std::string &text ) {
return "";
}
std::string FileDialogOpen( const std::string &title, const std::string &text, const std::vector<std::string> &fileTypes ) {
return "";
}
std::string FileDialogSave( const std::string &title, const std::string &text, const std::vector<std::string> &fileTypes ) {
return "";
}
}

View File

@@ -373,7 +373,7 @@ namespace lime {
//outZ = mAccelZ;
outX = 0;
outY = 0;
outZ = 1;
outZ = -1;
return true;
//}

View File

@@ -57,7 +57,9 @@ DEFINE_PRIM(lime_gl_version,0);
value lime_gl_enable(value inCap)
{
//#ifndef LIME_FORCE_GLES2
glEnable(val_int(inCap));
//#endif
return alloc_null();
}
DEFINE_PRIM(lime_gl_enable,1);
@@ -65,7 +67,9 @@ DEFINE_PRIM(lime_gl_enable,1);
value lime_gl_disable(value inCap)
{
//#ifndef LIME_FORCE_GLES2
glDisable(val_int(inCap));
//#endif
return alloc_null();
}
DEFINE_PRIM(lime_gl_disable,1);

View File

@@ -92,7 +92,9 @@ namespace lime {
mViewport.w = -1;
SetViewport (inRect);
//#ifndef LIME_FORCE_GLES2
glEnable (GL_BLEND);
//#endif
if (mAlphaMode == amPremultiplied)
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
@@ -238,10 +240,12 @@ namespace lime {
void OpenGLContext::FinishBitmapRender () {
#ifndef LIME_FORCE_GLES2
glDisable (GL_TEXTURE_2D);
#ifdef LIME_DITHER
glEnable (GL_DITHER);
#endif
#endif
}
@@ -325,7 +329,9 @@ namespace lime {
void OpenGLContext::Render (const RenderState &inState, const HardwareCalls &inCalls) {
//#ifndef LIME_FORCE_GLES2
glEnable (GL_BLEND);
//#endif
SetViewport (inState.mClipRect);
if (mModelView != *inState.mTransform.mMatrix) {
@@ -455,10 +461,12 @@ namespace lime {
if (boundTexture) {
boundTexture->BindFlags (draw.mBitmapRepeat, draw.mBitmapSmooth);
#ifndef LIME_FORCE_GLES2
#ifdef LIME_DITHER
if (!inSmooth)
glDisable (GL_DITHER);
#endif
#endif
} else {
@@ -523,10 +531,12 @@ namespace lime {
sgDrawCount++;
glDrawArrays (sgOpenglType[draw.mPrimType], draw.mFirst, draw.mCount);
//#ifndef LIME_FORCE_GLES2
#ifdef LIME_DITHER
if (boundTexture && !draw.mBitmapSmooth)
glEnable (GL_DITHER);
#endif
//#endif
}