Home » Archive by category "Various"

Using Travis.CI with Java Eclipse Project

Lately I set up Travis.CI for my Mavis project. It’s hosted continuous integration service free for open source projects. It’ll build your project and, optionally, run tests after every push to remote repository that contains travis.yml configuration file.

As I never really used ant or travis.ci before it took me too many hours to actually setup it correctly, so I figured I’ll share new knowledge.
Read more

Inheritance with phaser.js

Today’s short one to celebrate moving from dev.kofun to main domain – only code snippet, no further explanations.
How to make subclass for pharser.js class?

Let’s make subclass of Sprite, and call it Ghost.

function Ghost(game, args){
	Phaser.Sprite.call(this, game, args);

// Add Sprite object prototype as Ghost prototype
Ghost.prototype = Object.create(Phaser.Sprite.prototype);
Ghost.prototype.constructor = Ghost;

And we use it like:

var tmpGhost = new Ghost(game);

// and add it to game like this:

Multidimensional Arrays without Subscript Operator

Some time ago friend of mine asked me how to operate on array without subscript operator, and – to be honest – I supposed it’ll took less than few hours…

NOTE as for all pointer arithmetic it’s rather inadvisable to use this trick in ‘common life projects’.
But I have some more knowledge so I’m sharing! (:
And if you want something more about pointer arithmetic you can check my previous article. Read more

Setup Allegro tutorial part 1

I haven’t seen any up-to-date Allegro 5 tutorial that focuses on learning via making games. All I found online were either small examples (like moving rectangle) about particular functions of Allegro 5, or complete guides for older versions. That’s why I decided to write down this small series of articles.
My goal is to teach various parts of Allegro gaming library, and basics of game programming concepts via making some – at first simple – game prototypes.
Tutorial assumes at least a basic knowledge of C/C++ programming, and although all examples were written and tested on Visual Studio 2010 under Windows 7 you can use any other IDE you like.

You can view code for this tutorial on github!
Read more

Basic Void pointer arithmetics

Okay, as promissed before my last trek journey (polish only) I’ll share some C/C++ informations I found interesting.

Few hours before trip a friend of mine asked to write bubble sort. Easy. So I wondered where’s the catch – this guy created img processing tool in java. Our conversation beyond this point was something like:

I: “Why don’t you write it down yourself? You are better than me”
Bob: “I need to write it in C++”
I: “Ok, that’s some point. But Java and C++ syntaxes aren’t that different you know”
Bob: “But header for this sort function must be the same as qsort’s.”

And that was the catch. You need to work on void pointers, and that can be confusing for some.

void qsort (void* base, size_t num, size_t size,
            int (*compar)(const void*,const void*));

Call me good-hearted but I did that. I needed to finish packing, cooking my version of „iron ration” and so on, and doing bubble sort seemed easier than explaining how to do it.
Read more