learn

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

IMG_6148

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.setColour(Colours::orange);
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];
repaint();
}

Build it, run it, drop it, done!

Capture

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.

Advertisements
learn

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"
}

Fan-bloody-tastic!
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..

Anyways,

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.

create, learn

Forward Fast-Mo-Fo-Fourier-Transform Disco LEDs

The fundamental idea here was to simulate Low-Pass, Band-Pass and High-Pass filters using computer processing and use them to drive a set of LEDs.. or in short, make some funky disco lights.

This is an idea I’ve had since first getting an Arduino last year and watching this video of the same concept implemented using only analogue components. Whilst that approach would be a lovely foray into the world of EE principles, it seemed slightly old-fashioned and not quite educational enough (I would just be following somebody else’s plans).

I guess this brings me to an important point, this blog isn’t meant to be ground-breaking, or even mildly interesting. It’s just my place for writing up (consolidating if you will) whatever projects and new activities I do. I’m quite rusty on computer techniques and just leapt into the second year of a BSc Computer Science with my 6 year out-of-date programming knowledge. So in this project I aimed to get up to scratch at some ideas involved in Java applications, but with some end result that isn’t another “Hello World!”.

Music plays.. Lights flash.. ok so its not Deep Blue

Continue reading