Skip to content

Commit

Permalink
cleaned out some incorrect return values. some are still hiding
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Brodsky committed Nov 18, 2013
1 parent fd751fa commit e545199
Show file tree
Hide file tree
Showing 18 changed files with 435 additions and 131 deletions.
80 changes: 80 additions & 0 deletions addon_config.mk
@@ -0,0 +1,80 @@
# All variables and this file are optional, if they are not present the PG and the
# makefiles will try to parse the correct values from the file system.
#
# Variables that specify exclusions can use % as a wildcard to specify that anything in
# that position will match. A partial path can also be specified to, for example, exclude
# a whole folder from the parsed paths from the file system
#
# Variables can be specified using = or +=
# = will clear the contents of that variable both specified from the file or the ones parsed
# from the file system
# += will add the values to the previous ones in the file or the ones parsed from the file
# system
#
# The PG can be used to detect errors in this file, just create a new project with this addon
# and the PG will write to the console the kind of error and in which line it is

meta:
ADDON_NAME = ofxBlud
ADDON_DESCRIPTION = various chunks of lua wrappers
ADDON_AUTHOR = Jonathan Brodsky
ADDON_TAGS = "lua" "scripting"
ADDON_URL = http://github.com/jonbro/ofxBlud

common:
# dependencies with other addons, a list of them separated by spaces
# or use += in several lines
ADDON_DEPENDENCIES = ofxSpriteSheetRenderer ofxDspChain

# include search paths, this will be usually parsed from the file system
# but if the addon or addon libraries need special search paths they can be
# specified here separated by spaces or one per line using +=
# ADDON_INCLUDES =

# any special flag that should be passed to the compiler when using this
# addon
# ADDON_CFLAGS =

# any special flag that should be passed to the linker when using this
# addon, also used for system libraries with -lname
# ADDON_LDFLAGS =

# linux only, any library that should be included in the project using
# pkg-config
# ADDON_PKG_CONFIG_LIBRARIES =

# osx/iOS only, any framework that should be included in the project
# ADDON_FRAMEWORKS =

# source files, these will be usually parsed from the file system looking
# in the src folders in libs and the root of the addon. if your addon needs
# to include files in different places or a different set of files per platform
# they can be specified here
# ADDON_SOURCES =

# some addons need resources to be copied to the bin/data folder of the project
# specify here any files that need to be copied, you can use wildcards like * and ?
# ADDON_DATA =

# when parsing the file system looking for libraries exclude this for all or
# a specific platform
# ADDON_LIBS_EXCLUDE =

# when parsing the file system looking for sources exclude this for all or
# a specific platform
# ADDON_SOURCES_EXCLUDE =

# when parsing the file system looking for include paths exclude this for all or
# a specific platform
# ADDON_INCLUDES_EXCLUDE =

win_cb:
# when parsing the file system looking for sources exclude this for all or
# a specific platform
# ADDON_SOURCES_EXCLUDE =

# when parsing the file system looking for include paths exclude this for all or
# a specific platform
# ADDON_INCLUDES_EXCLUDE =
ios:
ADDON_SOURCES = ios_src
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/bludAudioSync.h
Expand Up @@ -3,7 +3,7 @@
#include "lunar.h"
#include "ofSoundUnit.h"
#include "bludMixer.h"
#include "bludlock.h"
#include "bludLock.h"
#include "ofTypes.h"

/**
Expand Down Expand Up @@ -37,15 +37,15 @@ class bludSyncContainer : public ofSoundSource {
callback = c;
}
};
vector<Trigger*> triggers;
vector<Trigger*> triggers;
int counter;
lua_State *L;
ofMutex *mutex;
};

/**
* interface to do sample accurate audio timing
*
*
* allows for a callback to be called with sample accurate timing
* don't exactly know how to manage the thread safety of this... tdb
*/
Expand Down
11 changes: 8 additions & 3 deletions src/bludGraphics.cpp
@@ -1,7 +1,9 @@
#include "bludGraphics.h"

const char bludGraphics::className[] = "bludGraphics";

int bludGraphics::width = 800;
int bludGraphics::height = 600;
bool bludGraphics::needsFixRes = false;
Lunar<bludGraphics>::RegType bludGraphics::methods[] = {
method(bludGraphics, push),
method(bludGraphics, pop),
Expand All @@ -10,7 +12,7 @@ Lunar<bludGraphics>::RegType bludGraphics::methods[] = {
method(bludGraphics, scale),
method(bludGraphics, setColor),
method(bludGraphics, setBackground),
method(bludGraphics, setFrameRate),
method(bludGraphics, setFrameRate),
method(bludGraphics, drawRect),
method(bludGraphics, drawCircle),
method(bludGraphics, clear),
Expand All @@ -22,5 +24,8 @@ Lunar<bludGraphics>::RegType bludGraphics::methods[] = {
method(bludGraphics, noise),
method(bludGraphics, openURL),
method(bludGraphics, eraseMode),
method(bludGraphics, setWindowShape),
method(bludGraphics, setFullscreen),
method(bludGraphics, exit),
{0,0}
};
};
39 changes: 31 additions & 8 deletions src/bludGraphics.h
Expand Up @@ -5,13 +5,16 @@
#include "ofUtils.h"
#include "ofAppRunner.h"
#include "lunar.h"
#include "bludLock.h"

class bludGraphics {
public:
static const char className[];
static Lunar<bludGraphics>::RegType methods[];
static bool needsFixRes;
static int width;
static int height;
bludGraphics(lua_State *L) {}

int push (lua_State *L) {ofPushMatrix(); return 1;}
int pop(lua_State *L) {ofPopMatrix(); return 1;}

Expand All @@ -37,7 +40,7 @@ class bludGraphics {
case 5:
mode = OF_BLENDMODE_SCREEN;
break;

default:
mode = OF_BLENDMODE_DISABLED;
break;
Expand All @@ -49,7 +52,7 @@ class bludGraphics {
int alpha = 255;
if (lua_isnumber(L, 4)) {
alpha = luaL_checknumber(L, 4);
}
}
ofSetColor(luaL_checknumber(L, 1), luaL_checknumber(L, 2), luaL_checknumber(L, 3), alpha);
return 1;
}
Expand Down Expand Up @@ -80,21 +83,41 @@ class bludGraphics {
}
return 1;
}
int setWindowShape(lua_State *L){
int w = luaL_checkinteger(L, 1);
int h = luaL_checkinteger(L, 2);
ofSetWindowShape(w, h);

// width = luaL_checknumber(L, 1);
// height = luaL_checknumber(L, 2);
// needsFixRes = true;
return 0;
}
int setFullscreen(lua_State *L){
ofSetFullscreen(lua_toboolean(L, 1));
return 0;
}
int exit(lua_State *L){
// release the mutex and
bludLock::getInstance()->unlock();
ofExit();
return 0;
}
int openURL(lua_State *L){
// [[UIApplication sharedApplication] openURL:[NSURL URLWithString: [[[[NSString alloc] initWithCString:luaL_checkstring(L, 1)] stringByAddingPercentEscapesUsingEncoding: NSASCIIStringEncoding] autorelease]]];
return 1;
ofLaunchBrowser(luaL_checkstring(L, 1));
return 0;
}
int eraseMode(lua_State *L){
#if defined TARGET_OF_IPHONE
glBlendFuncSeparateOES(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,GL_ONE,GL_SRC_ALPHA);
#endif
return 1;
return 0;
}
int enableAlpha(lua_State *L){
#if defined TARGET_OF_IPHONE
glBlendFuncSeparateOES(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,GL_ONE,GL_ONE_MINUS_SRC_ALPHA);
#endif
return 1;
return 0;
}
~bludGraphics() {}
};
};
6 changes: 3 additions & 3 deletions src/bludLock.cpp
Expand Up @@ -8,12 +8,12 @@
*/


#include "bludlock.h"
#include "bludLock.h"

ofMutex* bludLock::instance = NULL;
ofMutex* bludLock::instance = NULL;

ofMutex* bludLock::getInstance(){
if (!instance) // Only allow one instance of class to be generated.
instance = new ofMutex();
return instance;
}
}
12 changes: 0 additions & 12 deletions src/bludShapeBatch.cpp

This file was deleted.

80 changes: 0 additions & 80 deletions src/bludShapeBatch.h

This file was deleted.

10 changes: 5 additions & 5 deletions src/bludSpriteSheet.cpp
Expand Up @@ -60,15 +60,15 @@ int bludSpriteSheet::loadTexture(lua_State *L){
if (lua_isnumber(L, 3)) {
height = luaL_checknumber(L, 3);
}
cout << "loading texture bludspritesheet" << endl;
cout << "loading texture bludspritesheet: " << luaL_checkstring(L, 1) << endl;
texture->loadTexture(luaL_checkstring(L, 1));
cout << "after loading" << endl;
spriteRenderer->loadTexture(texture);
return 1;
cout << "after loading" << endl;
return 0;
}
int bludSpriteSheet::setupTexture(lua_State *L){
spriteRenderer->loadTexture(texture);
return 1;
//spriteRenderer->loadTexture(texture);
return 0;
}
int bludSpriteSheet::addTile(lua_State *L) {
// need to pull out the user data that was passed in on the first parameter
Expand Down

0 comments on commit e545199

Please sign in to comment.