Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - imekon

Pages: [1]
SFML projects / Re: SFML with JavaScript, Box2D...
« on: November 10, 2015, 02:17:14 pm »
And starting with ECMAScript2015 the language is indeed getting better. :P

Duktape is V5 with some bits of V6...  :-[

SFML projects / Re: SFML with JavaScript, Box2D...
« on: November 04, 2015, 05:46:51 pm »
It's not open source yet, but could be - if I can work out how to bring together SFML, Box2D, Duktape and the rest into one Git project.

SFGUI - maybe I should replace my crude console implementation with that for logging...

SFML projects / Re: SFML with JavaScript, Box2D...
« on: November 04, 2015, 02:16:27 pm »
I used duktape (duktape.org) to provide the embedded JavaScript. I originally used Lua but switched to duktape (JavaScript) as it's more C/C++ like. In fact, duktape is very similar to Lua in the C code.

The JavaScript behind each 'game' has at least two functions - initialise and run that get called by the engine.

I keep time consuming operations in C++ but let the JavaScript do the higher level stuff, like creation etc.

To create a box (32 x 32) with physics, you'd do something like

Code: [Select]
function initialise()
    box = GameObject.textureObject(1);    // create a sprite with texture index 1
    box.setOrigin(16, 16);                           // important for Box2D physics
    box.setPosition(100, 100);                    // set the position
    Physics.createDynamicBox(box, { density: 1, friction: 0.6 });

SFML projects / Re: Screenshot Thread
« on: November 04, 2015, 01:43:44 pm »

A screenshot of my SFML+JavaScript+Box2D engine I'm working on.

SFML projects / SFML with JavaScript, Box2D...
« on: November 04, 2015, 01:40:32 pm »
I've been poking around GameMaker Studio, Construct 2 and Clickteam Fusion 2.5 and started wondering how hard it would be to make a 2d game engine.

My reason for doing this was all of the above engines are fine, but they get in the way a bit, as I'd rather write code than visually program. GameMaker is unique in that it has a script language. Fusion has JavaScript for plugins.

I looked briefly at SDL but chose to use SFML instead (classes not C functions). I bolted a Lua interpreter on at first, but after reading "why everyone should learn javascript" (http://blog.monitor.us/2014/08/why-everyone-should-learn-javascript/), I thought, why not?

I got hold of duktape, a JavaScript engine and swapped out Lua. Now Lua is fine, but JavaScript is better (IMHO) as it's more C/C++ like.

I added Box2d physics and created my first couple of demos: a simple block game (http://imgur.com/a/z7IrB) and a physics demo.

So where am I going with this? Am I trying to make a game? I'm interested in Match3 type games and procedural generation... so that's why I'm doing this.

Oh yeah, and writing code like this is fun.

Pages: [1]