Better yet, use Pascal! (was Re: Stop porting C code to C++)

:wink:
RK.

Patrick Kooman wrote:>Maybe off-topic but…,

although I am a C++ programmer for years, I have something against porting C
code to C++ code. Because something was originally written in C, means that
it was designed from a procedural point of view. It you wrap a class around
it, does NOT make it proper OOP. Because most API’s have some kind of
initialize method, like SDL_Init for example. Using OOP you cannot call this
function from a constructor, because then it would be called every time. So,
in the end you’ll end up with some static methods (read: functions) and
static members (read: global-variables). As a result you get:

  1. probably more code
  2. unnecessary complexity
  3. Unnatural feeling

Don’t get me wrong, this was NOT a flame! I’m just ‘warning’ you. For
example: I used to have some singletons in my project, a Video object, a
Soundsystem object and some resource-management objects. I ‘stripped’ the
class-code and made them API’s, and guess what? It feels so much natural
(sorry, second time) when calling a function. So, I made myself a new
"rule": when I only need one instance, I don’t make a class, just a set of
functions. I use objects though, for my game objects like tiles, animations,
enemies and such. Because those kind of object makes you think in objects,
so that in feels very comfortable and logic to do so…

Kind regards (I mean it),

Patrick.

----- Original Message -----
From: “Kai Blin” <kai.blin at med.uni-tuebingen.de>
To:
Sent: Thursday, August 15, 2002 6:31 AM
Subject: Re: [SDL] Howto dipslay a text with SDL?

On Wednesday 14 August 2002 23:29, Jacek Pop?awski wrote:

On Wed, Aug 14, 2002 at 02:41:47PM +0200, Jean wrote:

I mean how can I write a text in my sdl window?

Please seach for “Sfont”.

If you’re doing C++, you might want to have a look at SoFont, too. It’s

not

quite up to date, and I can’t seem to reach the developers, but I’m just
trying to port SFont to C++ again, and SoFont is a great help. (Not that

the

source was documented or something :wink:

Cheers, Kai


Kai Blin Linux system administrator Tel: Ring-86592
Allgemeine Chirurgie Universitaetsklinikum Tuebingen

Baseball is a skilled game. It’s America’s game - it, and high taxes.
– The Best of Will Rogers