Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Friday, 22 July 2011

And here's that low-level library!

Game review still on the way by Sunday, but this takes priority: I mentioned a few weeks ago that f-cycles had announced the release of a new low-level library for the GP2X. Well, I'm pleased to say that he's lived up to his words, and here is the release announcement. It's mostly a bit over my head, but I'm sure the serious programmers amongst you will enjoy playing with it. It's been licensed as GPL v3, so the source can be played about with, too.

Saturday, 2 July 2011

A new low-level library on its way?

A Canadian developer by the name of f-cycles has announced the forthcoming release ("before [the] end of July 2011") of his low-level library for the GP2X. The list of features (see the link) is pretty impressive, and if it does indeed appear then maybe it will kick-start a little more development for our console. Caution has to be in order, of course, as there are an awful lot of examples of people promising exciting-looking releases that we're still waiting for several years on. Still, let's be optimistic for once: this really does promise a lot!

Monday, 20 June 2011

C++ for Logans

Hmm. I had a look in my local library to see if they had any C++ books, and they did. One. C++ for Dummies, which doesn't get the greatest reviews on Amazon. On the plus side, most people seem to like chapter 1, and at least some of the complaints are from people who were confused by the unexplained use of conventions such as "int" for integers. That sort of thing won't worry me, at least. I suspect I'll stick with SdlBasic for any remotely serious GP2X programming, but a little C++ might even be fun. It can't be worse than the little C I tried about 20 years ago, anyway... can it?

Saturday, 7 May 2011

A program, egad!


Okay, I know: it doesn't say "Hello World!" This is a disgraceful breach of convention, and I'm utterly ashamed of myself. Now... as I hinted a little while ago, it is indeed SdlBasic I've chosen, since I actually understand most of it, which alone puts it way ahead of C++ and the like. It's a very simple program to plot a Lorenz Attractor, something I've always rather liked watching.

I must be honest and say that the screenshot is actually from the PC. The version of SdlBasic in the Ubuntu repository doesn't seem entirely finished in terms of presentation (it tends to crash) but the actual language works, and I can use the code with no changes on the GP2X. The timings on the GP2X are a lot slower: something like 3.5 seconds overall and 2 seconds for the drawing.

'Very basic Lorenz Attractor plotter

'Set up the display
setdisplay(320, 240, 16, 1)
setFont("../share/fonts/ttf/dejavu/DejaVuSans.ttf")
hideMouse

'Initialise variables
s = 10 : p = 28 : b = 8/3
x = 10 : y = 0 : z = 10
dt = 0.002
drawstarttime = timer

'Actual plottery
for n = 1 to 20000
dx = s * (y - x)
dy = x * (p - z) - y
dz = x * y - b * z
x = x + dx * dt
y = y + dy * dt
z = z + dz * dt
plot(160 + y * 5, z * 5, rgb(255, 255, 0))
next

'Print elapsed time (in s) since program / drawing start
ink(rgb(255, 255, 255))
timetaken = timer : drawtime = timer - drawstarttime
timedisplay$ = str$ (timetaken / 1000) + " / " + str$ (drawtime / 1000)
text(0, 0, 16, timedisplay$)

'Wait for button press before ending
j = bjoy(0)
while j = 0
j = bjoy(0)
end while

wait(100)

end

Wednesday, 4 May 2011

Programming: the final frontier?

The GP2X has given me so much enjoyment even in the few short weeks since I bought it, but I'd consider it much more to be mine if I could produce something of my own for it. The machine's openness to development is, after all, one of its most significant features. The problem is that I'm a pathetically useless programmer! The GP2X Wiki's Getting started with GP2X development page provides a summary of the options, and for the most part they're too hard for me. C/C++ (the most popular choice, unsurprising on a Linux system) is really above my head, and the idea of my programming in assembler is laughable.

So, what else is there? Excluding things like Perl, which has never come out of the beta stage in its GP2X incarnation, and the otherwise promising avenue of GLBasic (though free for many platforms, it ain't for handhelds) there are probably four realistic options: Python/Pygame, Pascal, Fenix and SdlBasic. They all have their pros and cons, but I'm tempted to go with the last. It's not going to be blazingly fast, but I do at least have some idea what I'm doing in Basic! So, stand by for a "Hello World" program before the decade is out...