Space Trader

Abstracting of Images

I'm trying to abstract away the  Image and ImageList classes, and I'm forced to ask myself:

What are images doing in the core of the game? It's not like it can display them, or even manipulate them – they are part of the UI, and that's the only part of the application where they have anything to do!

Space Trader: Portability Requires Fonts

Well, it appears that Space Trader didn’t run on Linux. Once I looked inside, it was obvious why: I forced it to use a Windows-like Look-and-Feel, which is only available under JVMs for windows. this took about a minute to fix, but that’s when things really started not to work.

The Problem with Enums - Persisting...

All sorts of things happen when saving values to file: Sometimes you want to save a value representing an enum, and sometimes you want to save the real thing. And sometimes you have arrays of whatever that is... C# makes it easy: enums are the numbers that represent them.

Do What I Mean class

This is a helper class, that would help us deal with persistence of enums in Java.

See this post for more.

Step 2 – Making the GUI

Winforms over Java1! Not as freaky as you might think. We basically just employ the Adapter design pattern in a larger scale.

  1. 1. Warning – must have some familiarity with Winforms and Swing.

Script Away The Pain

With any luck, we now have no compilation problems. Two tasks remain before we can move on: fixing the @ThisWasAProperty fields, and changing the Main() method into something Java likes. The second task is trivial. But how do you encapsulate a few hundred fields, without manually going over each of them?

Step 1 – Making it compile

The first problem we have when trying to run a C# program in Java is that the files won’t compile. While the core syntax is practically the same, some minor sections of it are different – mostly namespace declarations and properties.

Syndicate content