Orange Part Three – RTFM

So diving face first into OpenGL turned out to be painful, I need to study it more.

Currently working to port the open.gl drawing example into JUCE. Source can be found here, it almost works!


Orange Part Two – Load the OBJ

So in Part One we got our OpenGL app up and running (with no OpenGL, wait for it..) and some basic drag and drop of a single file. I’m not going to get into multiple files but later on it might be cool to be able to drop on an .obj and .png and have the whole thing kapow with the model right there… But not yet.

Most of this tutorial series is taken from the OpenGLAppExample provided with the Introjucer, I’m pretty much learning this stuff as I go through it – I don’t yet actually know any OpenGL, but I also don’t expect anyone to read this.

On to business

JUCE doesn’t itself include an .obj loader but the OpenGLAppExample does, so I’m going to be using that. You can find it in the source for that example – WavefrontObjParser.h – we’ll need to include that header in MainComponent.cpp and stick a private variable in there.

// private member variables
String debugMessage;
WavefrontObjFile mesh;

Loading this file is very simple, mesh has a load method which takes a File which is created from an absolute path like the ones we get from filesDropped. I’m really starting to like this.

void filesDropped(const StringArray& files, int x, int y) override
File file(files[0]);

if (mesh.load(file).wasOk())
debugMessage.append(files[0], files[0].length());
debugMessage.append("loaded \n", 1);
debugMessage.append(files[0], files[0].length());
debugMessage.append("failed to load \n", 1);


Note my debug messages changed slightly to support multi-lines, this was a simple change in the paint method.

g.drawMultiLineText(debugMessage, 20, 20, getWidth());

Seems to have worked, now to dig around in the example and draw something on screen.

Brief interlude….

10 mins..

20 mins..

I need to learn some OpenGL. =(


Orange Part One – The drop

The first of 10 tutorials in 10 days. A simple OBJ object viewer with texture mapping. Named Orange….. Orange… Juice.. Orange Juice.. Wow!

This is what it would be great to be


Create a new OpenGL Project and open MainComponent.cpp in your c++ editor of choice.

The File drop target

JUCE has a drop-able listener class for handling file drops, simply extend MainContentComponent with FileDragAndDropTarget.

class MainContentComponent   : public OpenGLAppComponent, private FileDragAndDropTarget

From FileDragAndDropTarget we must implement 2 virtual methods, filesDropped and isInterestedInFileDrag. Add these lines to the MainContentComponent

bool isInterestedInFileDrag(const StringArray& files) override

void filesDropped(const StringArray& files, int x, int y) override

Straight away I want to try and drop something on the window, but its going to need some debug info. I don’t want to use the console, this is a visual app, we can do better so lets set up some debug text on screen!

This is fairly easy, JUCE has some fantastic text rendering and manipulation options, we can throw a piece of text over the whole window and justify it up in the top left with these two lines in the render() method.

void paint (Graphics& g) override
g.drawText(debugMessage, Rectangle(0, 0, getWidth(), getHeight()), Justification::topLeft);

// private member variables
String debugMessage;

Great! But it won’t build because we arn’t returning from isInterestedInDragSource. So let’s get this thing running.

bool isInterestedInFileDrag(const StringArray& files) override
return true;

void filesDropped(const StringArray& files, int x, int y) override
debugMessage = files[0];

Build it, run it, drop it, done!


Ok, it sucks a little bit but I’m getting an idea of the JUCE workflow.

What little amount of source code there is in this demo can be downloaded here.


10 JUCE Tutorials in 10 Days

So I’ve signed up to attend the JUCE Summit 2015 but I know absolutely nothing about JUCE. It’s Monday night now, the conference starts in 12 days, with 2 of those being taken up by async Brighton meets and subsequent after-drinks that leaves 10 semi-free evenings to get to grips with the framework. I’m not including weekends, I’m on a screen free weekend mission right now.

They won’t be in-depth, they probably won’t be good, but they may be useful to someone (really, me!) I’ve set the one simple requirement that they must solve a real world need, so no Hello World!s.

I’ll update this post to index and track progress.

  1. Orange – Part one of a series aiming to create a simple OBJ file viewer

Using git repos as npm dependencies

Sequelize + Express + ? = Happiness

I want to use sequelize/sequelize-restful as I’m using express 4 and really didn’t want to have to base my app on restify (and for the bigger reason that I’m sick of writing boiler-plate api routes¹).  But sequelize-restful is no longer maintained. It’s a simple little library and quite nicely written but it causes sequelize to throw up some deprecation warnings and I wanted to get rid of this (and future proof²).

So I forked it… Nightmare, now I can’t npm install sequelize-restful --save this and I’m going to end up with a random hard copied dependencies in my otherwise Da Vinci like masterpiece of a code base [sarcasm].

But no, someone thought of this, and it defaults to github npm install kaidoe/sequlize-restful --save creates a package.json entry like so:

"dependencies": {
"sequelize-restful": "git://github.com/kaidoe/sequelize-restful"

Sequelize + Express+ ((Open Source Fork) * (npm/ github)) = Happiness

¹ It’s generally good practice when writing to put the bigger more relevant reason in brackets, after the fact.
² Like this.

create, learn

BaconGame with Jam!

Finished the BaconGameJam with 44 seconds to spare (check the timelapse)..

To save repeating myself, here’s my quick post-mortem on bacongamejam.org:

You just entered a village and people have a thing they want and a thing they don’t want, along with a clue to offer you.

As far as being on theme, well..

Original Idea: Joe public living in a generic GTA city has his car stolen on the way home and has a small quest in getting home, 4 districts with 4 quests before getting home.

Problem: Engine was becoming too complex with multiple districts, and GTA style graphics were proving.. well, crap.

Idea 2: Elderly game character (think FFVII’s Cloud but about 80 years old) has a small adventure trying to do his daily chores, get milk, newspaper etc..

Problem: Running out of time, couldn’t pick a character.

So in the end what is left is basically a demo of the ‘engine’.. I stripped down the inventory system (it supports picking up and dropping multiple objects) and in the end came up with this simple puzzle problem.

Pros: I think the simple puzzle idea is the one I should have stuck to in the first place, RPGs have no place in 48 hour competitions if your building an engine from scratch.

Con: It doesn’t really fit in with the theme.. Errr, reverse perspective of giving things to people and getting something in return???…… NO. No matter how much I think about it, I cant just get this to fit in..


Tech: HTML5 (CSS, Javascript, HTML)

Tools: sfxr (http://www.drpetter.se/project_sfxr.html)

Ambient music: Ambient 8-bit by Masl123 (http://www.newgrounds.com/audio/listen/472452)


Everything else was made from null (teehee) during the 48hours

Thanks, Andy

Description on BaconGameJam

If you want to check the game out, it’s hosted on my personal server at: http://kaidoe.com/bgj

I can sum up the whole experience by saying – it was fun working alongside so many other people at the same time, it was exciting to have such a short deadline and it was by far the quickest way to learn a language! I knew little to no javascript 48 hours ago, but now I can code quite fluently and understand the structures well..

Points for Ludum Dare – Plan the game more, think about graphics.

And finally, enjoy the timelapse (sorry, provide your own music, and play in fullscreen ;):

create, learn

13 Hours…

A good nights sleep and a long days work.. I’m not going crazy on this Bacon Game Jam, but I’ve got a lot done today and in a good place to sleep, plus after 13 hours staring at code….. I just, cant, stand, it, no more!

Accomplished today:

  • Display Engine
  • World Engine
  • Inventory Engine
  • Collision Engine
  • NPC Engine
  • A basic quest linking system..

Todo tomorrow:

  • Splash-screen and Endgame functionality
  • Write storyline (characters, items, quests)
  • Graphics (characters, items, scenery)
  • Code level

I won’t talk too much, save the technical muckery to the post-mortem.