Updated to love-android changeset 3b5e5e182a00

This commit is contained in:
Martin Felis
2014-01-12 21:21:46 +01:00
parent 0ff0941068
commit 69b200b144
396 changed files with 52558 additions and 2317 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+2 -2
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -25,7 +25,7 @@ namespace love
static const char cd64[]="|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq";
void b64_decode_block(char in[4], char out[3])
static void b64_decode_block(char in[4], char out[3])
{
out[0] = (char)(in[0] << 2 | in[1] >> 4);
out[1] = (char)(in[1] << 4 | in[2] >> 2);
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+42 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -86,6 +86,47 @@
# undef LOVE_BIG_ENDIAN
# define LOVE_LITTLE_ENDIAN 1
# endif
#else
# define LOVE_ENABLE_AUDIO
# define LOVE_ENABLE_AUDIO_NULL
# define LOVE_ENABLE_AUDIO_OPENAL
# define LOVE_ENABLE_BOX2D
# define LOVE_ENABLE_DDSPARSE
# define LOVE_ENABLE_ENET
# define LOVE_ENABLE_EVENT
# define LOVE_ENABLE_EVENT_SDL
# define LOVE_ENABLE_FILESYSTEM
# define LOVE_ENABLE_FILESYSTEM_PHYSFS
# define LOVE_ENABLE_FONT
# define LOVE_ENABLE_FONT_FREETYPE
# define LOVE_ENABLE_GRAPHICS
# define LOVE_ENABLE_GRAPHICS_OPENGL
# define LOVE_ENABLE_IMAGE
# define LOVE_ENABLE_IMAGE_MAGPIE
# define LOVE_ENABLE_JOYSTICK
# define LOVE_ENABLE_JOYSTICK_SDL
# define LOVE_ENABLE_KEYBOARD
# define LOVE_ENABLE_KEYBOARD_SDL
# define LOVE_ENABLE_LOVE
# define LOVE_ENABLE_LUASOCKET
# define LOVE_ENABLE_MATH
# define LOVE_ENABLE_MOUSE
# define LOVE_ENABLE_MOUSE_SDL
# define LOVE_ENABLE_NOISE1234
# define LOVE_ENABLE_PHYSICS
# define LOVE_ENABLE_PHYSICS_BOX2D
# define LOVE_ENABLE_SOUND
# define LOVE_ENABLE_SOUND_LULLABY
# define LOVE_ENABLE_SYSTEM
# define LOVE_ENABLE_SYSTEM_SDL
# define LOVE_ENABLE_THREAD
# define LOVE_ENABLE_THREAD_SDL
# define LOVE_ENABLE_TIMER
# define LOVE_ENABLE_TIMER_SDL
# define LOVE_ENABLE_UTF8
# define LOVE_ENABLE_WINDOW
# define LOVE_ENABLE_WINDOW_SDL
# define LOVE_ENABLE_WUFF
#endif
#endif // LOVE_CONFIG_H
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+2 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -671,6 +671,7 @@ StringMap<Type, TYPE_MAX_ENUM>::Entry typeEntries[] =
// Graphics
{"Drawable", GRAPHICS_DRAWABLE_ID},
{"Texture", GRAPHICS_TEXTURE_ID},
{"Image", GRAPHICS_IMAGE_ID},
{"Quad", GRAPHICS_QUAD_ID},
{"Font", GRAPHICS_FONT_ID},
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+5 -5
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -45,7 +45,7 @@ enum Type
// Graphics
GRAPHICS_DRAWABLE_ID,
GRAPHICS_DRAWQABLE_ID,
GRAPHICS_TEXTURE_ID,
GRAPHICS_IMAGE_ID,
GRAPHICS_QUAD_ID,
GRAPHICS_FONT_ID,
@@ -130,13 +130,13 @@ const bits FONT_RASTERIZER_T = (bits(1) << FONT_RASTERIZER_ID) | OBJECT_T;
// Graphics.
const bits GRAPHICS_DRAWABLE_T = (bits(1) << GRAPHICS_DRAWABLE_ID) | OBJECT_T;
const bits GRAPHICS_DRAWQABLE_T = (bits(1) << GRAPHICS_DRAWQABLE_ID) | GRAPHICS_DRAWABLE_T;
const bits GRAPHICS_IMAGE_T = (bits(1) << GRAPHICS_IMAGE_ID) | GRAPHICS_DRAWQABLE_T;
const bits GRAPHICS_TEXTURE_T = (bits(1) << GRAPHICS_TEXTURE_ID) | GRAPHICS_DRAWABLE_T;
const bits GRAPHICS_IMAGE_T = (bits(1) << GRAPHICS_IMAGE_ID) | GRAPHICS_TEXTURE_T;
const bits GRAPHICS_QUAD_T = (bits(1) << GRAPHICS_QUAD_ID) | OBJECT_T;
const bits GRAPHICS_FONT_T = (bits(1) << GRAPHICS_FONT_ID) | OBJECT_T;
const bits GRAPHICS_PARTICLE_SYSTEM_T = (bits(1) << GRAPHICS_PARTICLE_SYSTEM_ID) | GRAPHICS_DRAWABLE_T;
const bits GRAPHICS_SPRITE_BATCH_T = (bits(1) << GRAPHICS_SPRITE_BATCH_ID) | GRAPHICS_DRAWABLE_T;
const bits GRAPHICS_CANVAS_T = (bits(1) << GRAPHICS_CANVAS_ID) | GRAPHICS_DRAWQABLE_T;
const bits GRAPHICS_CANVAS_T = (bits(1) << GRAPHICS_CANVAS_ID) | GRAPHICS_TEXTURE_T;
const bits GRAPHICS_SHADER_T = (bits(1) << GRAPHICS_SHADER_ID) | OBJECT_T;
const bits GRAPHICS_MESH_T = (bits(1) << GRAPHICS_MESH_ID) | GRAPHICS_DRAWABLE_T;
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2012 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+2 -2
View File
@@ -151,9 +151,9 @@ static const struct luaL_Reg sdl_lib[] = {
int main(int argc, char **argv)
{
#ifdef __ANDROID__
SDL_SetHint("LOVE_GRAPHICS_USE_OPENGLES", "1");
SDL_LogSetAllPriority(SDL_LOG_PRIORITY_VERBOSE);
#endif
#ifdef LOVE_LEGENDARY_UTF8_ARGV_HACK
int hack_argc = 0; char **hack_argv = 0;
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+2 -2
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -51,7 +51,7 @@ public:
Source(Type type);
virtual ~Source();
virtual Source *copy() = 0;
virtual Source *clone() = 0;
virtual void play() = 0;
virtual void stop() = 0;
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+2 -2
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -36,7 +36,7 @@ Source::~Source()
{
}
love::audio::Source *Source::copy()
love::audio::Source *Source::clone()
{
this->retain();
return this;
+2 -2
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -38,7 +38,7 @@ public:
Source();
virtual ~Source();
virtual love::audio::Source *copy();
virtual love::audio::Source *clone();
virtual void play();
virtual void stop();
virtual void pause();
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+2 -2
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -37,7 +37,7 @@
#include "thread/threads.h"
// OpenAL
#ifdef LOVE_MACOSX
#ifdef LOVE_MACOSX_USE_FRAMEWORKS // Frameworks have different include paths.
#include <OpenAL-Soft/alc.h>
#include <OpenAL-Soft/al.h>
#else
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+2 -2
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -33,7 +33,7 @@
#include "thread/threads.h"
// OpenAL
#ifdef LOVE_MACOSX
#ifdef LOVE_MACOSX_USE_FRAMEWORKS
#include <OpenAL-Soft/alc.h>
#include <OpenAL-Soft/al.h>
#else
+77 -20
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -33,10 +33,22 @@ namespace audio
namespace openal
{
StaticDataBuffer::StaticDataBuffer(ALenum format, const ALvoid *data, ALsizei size, ALsizei freq)
{
alGenBuffers(1, &buffer);
alBufferData(buffer, format, data, size, freq);
}
StaticDataBuffer::~StaticDataBuffer()
{
alDeleteBuffers(1, &buffer);
}
Source::Source(Pool *pool, love::sound::SoundData *soundData)
: love::audio::Source(Source::TYPE_STATIC)
, pool(pool)
, valid(false)
, staticBuffer(nullptr)
, pitch(1.0f)
, volume(1.0f)
, relative(false)
@@ -51,14 +63,13 @@ Source::Source(Pool *pool, love::sound::SoundData *soundData)
, offsetSamples(0)
, offsetSeconds(0)
, channels(soundData->getChannels())
, decoder(0)
, decoder(nullptr)
, toLoop(0)
{
alGenBuffers(1, buffers);
ALenum fmt = getFormat(soundData->getChannels(), soundData->getBitDepth());
alBufferData(buffers[0], fmt, soundData->getData(), soundData->getSize(), soundData->getSampleRate());
staticBuffer = new StaticDataBuffer(fmt, soundData->getData(), soundData->getSize(), soundData->getSampleRate());
static float z[3] = {0, 0, 0};
float z[3] = {0, 0, 0};
setFloatv(position, z);
setFloatv(velocity, z);
@@ -69,6 +80,7 @@ Source::Source(Pool *pool, love::sound::Decoder *decoder)
: love::audio::Source(Source::TYPE_STREAM)
, pool(pool)
, valid(false)
, staticBuffer(nullptr)
, pitch(1.0f)
, volume(1.0f)
, relative(false)
@@ -87,27 +99,70 @@ Source::Source(Pool *pool, love::sound::Decoder *decoder)
, toLoop(0)
{
decoder->retain();
alGenBuffers(MAX_BUFFERS, buffers);
alGenBuffers(MAX_BUFFERS, streamBuffers);
static float z[3] = {0, 0, 0};
float z[3] = {0, 0, 0};
setFloatv(position, z);
setFloatv(velocity, z);
setFloatv(direction, z);
}
Source::Source(const Source &s)
: love::audio::Source(s.type)
, pool(s.pool)
, valid(false)
, staticBuffer(s.staticBuffer)
, pitch(s.pitch)
, volume(s.volume)
, relative(s.relative)
, looping(s.looping)
, paused(false)
, minVolume(s.minVolume)
, maxVolume(s.maxVolume)
, referenceDistance(s.referenceDistance)
, rolloffFactor(s.rolloffFactor)
, maxDistance(s.maxDistance)
, cone(s.cone)
, offsetSamples(0)
, offsetSeconds(0)
, channels(s.channels)
, decoder(nullptr)
, toLoop(0)
{
if (type == TYPE_STREAM)
{
if (s.decoder)
decoder = s.decoder->clone();
alGenBuffers(MAX_BUFFERS, streamBuffers);
}
else
staticBuffer->retain();
setFloatv(position, s.position);
setFloatv(velocity, s.velocity);
setFloatv(direction, s.direction);
}
Source::~Source()
{
if (valid)
pool->stop(this);
alDeleteBuffers((type == TYPE_STATIC) ? 1 : MAX_BUFFERS, buffers);
if (type == TYPE_STREAM)
alDeleteBuffers(MAX_BUFFERS, streamBuffers);
if (staticBuffer)
staticBuffer->release();
if (decoder)
decoder->release();
}
love::audio::Source *Source::copy()
love::audio::Source *Source::clone()
{
return 0;
return new Source(*this);
}
void Source::play()
@@ -341,13 +396,15 @@ float Source::tellAtomic(void *unit) const
break;
case Source::UNIT_SECONDS:
default:
alGetSourcef(source, AL_SAMPLE_OFFSET, &offset);
ALint buffer;
alGetSourcei(source, AL_BUFFER, &buffer);
int freq;
alGetBufferi(buffer, AL_FREQUENCY, &freq);
offset /= freq;
if (type == TYPE_STREAM) offset += offsetSeconds;
{
alGetSourcef(source, AL_SAMPLE_OFFSET, &offset);
ALint buffer;
alGetSourcei(source, AL_BUFFER, &buffer);
int freq;
alGetBufferi(buffer, AL_FREQUENCY, &freq);
offset /= freq;
if (type == TYPE_STREAM) offset += offsetSeconds;
}
break;
}
return offset;
@@ -459,7 +516,7 @@ void Source::playAtomic()
{
if (type == TYPE_STATIC)
{
alSourcei(source, AL_BUFFER, buffers[0]);
alSourcei(source, AL_BUFFER, staticBuffer->getBuffer());
}
else if (type == TYPE_STREAM)
{
@@ -467,14 +524,14 @@ void Source::playAtomic()
for (unsigned int i = 0; i < MAX_BUFFERS; i++)
{
streamAtomic(buffers[i], decoder);
streamAtomic(streamBuffers[i], decoder);
++usedBuffers;
if (decoder->isFinished())
break;
}
if (usedBuffers > 0)
alSourceQueueBuffers(source, usedBuffers, buffers);
alSourceQueueBuffers(source, usedBuffers, streamBuffers);
}
// This Source may now be associated with an OpenAL source that still has
+28 -4
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -29,7 +29,7 @@
#include "sound/Decoder.h"
// OpenAL
#ifdef LOVE_MACOSX
#ifdef LOVE_MACOSX_USE_FRAMEWORKS
#include <OpenAL-Soft/alc.h>
#include <OpenAL-Soft/al.h>
#else
@@ -47,14 +47,35 @@ namespace openal
class Audio;
class Pool;
// Basically just a reference-counted non-streaming OpenAL buffer object.
class StaticDataBuffer : public love::Object
{
public:
StaticDataBuffer(ALenum format, const ALvoid *data, ALsizei size, ALsizei freq);
virtual ~StaticDataBuffer();
inline ALuint getBuffer() const
{
return buffer;
}
private:
ALuint buffer;
}; // StaticDataBuffer
class Source : public love::audio::Source
{
public:
Source(Pool *pool, love::sound::SoundData *soundData);
Source(Pool *pool, love::sound::Decoder *decoder);
Source(const Source &s);
virtual ~Source();
virtual love::audio::Source *copy();
virtual love::audio::Source *clone();
virtual void play();
virtual void stop();
virtual void pause();
@@ -123,8 +144,11 @@ private:
Pool *pool;
ALuint source;
bool valid;
static const unsigned int MAX_BUFFERS = 32;
ALuint buffers[MAX_BUFFERS];
ALuint streamBuffers[MAX_BUFFERS];
StaticDataBuffer *staticBuffer;
float pitch;
float volume;
+5 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -304,6 +304,7 @@ static const lua_CFunction types[] =
extern "C" int luaopen_love_audio(lua_State *L)
{
#ifdef LOVE_ENABLE_AUDIO_OPENAL
if (instance == 0)
{
// Try OpenAL first.
@@ -318,7 +319,9 @@ extern "C" int luaopen_love_audio(lua_State *L)
}
else
instance->retain();
#endif
#ifdef LOVE_ENABLE_AUDIO_NULL
if (instance == 0)
{
// Fall back to nullaudio.
@@ -331,6 +334,7 @@ extern "C" int luaopen_love_audio(lua_State *L)
std::cout << e.what() << std::endl;
}
}
#endif
if (instance == 0)
return luaL_error(L, "Could not open any audio module.");
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+18 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -18,6 +18,8 @@
* 3. This notice may not be removed or altered from any source distribution.
**/
#include <limits>
#include "wrap_Source.h"
namespace love
@@ -30,6 +32,15 @@ Source *luax_checksource(lua_State *L, int idx)
return luax_checktype<Source>(L, idx, "Source", AUDIO_SOURCE_T);
}
int w_Source_clone(lua_State *L)
{
Source *t = luax_checksource(L, 1);
Source *clone = nullptr;
EXCEPT_GUARD(clone = t->clone();)
luax_pushtype(L, "Source", AUDIO_SOURCE_T, clone);
return 1;
}
int w_Source_play(lua_State *L)
{
Source *t = luax_checksource(L, 1);
@@ -69,6 +80,10 @@ int w_Source_setPitch(lua_State *L)
{
Source *t = luax_checksource(L, 1);
float p = (float)luaL_checknumber(L, 2);
if (p > std::numeric_limits<lua_Number>::max() ||
p < std::numeric_limits<lua_Number>::min() ||
p != p)
return luaL_error(L, "Pitch has to be finite and not NaN.");
t->setPitch(p);
return 0;
}
@@ -333,6 +348,8 @@ int w_Source_getChannels(lua_State *L)
static const luaL_Reg functions[] =
{
{ "clone", w_Source_clone },
{ "play", w_Source_play },
{ "stop", w_Source_stop },
{ "pause", w_Source_pause },
+2 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -30,6 +30,7 @@ namespace audio
{
Source *luax_checksource(lua_State *L, int idx);
int w_Source_clone(lua_State *L);
int w_Source_play(lua_State *L);
int w_Source_stop(lua_State *L);
int w_Source_pause(lua_State *L);
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -25,7 +25,7 @@
#include "filesystem/File.h"
// PhysFS
#ifdef LOVE_MACOSX // wacky Mac behavior means different #include syntax!
#ifdef LOVE_MACOSX_USE_FRAMEWORKS
#include <physfs/physfs.h>
#else
#include <physfs.h>
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -197,20 +197,6 @@ public:
**/
bool remove(const char *file);
/**
* Opens a file for reading or writing. (Depends
* on the mode chosen at the time of creation).
* @param file The file to open.
* @param mode The mode to open the file in.
**/
bool open(File *file, File::Mode mode);
/**
* Closes a file.
* @param file The file to close.
**/
bool close(File *file);
/**
* Reads data from a file.
* @param filename The name of the file to read from.
@@ -234,24 +220,6 @@ public:
**/
void append(const char *filename, const void *data, int64 size) const;
/**
* Check if end-of-file is reached.
* @return True if EOF, false otherwise.
**/
bool eof(File *file);
/**
* Gets the current position in a file.
* @param file An open File.
**/
int tell(File *file);
/**
* Seek to a position within a file.
* @param pos The position to seek to.
**/
bool seek(File *file, uint64 pos);
/**
* This "native" method returns a table of all
* files in a given directory.
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -493,7 +493,10 @@ int loader(lua_State *L)
}
}
lua_pushfstring(L, "\n\tno file \"%s\" in LOVE game directories.\n", (tmp + ".lua").c_str());
std::string errstr = "\n\tno file '%s' in LOVE game directories.";
errstr += errstr;
lua_pushfstring(L, errstr.c_str(), (tmp + ".lua").c_str(), (tmp + "/init.lua").c_str());
return 1;
}
@@ -529,7 +532,7 @@ int extloader(lua_State *L)
if (!handle)
{
lua_pushfstring(L, "\n\tno extension \"%s\" in LOVE paths.\n", filename);
lua_pushfstring(L, "\n\tno file '%s' in LOVE paths.", tokenized_name.c_str());
return 1;
}
@@ -540,7 +543,7 @@ int extloader(lua_State *L)
if (!func)
{
SDL_UnloadObject(handle);
lua_pushfstring(L, "\n\textension \"%s\" is incompatible.\n", filename);
lua_pushfstring(L, "\n\tC library '%s' is incompatible.", tokenized_name.c_str());
return 1;
}
@@ -599,8 +602,9 @@ extern "C" int luaopen_love_filesystem(lua_State *L)
else
instance->retain();
love::luax_register_searcher(L, loader, 1);
love::luax_register_searcher(L, extloader, 2);
// The love loaders should be tried after package.preload.
love::luax_register_searcher(L, loader, 2);
love::luax_register_searcher(L, extloader, 3);
WrappedModule w;
w.module = instance;
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+2 -2
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -36,7 +36,7 @@ namespace font
GlyphData::GlyphData(uint32 glyph, GlyphMetrics glyphMetrics, GlyphData::Format f)
: glyph(glyph)
, metrics(glyphMetrics)
, data(0)
, data(nullptr)
, format(f)
{
if (metrics.width > 0 && metrics.height > 0)
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+5 -7
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -25,15 +25,13 @@
#include "font/Font.h"
// FreeType2
#ifdef LOVE_MACOSX
#ifdef LOVE_MACOSX_USE_FRAMEWORKS
#include <freetype/ft2build.h>
#else
#include <ft2build.h>
#endif
#include <freetype/freetype.h>
#include <freetype/ftglyph.h>
#include <freetype/ftoutln.h>
#include <freetype/fttrigon.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
namespace love
{
@@ -73,4 +71,4 @@ private:
} // font
} // love
#endif // LOVE_FONT_FREETYPE_FONT_H
#endif // LOVE_FONT_FREETYPE_FONT_H
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -34,11 +34,11 @@ TrueTypeRasterizer::TrueTypeRasterizer(FT_Library library, Data *data, int size)
: data(data)
{
if (FT_New_Memory_Face(library,
(const FT_Byte *)data->getData(), /* first byte in memory */
data->getSize(), /* size in bytes */
0, /* face_index */
&face))
throw love::Exception("TrueTypeFont Loading error: FT_New_Face failed (there is probably a problem with your font file)\n");
(const FT_Byte *)data->getData(), /* first byte in memory */
data->getSize(), /* size in bytes */
0, /* face_index */
&face))
throw love::Exception("TrueTypeFont Loading error: FT_New_Face failed (there is probably a problem with your font file)");
FT_Set_Pixel_Sizes(face, size, size);
@@ -70,39 +70,67 @@ GlyphData *TrueTypeRasterizer::getGlyphData(uint32 glyph) const
// Initialize
if (FT_Load_Glyph(face, FT_Get_Char_Index(face, glyph), FT_LOAD_DEFAULT))
throw love::Exception("TrueTypeFont Loading vm->error: FT_Load_Glyph failed\n");
throw love::Exception("TrueTypeFont Loading error: FT_Load_Glyph failed");
if (FT_Get_Glyph(face->glyph, &ftglyph))
throw love::Exception("TrueTypeFont Loading vm->error: FT_Get_Glyph failed\n");
throw love::Exception("TrueTypeFont Loading error: FT_Get_Glyph failed");
FT_Glyph_To_Bitmap(&ftglyph, FT_RENDER_MODE_NORMAL, 0, 1);
FT_BitmapGlyph bitmap_glyph = (FT_BitmapGlyph) ftglyph;
FT_Bitmap &bitmap = bitmap_glyph->bitmap; //just to make things easier
// Get metrics
glyphMetrics.bearingX = face->glyph->metrics.horiBearingX >> 6;
glyphMetrics.bearingY = face->glyph->metrics.horiBearingY >> 6;
glyphMetrics.bearingX = bitmap_glyph->left;
glyphMetrics.bearingY = bitmap_glyph->top;
glyphMetrics.height = bitmap.rows;
glyphMetrics.width = bitmap.width;
glyphMetrics.advance = face->glyph->metrics.horiAdvance >> 6;
glyphMetrics.advance = ftglyph->advance.x >> 16;
GlyphData *glyphData = new GlyphData(glyph, glyphMetrics, GlyphData::FORMAT_LUMINANCE_ALPHA);
int size = bitmap.rows * bitmap.width;
unsigned char *dst = (unsigned char *) glyphData->getData();
const uint8 *pixels = bitmap.buffer;
uint8 *dest = (uint8 *) glyphData->getData();
// Note that bitmap.buffer contains only luminosity. We copy that single
// value to our luminosity-alpha format.
for (int i = 0; i < size; i++)
// We treat the luminance of the FreeType bitmap as alpha in the GlyphData.
if (bitmap.pixel_mode == FT_PIXEL_MODE_MONO)
{
dst[2*i] = 255;
dst[2*i+1] = bitmap.buffer[i];
for (int y = 0; y < bitmap.rows; y++)
{
for (int x = 0; x < bitmap.width; x++)
{
// Extract the 1-bit value and convert it to uint8.
uint8 v = ((pixels[x / 8]) & (1 << (7 - (x % 8)))) ? 255 : 0;
dest[2 * (y * bitmap.width + x) + 0] = 255;
dest[2 * (y * bitmap.width + x) + 1] = v;
}
pixels += bitmap.pitch;
}
}
else if (bitmap.pixel_mode == FT_PIXEL_MODE_GRAY)
{
for (int y = 0; y < bitmap.rows; y++)
{
for (int x = 0; x < bitmap.width; x++)
{
dest[2 * (y * bitmap.width + x) + 0] = 255;
dest[2 * (y * bitmap.width + x) + 1] = pixels[x];
}
pixels += bitmap.pitch;
}
}
else
{
delete glyphData;
FT_Done_Glyph(ftglyph);
throw love::Exception("Unknown TrueType glyph pixel mode.");
}
// Having copied the data over, we can destroy the glyph
// Having copied the data over, we can destroy the glyph.
FT_Done_Glyph(ftglyph);
// Return data
return glyphData;
}
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -27,10 +27,8 @@
// TrueType2
#include <ft2build.h>
#include <freetype/freetype.h>
#include <freetype/ftglyph.h>
#include <freetype/ftoutln.h>
#include <freetype/fttrigon.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
namespace love
{
@@ -67,4 +65,4 @@ private:
} // font
} // love
#endif // LOVE_FONT_FREETYPE_TRUE_TYPE_RASTERIZER_H
#endif // LOVE_FONT_FREETYPE_TRUE_TYPE_RASTERIZER_H
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
-65
View File
@@ -1,65 +0,0 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#ifndef LOVE_GRAPHICS_DRAWQABLE_H
#define LOVE_GRAPHICS_DRAWQABLE_H
// LOVE
#include "Drawable.h"
#include "Quad.h"
namespace love
{
namespace graphics
{
/**
* A DrawQable is anything that be drawn in part with a Quad object.
**/
class DrawQable : public Drawable
{
public:
/**
* Destructor.
**/
virtual ~DrawQable() {}
/**
* Draws the object with the specified transformation.
*
* @param quad The Quad object to use to draw the object.
* @param x The position of the object along the x-axis.
* @param y The position of the object along the y-axis.
* @param angle The angle of the object (in radians).
* @param sx The scale factor along the x-axis.
* @param sy The scale factor along the y-axis.
* @param ox The origin offset along the x-axis.
* @param oy The origin offset along the y-axis.
* @param kx Shear along the x-axis.
* @param ky Shear along the y-axis.
**/
virtual void drawq(Quad *quad, float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky) const = 0;
};
} // graphics
} // love
#endif // LOVE_GRAPHICS_DRAWQABLE_H
+2 -2
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -40,7 +40,7 @@ public:
/**
* Destructor.
**/
virtual ~Drawable();
virtual ~Drawable() {}
/**
* Draws the object with the specified transformation.
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
-96
View File
@@ -1,96 +0,0 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#include "Image.h"
namespace love
{
namespace graphics
{
Image::Filter Image::defaultFilter;
Image::Filter::Filter()
: min(FILTER_LINEAR)
, mag(FILTER_LINEAR)
, mipmap(FILTER_NONE)
, anisotropy(1.0f)
{
}
Image::Wrap::Wrap()
: s(WRAP_CLAMP)
, t(WRAP_CLAMP)
{
}
Image::~Image()
{
}
void Image::setDefaultFilter(const Filter &f)
{
defaultFilter = f;
}
const Image::Filter &Image::getDefaultFilter()
{
return defaultFilter;
}
bool Image::getConstant(const char *in, FilterMode &out)
{
return filterModes.find(in, out);
}
bool Image::getConstant(FilterMode in, const char *&out)
{
return filterModes.find(in, out);
}
bool Image::getConstant(const char *in, WrapMode &out)
{
return wrapModes.find(in, out);
}
bool Image::getConstant(WrapMode in, const char *&out)
{
return wrapModes.find(in, out);
}
StringMap<Image::FilterMode, Image::FILTER_MAX_ENUM>::Entry Image::filterModeEntries[] =
{
{ "linear", Image::FILTER_LINEAR },
{ "nearest", Image::FILTER_NEAREST },
};
StringMap<Image::FilterMode, Image::FILTER_MAX_ENUM> Image::filterModes(Image::filterModeEntries, sizeof(Image::filterModeEntries));
StringMap<Image::WrapMode, Image::WRAP_MAX_ENUM>::Entry Image::wrapModeEntries[] =
{
{ "clamp", Image::WRAP_CLAMP },
{ "repeat", Image::WRAP_REPEAT },
};
StringMap<Image::WrapMode, Image::WRAP_MAX_ENUM> Image::wrapModes(Image::wrapModeEntries, sizeof(Image::wrapModeEntries));
} // graphics
} // love
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2006-2013 LOVE Development Team
* Copyright (c) 2006-2014 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages

Some files were not shown because too many files have changed in this diff Show More