mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
merge default into minor
--HG-- branch : minor
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2011 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
|
||||
@@ -26,10 +26,10 @@ namespace love
|
||||
// Version stuff.
|
||||
const int VERSION_MAJOR = 0;
|
||||
const int VERSION_MINOR = 7;
|
||||
const int VERSION_REV = 0;
|
||||
const int VERSION_REV = 1;
|
||||
const int VERSION = VERSION_MAJOR*100 + VERSION_MINOR*10 + VERSION_REV;
|
||||
const int VERSION_COMPATIBILITY[] = { VERSION, 0 };
|
||||
const char * VERSION_STR = "0.7.0";
|
||||
const int VERSION_COMPATIBILITY[] = { VERSION, 070, 0 };
|
||||
const char * VERSION_STR = "0.7.1";
|
||||
const char * VERSION_CODENAME = "Game Slave";
|
||||
|
||||
} // love
|
||||
|
||||
@@ -228,6 +228,8 @@ namespace event
|
||||
{"power", love::keyboard::Keyboard::KEY_POWER},
|
||||
{"euro", love::keyboard::Keyboard::KEY_EURO},
|
||||
{"undo", love::keyboard::Keyboard::KEY_UNDO},
|
||||
|
||||
{"unknown", love::keyboard::Keyboard::KEY_UNKNOWN},
|
||||
};
|
||||
|
||||
StringMap<love::keyboard::Keyboard::Key, love::keyboard::Keyboard::KEY_MAX_ENUM> Event::keys(Event::keyEntries, sizeof(Event::keyEntries));
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace sdl
|
||||
case Event::TYPE_KEY_PRESSED:
|
||||
e.type = SDL_KEYDOWN;
|
||||
e.key.keysym.unicode = (Uint16)m.keyboard.u;
|
||||
return keys.find(m.keyboard.k, e.key.keysym.sym);;
|
||||
return keys.find(m.keyboard.k, e.key.keysym.sym);
|
||||
case Event::TYPE_KEY_RELEASED:
|
||||
e.type = SDL_KEYUP;
|
||||
return keys.find(m.keyboard.k, e.key.keysym.sym);
|
||||
@@ -290,6 +290,8 @@ namespace sdl
|
||||
{ love::keyboard::Keyboard::KEY_POWER, SDLK_POWER },
|
||||
{ love::keyboard::Keyboard::KEY_EURO, SDLK_EURO },
|
||||
{ love::keyboard::Keyboard::KEY_UNDO, SDLK_UNDO },
|
||||
|
||||
{ love::keyboard::Keyboard::KEY_UNKNOWN, SDLK_UNKNOWN },
|
||||
};
|
||||
|
||||
EnumMap<love::keyboard::Keyboard::Key, SDLKey, love::keyboard::Keyboard::KEY_MAX_ENUM> Event::keys(Event::keyEntries, sizeof(Event::keyEntries));
|
||||
|
||||
@@ -110,8 +110,8 @@ namespace physfs
|
||||
{
|
||||
bool isOpen = (file != 0);
|
||||
|
||||
if(!isOpen)
|
||||
open(READ);
|
||||
if(!isOpen && !open(READ))
|
||||
throw love::Exception("Could not read file %s.", filename.c_str());
|
||||
|
||||
int max = (int)PHYSFS_fileLength(file);
|
||||
size = (size == ALL) ? max : size;
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#include <common/config.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <common/utf8.h>
|
||||
#include <common/b64.h>
|
||||
|
||||
|
||||
@@ -218,7 +218,12 @@ namespace physfs
|
||||
|
||||
int w_load(lua_State * L)
|
||||
{
|
||||
return instance->load(L);
|
||||
try {
|
||||
return instance->load(L);
|
||||
}
|
||||
catch (love::Exception & e) {
|
||||
return luaL_error(L, e.what());
|
||||
}
|
||||
}
|
||||
|
||||
int w_getLastModified(lua_State * L)
|
||||
|
||||
@@ -165,20 +165,24 @@ namespace opengl
|
||||
|
||||
// Get caption.
|
||||
|
||||
// Special case for fullscreen -> windowed. Windows XP did not
|
||||
// work well with "normal" display mode change in this case.
|
||||
// The application window does leave fullscreen, but the desktop
|
||||
// resolution does not revert to the correct one. Restarting the
|
||||
// SDL video subsystem does the trick, though.
|
||||
if( currentMode.fullscreen && !fullscreen )
|
||||
// We need to restart the subsystem for two reasons:
|
||||
// 1) Special case for fullscreen -> windowed. Windows XP did not
|
||||
// work well with "normal" display mode change in this case.
|
||||
// The application window does leave fullscreen, but the desktop
|
||||
// resolution does not revert to the correct one. Restarting the
|
||||
// SDL video subsystem does the trick, though.
|
||||
// 2) Restart the event system (for whatever reason the event system
|
||||
// started and stopped with SDL_INIT_VIDEO, see:
|
||||
// http://sdl.beuc.net/sdl.wiki/Introduction_to_Events)
|
||||
// because the mouse position will not be able to exceed
|
||||
// the previous' video mode window size (i.e. alway
|
||||
// love.mouse.getX() < 800 when switching from 800x600 to a
|
||||
// higher resolution)
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
if(SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
|
||||
{
|
||||
// Restart.
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
if(SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
|
||||
{
|
||||
std::cout << "Could not init SDL_VIDEO: " << SDL_GetError() << std::endl;
|
||||
return false;
|
||||
}
|
||||
std::cout << "Could not init SDL_VIDEO: " << SDL_GetError() << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set caption.
|
||||
@@ -299,14 +303,11 @@ namespace opengl
|
||||
bool Graphics::toggleFullscreen()
|
||||
{
|
||||
// Try to do the change.
|
||||
if(!setMode(currentMode.width,
|
||||
return setMode(currentMode.width,
|
||||
currentMode.height,
|
||||
!currentMode.fullscreen,
|
||||
currentMode.vsync,
|
||||
currentMode.fsaa))
|
||||
return false;
|
||||
currentMode.fullscreen = !currentMode.fullscreen;
|
||||
return true;
|
||||
currentMode.fsaa);
|
||||
}
|
||||
|
||||
|
||||
@@ -829,20 +830,20 @@ namespace opengl
|
||||
|
||||
if (args % 2) // an odd number of arguments, no good for a polyline
|
||||
return luaL_error(L, "Number of vertices must be a multiple of two");
|
||||
else if (args < 4)
|
||||
return luaL_error(L, "Need at least two vertices to draw a line");
|
||||
|
||||
// right, let's draw this polyline, then
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glBegin(GL_LINE_STRIP);
|
||||
if (table) {
|
||||
lua_pushnil(L);
|
||||
while (true) {
|
||||
if(lua_next(L, 1) == 0) break;
|
||||
GLfloat x = (GLfloat)lua_tonumber(L, -1);
|
||||
lua_pop(L, 1); // pop value
|
||||
if(lua_next(L, 1) == 0) break;
|
||||
GLfloat y = (GLfloat)lua_tonumber(L, -1);
|
||||
lua_pop(L, 1); // pop value
|
||||
glVertex2f(x, y);
|
||||
for (int i = 1; i < args; i += 2) {
|
||||
lua_pushnumber(L, i); // x coordinate
|
||||
lua_rawget(L, 1);
|
||||
lua_pushnumber(L, i+1); // y coordinate
|
||||
lua_rawget(L, 1);
|
||||
glVertex2f((GLfloat)lua_tonumber(L, -2), (GLfloat)lua_tonumber(L, -1));
|
||||
lua_pop(L, 2);
|
||||
}
|
||||
} else {
|
||||
for (int i = 1; i < args; i+=2) {
|
||||
|
||||
@@ -452,7 +452,12 @@ namespace opengl
|
||||
// Convert to Data, if necessary.
|
||||
if(luax_istype(L, 1, FILESYSTEM_FILE_T)) {
|
||||
love::filesystem::File * f = luax_checktype<love::filesystem::File>(L, 1, "File", FILESYSTEM_FILE_T);
|
||||
Data * d = f->read();
|
||||
Data * d;
|
||||
try {
|
||||
d = f->read();
|
||||
} catch (love::Exception & e) {
|
||||
return luaL_error(L, e.what());
|
||||
}
|
||||
lua_remove(L, 1); // get rid of the file
|
||||
luax_newtype(L, "Data", DATA_T, (void*)d);
|
||||
lua_insert(L, 1); // put it at the bottom of the stack
|
||||
|
||||
@@ -239,7 +239,7 @@ namespace devil
|
||||
case EncodedImageData::FORMAT_TGA:
|
||||
default: // TGA is the default format
|
||||
headerLen = 18;
|
||||
bpp = 3;
|
||||
bpp = 4;
|
||||
size = h * w * bpp;
|
||||
data = new ILubyte[size + headerLen];
|
||||
// here's the header for the Targa file format.
|
||||
@@ -257,23 +257,12 @@ namespace devil
|
||||
data[14] = h & 255; // least significant byte of height
|
||||
data[15] = h >> 8; // most significant byte of height
|
||||
data[16] = bpp * 8; // bits per pixel
|
||||
data[17] = 0; // descriptor bits
|
||||
data[17] = 0x20; // descriptor bits (flip bits: 0x10 horizontal, 0x20 vertical)
|
||||
// header done. write the pixel data to TGA:
|
||||
data += headerLen;
|
||||
ilCopyPixels(0,0,0,w,h,1,IL_BGR,IL_UNSIGNED_BYTE,data); // convert the pixels to BGR (remember, little-endian) and copy them to data
|
||||
ilCopyPixels(0,0,0,w,h,1,IL_BGRA,IL_UNSIGNED_BYTE,data); // convert the pixels to BGRA (remember, little-endian) and copy them to data
|
||||
|
||||
// It's Targa, so we have to flip the image.
|
||||
row = w * bpp;
|
||||
ILubyte * temp = new ILubyte[row];
|
||||
ILubyte * src = data - row;
|
||||
ILubyte * dst = data + size;
|
||||
for (int i = 0; i < (h >> 1); i++) {
|
||||
memcpy(temp,src+=row,row);
|
||||
memcpy(src,dst-=row,row);
|
||||
memcpy(dst,temp,row);
|
||||
}
|
||||
data -= headerLen;
|
||||
delete [] temp;
|
||||
}
|
||||
return new EncodedImageData(data, f, size + headerLen, freeData);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2011 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
|
||||
@@ -197,4 +197,4 @@ namespace keyboard
|
||||
} // keyboard
|
||||
} // love
|
||||
|
||||
#endif // LOVE_KEYBOARD_KEYBOARD_H
|
||||
#endif // LOVE_KEYBOARD_KEYBOARD_H
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2011 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
|
||||
@@ -34,14 +34,14 @@ namespace sdl
|
||||
bool Keyboard::isDown(Key key) const
|
||||
{
|
||||
SDLKey k;
|
||||
|
||||
|
||||
if(keys.find(key, k))
|
||||
{
|
||||
{
|
||||
Uint8 * keystate = SDL_GetKeyState(0);
|
||||
return keystate[(unsigned)k] == 1;
|
||||
return keystate[(unsigned)k] == 1;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
void Keyboard::setKeyRepeat(int delay, int interval) const
|
||||
@@ -58,7 +58,7 @@ namespace sdl
|
||||
SDL_GetKeyRepeat(&delay, &interval);
|
||||
return delay;
|
||||
}
|
||||
|
||||
|
||||
int Keyboard::getKeyRepeatInterval() const
|
||||
{
|
||||
int delay, interval = 0;
|
||||
@@ -66,7 +66,7 @@ namespace sdl
|
||||
return interval;
|
||||
}
|
||||
|
||||
EnumMap<Keyboard::Key, SDLKey, Keyboard::KEY_MAX_ENUM>::Entry Keyboard::keyEntries[] =
|
||||
EnumMap<Keyboard::Key, SDLKey, Keyboard::KEY_MAX_ENUM>::Entry Keyboard::keyEntries[] =
|
||||
{
|
||||
{ Keyboard::KEY_BACKSPACE, SDLK_BACKSPACE},
|
||||
{ Keyboard::KEY_TAB, SDLK_TAB},
|
||||
|
||||
@@ -37,8 +37,9 @@ namespace box2d
|
||||
def->radius = body->world->scaleDown(def->radius);
|
||||
radius = def->radius;
|
||||
this->localPosition = def->localPosition;
|
||||
|
||||
def->userData = (void*)data;
|
||||
shape = body->body->CreateShape(def);
|
||||
shape->SetUserData((void*)data);
|
||||
}
|
||||
|
||||
CircleShape::~CircleShape()
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace physics
|
||||
namespace box2d
|
||||
{
|
||||
DistanceJoint::DistanceJoint(Body * body1, Body * body2, float x1, float y1, float x2, float y2)
|
||||
: Joint(body1, body2)
|
||||
: Joint(body1, body2), joint(NULL)
|
||||
{
|
||||
b2DistanceJointDef def;
|
||||
def.Initialize(body1->body, body2->body, world->scaleDown(b2Vec2(x1,y1)), world->scaleDown(b2Vec2(x2,y2)));
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace physics
|
||||
namespace box2d
|
||||
{
|
||||
GearJoint::GearJoint(Joint * joint1, Joint * joint2, float ratio)
|
||||
: Joint(joint1->body2, joint2->body2)
|
||||
: Joint(joint1->body2, joint2->body2), joint(NULL)
|
||||
{
|
||||
b2GearJointDef def;
|
||||
def.joint1 = joint1->joint;
|
||||
|
||||
@@ -117,7 +117,8 @@ namespace box2d
|
||||
|
||||
void Joint::destroyJoint(b2Joint * joint)
|
||||
{
|
||||
world->world->DestroyJoint(joint);
|
||||
if (joint != NULL)
|
||||
world->world->DestroyJoint(joint);
|
||||
}
|
||||
|
||||
} // box2d
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace physics
|
||||
namespace box2d
|
||||
{
|
||||
MouseJoint::MouseJoint(Body * body1, float x, float y)
|
||||
: Joint(body1)
|
||||
: Joint(body1), joint(NULL)
|
||||
{
|
||||
b2MouseJointDef def;
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ namespace box2d
|
||||
for(int i = 0; i<def->vertexCount; i++)
|
||||
def->vertices[i] = body->world->scaleDown(def->vertices[i]);
|
||||
|
||||
def->userData = (void*)data;
|
||||
shape = body->body->CreateShape(def);
|
||||
shape->SetUserData((void*)data);
|
||||
}
|
||||
|
||||
PolygonShape::~PolygonShape()
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace physics
|
||||
namespace box2d
|
||||
{
|
||||
PrismaticJoint::PrismaticJoint(Body * body1, Body * body2, float x, float y, float ax, float ay)
|
||||
: Joint(body1, body2)
|
||||
: Joint(body1, body2), joint(NULL)
|
||||
{
|
||||
b2PrismaticJointDef def;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace physics
|
||||
namespace box2d
|
||||
{
|
||||
PulleyJoint::PulleyJoint(Body * body1, Body * body2, b2Vec2 groundAnchor1, b2Vec2 groundAnchor2, b2Vec2 anchor1, b2Vec2 anchor2, float ratio)
|
||||
: Joint(body1, body2)
|
||||
: Joint(body1, body2), joint(NULL)
|
||||
{
|
||||
b2PulleyJointDef def;
|
||||
def.Initialize(body1->body, body2->body, world->scaleDown(groundAnchor1), world->scaleDown(groundAnchor2), \
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace physics
|
||||
namespace box2d
|
||||
{
|
||||
RevoluteJoint::RevoluteJoint(Body * body1, Body * body2, float x, float y)
|
||||
: Joint(body1, body2)
|
||||
: Joint(body1, body2), joint(NULL)
|
||||
{
|
||||
b2RevoluteJointDef def;
|
||||
def.Initialize(body1->body, body2->body, world->scaleDown(b2Vec2(x,y)));
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace physics
|
||||
namespace box2d
|
||||
{
|
||||
Shape::Shape(Body * body)
|
||||
: body(body)
|
||||
: body(body), shape(NULL)
|
||||
{
|
||||
body->retain();
|
||||
data = new shapeudata();
|
||||
@@ -49,7 +49,8 @@ namespace box2d
|
||||
delete data;
|
||||
data = 0;
|
||||
|
||||
body->body->DestroyShape(shape);
|
||||
if (shape)
|
||||
body->body->DestroyShape(shape);
|
||||
shape = 0;
|
||||
|
||||
body->release();
|
||||
|
||||
@@ -96,14 +96,14 @@ namespace box2d
|
||||
}
|
||||
|
||||
World::World(b2AABB aabb)
|
||||
: meter(DEFAULT_METER)
|
||||
: meter(DEFAULT_METER), world(NULL)
|
||||
{
|
||||
world = new b2World(scaleDown(aabb), b2Vec2(0,0), true);
|
||||
world->SetContactListener(this);
|
||||
}
|
||||
|
||||
World::World(b2AABB aabb, b2Vec2 gravity, bool sleep, int meter)
|
||||
: meter(meter)
|
||||
: meter(meter), world(NULL)
|
||||
{
|
||||
world = new b2World(scaleDown(aabb), scaleDown(gravity), sleep);
|
||||
world->SetContactListener(this);
|
||||
|
||||
@@ -38,7 +38,19 @@ namespace lullaby
|
||||
settings.mBits = 16;
|
||||
settings.mFrequency = sampleRate;
|
||||
settings.mResamplingMode = MODPLUG_RESAMPLE_LINEAR;
|
||||
|
||||
// fill with modplug defaults (modplug _memsets_, so we could get
|
||||
// garbage settings when the struct is only partially initialized)
|
||||
settings.mStereoSeparation = 128;
|
||||
settings.mMaxMixChannels = 32;
|
||||
settings.mReverbDepth = 0;
|
||||
settings.mReverbDelay = 0;
|
||||
settings.mBassAmount = 0;
|
||||
settings.mBassRange = 0;
|
||||
settings.mSurroundDepth = 0;
|
||||
settings.mSurroundDelay = 0;
|
||||
settings.mLoopCount = 0;
|
||||
|
||||
ModPlug_SetSettings(&settings);
|
||||
|
||||
// Load the module.
|
||||
@@ -47,7 +59,8 @@ namespace lullaby
|
||||
if(plug == 0)
|
||||
throw love::Exception("Could not load file with ModPlug.");
|
||||
|
||||
ModPlug_SetMasterVolume(plug, 512);
|
||||
// set master volume for delicate ears
|
||||
ModPlug_SetMasterVolume(plug, 128);
|
||||
}
|
||||
|
||||
ModPlugDecoder::~ModPlugDecoder()
|
||||
@@ -101,7 +114,7 @@ namespace lullaby
|
||||
// Let's reload.
|
||||
ModPlug_Unload(plug);
|
||||
plug = ModPlug_Load(data->getData(), data->getSize());
|
||||
ModPlug_SetMasterVolume(plug, 512);
|
||||
ModPlug_SetMasterVolume(plug, 128);
|
||||
eof = false;
|
||||
return (plug != 0);
|
||||
}
|
||||
|
||||
@@ -77,14 +77,14 @@ namespace sdl
|
||||
Thread *t = luax_checkthread(L, 1);
|
||||
std::string name = luax_checklstring(L, 2);
|
||||
t->lock();
|
||||
ThreadVariant *v = t->get(name);
|
||||
ThreadVariant *v = t->receive(name);
|
||||
t->clear(name);
|
||||
t->unlock();
|
||||
if (!v)
|
||||
{
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
t->clear(name);
|
||||
t->unlock();
|
||||
switch(v->type)
|
||||
{
|
||||
case BOOLEAN:
|
||||
@@ -123,13 +123,13 @@ namespace sdl
|
||||
std::string name = luax_checklstring(L, 2);
|
||||
t->lock();
|
||||
ThreadVariant *v = t->demand(name);
|
||||
t->clear(name);
|
||||
t->unlock();
|
||||
if (!v)
|
||||
{
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
t->clear(name);
|
||||
t->unlock();
|
||||
switch(v->type)
|
||||
{
|
||||
case BOOLEAN:
|
||||
@@ -166,7 +166,9 @@ namespace sdl
|
||||
{
|
||||
Thread *t = luax_checkthread(L, 1);
|
||||
std::string name = luax_checklstring(L, 2);
|
||||
ThreadVariant *v = t->get(name);
|
||||
t->lock();
|
||||
ThreadVariant *v = t->receive(name);
|
||||
t->unlock();
|
||||
if (!v)
|
||||
{
|
||||
lua_pushnil(L);
|
||||
@@ -282,7 +284,14 @@ namespace sdl
|
||||
if (lua_isstring(L, 2))
|
||||
luax_convobj(L, 2, "filesystem", "newFile");
|
||||
if (luax_istype(L, 2, FILESYSTEM_FILE_T))
|
||||
data = luax_checktype<love::filesystem::File>(L, 2, "File", FILESYSTEM_FILE_T)->read();
|
||||
{
|
||||
Data * d;
|
||||
try {
|
||||
data = luax_checktype<love::filesystem::File>(L, 2, "File", FILESYSTEM_FILE_T)->read();
|
||||
} catch (love::Exception & e) {
|
||||
return luaL_error(L, e.what());
|
||||
}
|
||||
}
|
||||
else
|
||||
data = luax_checktype<love::Data>(L, 2, "Data", DATA_T);
|
||||
Thread *t = instance->newThread(name, data);
|
||||
@@ -300,12 +309,12 @@ namespace sdl
|
||||
lua_newtable(L);
|
||||
for (unsigned int i = 0; i<count; i++)
|
||||
{
|
||||
// allow names containing \0
|
||||
lua_pushlstring(L, list[i]->getName().c_str(), list[i]->getName().length());
|
||||
luax_newtype(L, "Thread", THREAD_THREAD_T, (void*) list[i]);
|
||||
list[i]->lock();
|
||||
list[i]->retain();
|
||||
list[i]->unlock();
|
||||
// allow names containing \0
|
||||
lua_pushlstring(L, list[i]->getName().c_str(), list[i]->getName().length());
|
||||
lua_settable(L, -3);
|
||||
}
|
||||
delete[] list;
|
||||
|
||||
+28
-92
@@ -24,98 +24,34 @@ namespace love
|
||||
// [audio.lua]
|
||||
const unsigned char audio_lua[] =
|
||||
{
|
||||
0x2D,0x2D,0x5B,0x5B,0x0D,0x0A,0x43,0x6F,0x70,0x79,0x72,0x69,0x67,0x68,0x74,
|
||||
0x20,0x28,0x63,0x29,0x20,0x32,0x30,0x30,0x36,0x2D,0x32,0x30,0x31,0x30,0x20,
|
||||
0x4C,0x4F,0x56,0x45,0x20,0x44,0x65,0x76,0x65,0x6C,0x6F,0x70,0x6D,0x65,0x6E,
|
||||
0x74,0x20,0x54,0x65,0x61,0x6D,0x0D,0x0A,0x0D,0x0A,0x54,0x68,0x69,0x73,0x20,
|
||||
0x73,0x6F,0x66,0x74,0x77,0x61,0x72,0x65,0x20,0x69,0x73,0x20,0x70,0x72,0x6F,
|
||||
0x76,0x69,0x64,0x65,0x64,0x20,0x27,0x61,0x73,0x2D,0x69,0x73,0x27,0x2C,0x20,
|
||||
0x77,0x69,0x74,0x68,0x6F,0x75,0x74,0x20,0x61,0x6E,0x79,0x20,0x65,0x78,0x70,
|
||||
0x72,0x65,0x73,0x73,0x20,0x6F,0x72,0x20,0x69,0x6D,0x70,0x6C,0x69,0x65,0x64,
|
||||
0x0D,0x0A,0x77,0x61,0x72,0x72,0x61,0x6E,0x74,0x79,0x2E,0x20,0x20,0x49,0x6E,
|
||||
0x20,0x6E,0x6F,0x20,0x65,0x76,0x65,0x6E,0x74,0x20,0x77,0x69,0x6C,0x6C,0x20,
|
||||
0x74,0x68,0x65,0x20,0x61,0x75,0x74,0x68,0x6F,0x72,0x73,0x20,0x62,0x65,0x20,
|
||||
0x68,0x65,0x6C,0x64,0x20,0x6C,0x69,0x61,0x62,0x6C,0x65,0x20,0x66,0x6F,0x72,
|
||||
0x20,0x61,0x6E,0x79,0x20,0x64,0x61,0x6D,0x61,0x67,0x65,0x73,0x0D,0x0A,0x61,
|
||||
0x72,0x69,0x73,0x69,0x6E,0x67,0x20,0x66,0x72,0x6F,0x6D,0x20,0x74,0x68,0x65,
|
||||
0x20,0x75,0x73,0x65,0x20,0x6F,0x66,0x20,0x74,0x68,0x69,0x73,0x20,0x73,0x6F,
|
||||
0x66,0x74,0x77,0x61,0x72,0x65,0x2E,0x0D,0x0A,0x0D,0x0A,0x50,0x65,0x72,0x6D,
|
||||
0x69,0x73,0x73,0x69,0x6F,0x6E,0x20,0x69,0x73,0x20,0x67,0x72,0x61,0x6E,0x74,
|
||||
0x65,0x64,0x20,0x74,0x6F,0x20,0x61,0x6E,0x79,0x6F,0x6E,0x65,0x20,0x74,0x6F,
|
||||
0x20,0x75,0x73,0x65,0x20,0x74,0x68,0x69,0x73,0x20,0x73,0x6F,0x66,0x74,0x77,
|
||||
0x61,0x72,0x65,0x20,0x66,0x6F,0x72,0x20,0x61,0x6E,0x79,0x20,0x70,0x75,0x72,
|
||||
0x70,0x6F,0x73,0x65,0x2C,0x0D,0x0A,0x69,0x6E,0x63,0x6C,0x75,0x64,0x69,0x6E,
|
||||
0x67,0x20,0x63,0x6F,0x6D,0x6D,0x65,0x72,0x63,0x69,0x61,0x6C,0x20,0x61,0x70,
|
||||
0x70,0x6C,0x69,0x63,0x61,0x74,0x69,0x6F,0x6E,0x73,0x2C,0x20,0x61,0x6E,0x64,
|
||||
0x20,0x74,0x6F,0x20,0x61,0x6C,0x74,0x65,0x72,0x20,0x69,0x74,0x20,0x61,0x6E,
|
||||
0x64,0x20,0x72,0x65,0x64,0x69,0x73,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x20,
|
||||
0x69,0x74,0x0D,0x0A,0x66,0x72,0x65,0x65,0x6C,0x79,0x2C,0x20,0x73,0x75,0x62,
|
||||
0x6A,0x65,0x63,0x74,0x20,0x74,0x6F,0x20,0x74,0x68,0x65,0x20,0x66,0x6F,0x6C,
|
||||
0x6C,0x6F,0x77,0x69,0x6E,0x67,0x20,0x72,0x65,0x73,0x74,0x72,0x69,0x63,0x74,
|
||||
0x69,0x6F,0x6E,0x73,0x3A,0x0D,0x0A,0x0D,0x0A,0x31,0x2E,0x20,0x54,0x68,0x65,
|
||||
0x20,0x6F,0x72,0x69,0x67,0x69,0x6E,0x20,0x6F,0x66,0x20,0x74,0x68,0x69,0x73,
|
||||
0x20,0x73,0x6F,0x66,0x74,0x77,0x61,0x72,0x65,0x20,0x6D,0x75,0x73,0x74,0x20,
|
||||
0x6E,0x6F,0x74,0x20,0x62,0x65,0x20,0x6D,0x69,0x73,0x72,0x65,0x70,0x72,0x65,
|
||||
0x73,0x65,0x6E,0x74,0x65,0x64,0x3B,0x20,0x79,0x6F,0x75,0x20,0x6D,0x75,0x73,
|
||||
0x74,0x20,0x6E,0x6F,0x74,0x0D,0x0A,0x20,0x20,0x20,0x63,0x6C,0x61,0x69,0x6D,
|
||||
0x20,0x74,0x68,0x61,0x74,0x20,0x79,0x6F,0x75,0x20,0x77,0x72,0x6F,0x74,0x65,
|
||||
0x20,0x74,0x68,0x65,0x20,0x6F,0x72,0x69,0x67,0x69,0x6E,0x61,0x6C,0x20,0x73,
|
||||
0x6F,0x66,0x74,0x77,0x61,0x72,0x65,0x2E,0x20,0x49,0x66,0x20,0x79,0x6F,0x75,
|
||||
0x20,0x75,0x73,0x65,0x20,0x74,0x68,0x69,0x73,0x20,0x73,0x6F,0x66,0x74,0x77,
|
||||
0x61,0x72,0x65,0x0D,0x0A,0x20,0x20,0x20,0x69,0x6E,0x20,0x61,0x20,0x70,0x72,
|
||||
0x6F,0x64,0x75,0x63,0x74,0x2C,0x20,0x61,0x6E,0x20,0x61,0x63,0x6B,0x6E,0x6F,
|
||||
0x77,0x6C,0x65,0x64,0x67,0x6D,0x65,0x6E,0x74,0x20,0x69,0x6E,0x20,0x74,0x68,
|
||||
0x65,0x20,0x70,0x72,0x6F,0x64,0x75,0x63,0x74,0x20,0x64,0x6F,0x63,0x75,0x6D,
|
||||
0x65,0x6E,0x74,0x61,0x74,0x69,0x6F,0x6E,0x20,0x77,0x6F,0x75,0x6C,0x64,0x20,
|
||||
0x62,0x65,0x0D,0x0A,0x20,0x20,0x20,0x61,0x70,0x70,0x72,0x65,0x63,0x69,0x61,
|
||||
0x74,0x65,0x64,0x20,0x62,0x75,0x74,0x20,0x69,0x73,0x20,0x6E,0x6F,0x74,0x20,
|
||||
0x72,0x65,0x71,0x75,0x69,0x72,0x65,0x64,0x2E,0x0D,0x0A,0x32,0x2E,0x20,0x41,
|
||||
0x6C,0x74,0x65,0x72,0x65,0x64,0x20,0x73,0x6F,0x75,0x72,0x63,0x65,0x20,0x76,
|
||||
0x65,0x72,0x73,0x69,0x6F,0x6E,0x73,0x20,0x6D,0x75,0x73,0x74,0x20,0x62,0x65,
|
||||
0x20,0x70,0x6C,0x61,0x69,0x6E,0x6C,0x79,0x20,0x6D,0x61,0x72,0x6B,0x65,0x64,
|
||||
0x20,0x61,0x73,0x20,0x73,0x75,0x63,0x68,0x2C,0x20,0x61,0x6E,0x64,0x20,0x6D,
|
||||
0x75,0x73,0x74,0x20,0x6E,0x6F,0x74,0x20,0x62,0x65,0x0D,0x0A,0x20,0x20,0x20,
|
||||
0x6D,0x69,0x73,0x72,0x65,0x70,0x72,0x65,0x73,0x65,0x6E,0x74,0x65,0x64,0x20,
|
||||
0x61,0x73,0x20,0x62,0x65,0x69,0x6E,0x67,0x20,0x74,0x68,0x65,0x20,0x6F,0x72,
|
||||
0x69,0x67,0x69,0x6E,0x61,0x6C,0x20,0x73,0x6F,0x66,0x74,0x77,0x61,0x72,0x65,
|
||||
0x2E,0x0D,0x0A,0x33,0x2E,0x20,0x54,0x68,0x69,0x73,0x20,0x6E,0x6F,0x74,0x69,
|
||||
0x63,0x65,0x20,0x6D,0x61,0x79,0x20,0x6E,0x6F,0x74,0x20,0x62,0x65,0x20,0x72,
|
||||
0x65,0x6D,0x6F,0x76,0x65,0x64,0x20,0x6F,0x72,0x20,0x61,0x6C,0x74,0x65,0x72,
|
||||
0x65,0x64,0x20,0x66,0x72,0x6F,0x6D,0x20,0x61,0x6E,0x79,0x20,0x73,0x6F,0x75,
|
||||
0x72,0x63,0x65,0x20,0x64,0x69,0x73,0x74,0x72,0x69,0x62,0x75,0x74,0x69,0x6F,
|
||||
0x6E,0x2E,0x0D,0x0A,0x2D,0x2D,0x5D,0x5D,0x0D,0x0A,0x0D,0x0A,0x66,0x75,0x6E,
|
||||
0x63,0x74,0x69,0x6F,0x6E,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x61,0x75,0x64,0x69,
|
||||
0x6F,0x2E,0x6E,0x65,0x77,0x53,0x6F,0x75,0x72,0x63,0x65,0x28,0x61,0x2C,0x20,
|
||||
0x62,0x29,0x0D,0x0A,0x09,0x69,0x66,0x20,0x74,0x79,0x70,0x65,0x28,0x61,0x29,
|
||||
0x20,0x3D,0x3D,0x20,0x22,0x73,0x74,0x72,0x69,0x6E,0x67,0x22,0x20,0x74,0x68,
|
||||
0x65,0x6E,0x0D,0x0A,0x09,0x09,0x61,0x20,0x3D,0x20,0x6C,0x6F,0x76,0x65,0x2E,
|
||||
0x66,0x69,0x6C,0x65,0x73,0x79,0x73,0x74,0x65,0x6D,0x2E,0x6E,0x65,0x77,0x46,
|
||||
0x69,0x6C,0x65,0x28,0x61,0x29,0x0D,0x0A,0x09,0x65,0x6E,0x64,0x0D,0x0A,0x09,
|
||||
0x69,0x66,0x20,0x74,0x79,0x70,0x65,0x28,0x61,0x29,0x20,0x3D,0x3D,0x20,0x22,
|
||||
0x75,0x73,0x65,0x72,0x64,0x61,0x74,0x61,0x22,0x20,0x74,0x68,0x65,0x6E,0x0D,
|
||||
0x0A,0x09,0x09,0x69,0x66,0x20,0x61,0x3A,0x74,0x79,0x70,0x65,0x4F,0x66,0x28,
|
||||
0x22,0x46,0x69,0x6C,0x65,0x22,0x29,0x20,0x74,0x68,0x65,0x6E,0x0D,0x0A,0x09,
|
||||
0x09,0x09,0x61,0x20,0x3D,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x73,0x6F,0x75,0x6E,
|
||||
0x64,0x2E,0x6E,0x65,0x77,0x44,0x65,0x63,0x6F,0x64,0x65,0x72,0x28,0x61,0x29,
|
||||
0x0D,0x0A,0x09,0x09,0x65,0x6E,0x64,0x0D,0x0A,0x09,0x09,0x0D,0x0A,0x09,0x09,
|
||||
0x69,0x66,0x20,0x61,0x3A,0x74,0x79,0x70,0x65,0x4F,0x66,0x28,0x22,0x44,0x65,
|
||||
0x63,0x6F,0x64,0x65,0x72,0x22,0x29,0x20,0x74,0x68,0x65,0x6E,0x0D,0x0A,0x09,
|
||||
0x09,0x09,0x69,0x66,0x20,0x62,0x20,0x3D,0x3D,0x20,0x22,0x73,0x74,0x61,0x74,
|
||||
0x69,0x63,0x22,0x20,0x74,0x68,0x65,0x6E,0x0D,0x0A,0x09,0x09,0x09,0x09,0x61,
|
||||
0x20,0x3D,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x73,0x6F,0x75,0x6E,0x64,0x2E,0x6E,
|
||||
0x65,0x77,0x53,0x6F,0x75,0x6E,0x64,0x44,0x61,0x74,0x61,0x28,0x61,0x29,0x0D,
|
||||
0x0A,0x09,0x09,0x09,0x65,0x6E,0x64,0x0D,0x0A,0x09,0x09,0x09,0x72,0x65,0x74,
|
||||
0x75,0x72,0x6E,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x61,0x75,0x64,0x69,0x6F,0x2E,
|
||||
0x6E,0x65,0x77,0x53,0x6F,0x75,0x72,0x63,0x65,0x31,0x28,0x61,0x29,0x0D,0x0A,
|
||||
0x09,0x09,0x65,0x6E,0x64,0x0D,0x0A,0x09,0x09,0x69,0x66,0x20,0x61,0x3A,0x74,
|
||||
0x79,0x70,0x65,0x4F,0x66,0x28,0x22,0x53,0x6F,0x75,0x6E,0x64,0x44,0x61,0x74,
|
||||
0x61,0x22,0x29,0x20,0x74,0x68,0x65,0x6E,0x0D,0x0A,0x09,0x09,0x09,0x72,0x65,
|
||||
0x74,0x75,0x72,0x6E,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x61,0x75,0x64,0x69,0x6F,
|
||||
0x2E,0x6E,0x65,0x77,0x53,0x6F,0x75,0x72,0x63,0x65,0x31,0x28,0x61,0x29,0x0D,
|
||||
0x0A,0x09,0x09,0x65,0x6E,0x64,0x0D,0x0A,0x09,0x65,0x6E,0x64,0x0D,0x0A,0x09,
|
||||
0x65,0x72,0x72,0x6F,0x72,0x28,0x22,0x4E,0x6F,0x20,0x6D,0x61,0x74,0x63,0x68,
|
||||
0x69,0x6E,0x67,0x20,0x6F,0x76,0x65,0x72,0x6C,0x6F,0x61,0x64,0x22,0x29,0x0D,
|
||||
0x0A,0x65,0x6E,0x64,
|
||||
0x66,0x75,0x6E,0x63,0x74,0x69,0x6F,0x6E,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x61,
|
||||
0x75,0x64,0x69,0x6F,0x2E,0x6E,0x65,0x77,0x53,0x6F,0x75,0x72,0x63,0x65,0x28,
|
||||
0x61,0x2C,0x20,0x62,0x29,0x20,0x69,0x66,0x20,0x74,0x79,0x70,0x65,0x28,0x61,
|
||||
0x29,0x20,0x3D,0x3D,0x20,0x22,0x73,0x74,0x72,0x69,0x6E,0x67,0x22,0x20,0x74,
|
||||
0x68,0x65,0x6E,0x20,0x61,0x20,0x3D,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x66,0x69,
|
||||
0x6C,0x65,0x73,0x79,0x73,0x74,0x65,0x6D,0x2E,0x6E,0x65,0x77,0x46,0x69,0x6C,
|
||||
0x65,0x28,0x61,0x29,0x20,0x65,0x6E,0x64,0x20,0x69,0x66,0x20,0x74,0x79,0x70,
|
||||
0x65,0x28,0x61,0x29,0x20,0x3D,0x3D,0x20,0x22,0x75,0x73,0x65,0x72,0x64,0x61,
|
||||
0x74,0x61,0x22,0x20,0x74,0x68,0x65,0x6E,0x20,0x69,0x66,0x20,0x61,0x3A,0x74,
|
||||
0x79,0x70,0x65,0x4F,0x66,0x28,0x22,0x46,0x69,0x6C,0x65,0x22,0x29,0x20,0x74,
|
||||
0x68,0x65,0x6E,0x20,0x61,0x20,0x3D,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x73,0x6F,
|
||||
0x75,0x6E,0x64,0x2E,0x6E,0x65,0x77,0x44,0x65,0x63,0x6F,0x64,0x65,0x72,0x28,
|
||||
0x61,0x29,0x20,0x65,0x6E,0x64,0x20,0x69,0x66,0x20,0x61,0x3A,0x74,0x79,0x70,
|
||||
0x65,0x4F,0x66,0x28,0x22,0x44,0x65,0x63,0x6F,0x64,0x65,0x72,0x22,0x29,0x20,
|
||||
0x74,0x68,0x65,0x6E,0x20,0x69,0x66,0x20,0x62,0x20,0x3D,0x3D,0x20,0x22,0x73,
|
||||
0x74,0x61,0x74,0x69,0x63,0x22,0x20,0x74,0x68,0x65,0x6E,0x20,0x61,0x20,0x3D,
|
||||
0x20,0x6C,0x6F,0x76,0x65,0x2E,0x73,0x6F,0x75,0x6E,0x64,0x2E,0x6E,0x65,0x77,
|
||||
0x53,0x6F,0x75,0x6E,0x64,0x44,0x61,0x74,0x61,0x28,0x61,0x29,0x20,0x65,0x6E,
|
||||
0x64,0x20,0x72,0x65,0x74,0x75,0x72,0x6E,0x20,0x6C,0x6F,0x76,0x65,0x2E,0x61,
|
||||
0x75,0x64,0x69,0x6F,0x2E,0x6E,0x65,0x77,0x53,0x6F,0x75,0x72,0x63,0x65,0x31,
|
||||
0x28,0x61,0x29,0x20,0x65,0x6E,0x64,0x20,0x69,0x66,0x20,0x61,0x3A,0x74,0x79,
|
||||
0x70,0x65,0x4F,0x66,0x28,0x22,0x53,0x6F,0x75,0x6E,0x64,0x44,0x61,0x74,0x61,
|
||||
0x22,0x29,0x20,0x74,0x68,0x65,0x6E,0x20,0x72,0x65,0x74,0x75,0x72,0x6E,0x20,
|
||||
0x6C,0x6F,0x76,0x65,0x2E,0x61,0x75,0x64,0x69,0x6F,0x2E,0x6E,0x65,0x77,0x53,
|
||||
0x6F,0x75,0x72,0x63,0x65,0x31,0x28,0x61,0x29,0x20,0x65,0x6E,0x64,0x20,0x65,
|
||||
0x6E,0x64,0x20,0x65,0x72,0x72,0x6F,0x72,0x28,0x22,0x4E,0x6F,0x20,0x6D,0x61,
|
||||
0x74,0x63,0x68,0x69,0x6E,0x67,0x20,0x6F,0x76,0x65,0x72,0x6C,0x6F,0x61,0x64,
|
||||
0x22,0x29,0x20,0x65,0x6E,0x64,
|
||||
};
|
||||
// [/audio.lua]
|
||||
|
||||
|
||||
@@ -15,7 +15,11 @@ function auto(name)
|
||||
-- Read source Lua file
|
||||
local src_file = io.open(src, "rb")
|
||||
local src_data = src_file:read("*a")
|
||||
local src_len = #src_data
|
||||
-- remove comments
|
||||
src_data = src_data:gsub("%-%-%[%[.-%-%-%]%]", ""):gsub("%-%-.-\n", "")
|
||||
-- remove unneeded whitespaces
|
||||
src_data = src_data:gsub("^%s+",""):gsub("%s*$",""):gsub("%s%s+", " ")
|
||||
local src_len = #src_data
|
||||
src_file:close()
|
||||
|
||||
local lines = {}
|
||||
@@ -87,7 +91,10 @@ if #arg == 0 then
|
||||
print("Usage: lua auto.lua <name1> <name2> .. <name3>")
|
||||
else
|
||||
for i, v in ipairs(arg) do
|
||||
auto(v)
|
||||
local ok, err = pcall(auto, v:gsub("%.lua$",""))
|
||||
if not ok then
|
||||
print("cannot update "..v..": " .. err)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ function love.path.getfull(p)
|
||||
local full = cwd .. love.path.normalslashes(p)
|
||||
|
||||
-- Remove trailing /., if applicable
|
||||
return full:match("(.-)/%.") or full
|
||||
return full:match("(.-)/%.$") or full
|
||||
end
|
||||
|
||||
-- Returns the leaf of a full path.
|
||||
@@ -193,11 +193,11 @@ function love.boot()
|
||||
|
||||
local o = love.arg.options
|
||||
|
||||
local abs_arg0 = love.path.getfull(love.arg.getLow(arg))
|
||||
love.filesystem.init(abs_arg0)
|
||||
local arg0 = love.arg.getLow(arg)
|
||||
love.filesystem.init(arg0)
|
||||
|
||||
-- Is this one of those fancy "fused" games?
|
||||
local can_has_game = love.filesystem.isFile(abs_arg0) and not love.filesystem.isDirectory(abs_arg0) and pcall(love.filesystem.setSource, abs_arg0)
|
||||
local can_has_game = pcall(love.filesystem.setSource, arg0)
|
||||
|
||||
if not can_has_game and o.game.set and o.game.arg[1] then
|
||||
local full_source = love.path.getfull(o.game.arg[1])
|
||||
@@ -288,7 +288,7 @@ function love.init()
|
||||
|
||||
-- Setup screen here.
|
||||
if c.screen and c.modules.graphics then
|
||||
if love.graphics.checkMode(c.screen.width, c.screen.height, c.screen.fullscreen) then
|
||||
if love.graphics.checkMode(c.screen.width, c.screen.height, c.screen.fullscreen) or (c.screen.width == 0 and c.screen.height == 0) then
|
||||
assert(love.graphics.setMode(c.screen.width, c.screen.height, c.screen.fullscreen, c.screen.vsync, c.screen.fsaa), "Could not set screen mode")
|
||||
else
|
||||
error("Could not set screen mode")
|
||||
|
||||
+1925
-2223
File diff suppressed because it is too large
Load Diff
+5751
-5899
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user