Newbie question

is it possible(how can I)?
open and read a plain text file and
display it with a font of my choice?

if anyone could advice me on this i’d be very greatful

As for displaying it with a font of your choice, take a look at the
SDL_ttf library on the SDL libraries page.

A for reading a plain text file, pick up any book on c or c++.

–Ryan

shnez13 wrote:>

is it possible(how can I)
open and read a plain text file and
display it with a font of my choice?

if anyone could advice me on this i’d be very greatful

To read a file in C you will probably use FILE * and the open function.
In C++ you can use file streams.

DaveOn Sun, 14 May 2000, Ryan J. Evans wrote:

As for displaying it with a font of your choice, take a look at the
SDL_ttf library on the SDL libraries page.

A for reading a plain text file, pick up any book on c or c++.

–Ryan

shnez13 wrote:

is it possible(how can I)
open and read a plain text file and
display it with a font of my choice?

if anyone could advice me on this i’d be very greatful

Is there any harm in calling SDL_Init(SDL_INIT_VIDEO) to initialize
exposure of video routines in the SDL.dll and then further in the
program re-call SDL_Init() with SDL_Init(SDL_INIT_AUDIO) if I would like
to add audio access under certain conditions, or should SDL_Init() only
be called once with both flags passed, let’s say at the beginning of a
program. Of course calling SDL_Quit() when this is all over and done
with.
thanks in advance
Hubert

Is there any harm in calling SDL_Init(SDL_INIT_VIDEO) to initialize
exposure of video routines in the SDL.dll and then further in the
program re-call SDL_Init() with SDL_Init(SDL_INIT_AUDIO) if I would like
to add audio access under certain conditions, or should SDL_Init() only
be called once with both flags passed, let’s say at the beginning of a
program.

There’s no harm in calling separately. The only caveat is when working
on Windows and initializing both the audio and the video. In this case,
if you initialize them separately, the video should be initialized first.

(Note to self: See if the sound HWND can be changed dynamically)

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Hi Sam,

Thanks for your response, actually the reason why I ask is for a wrapper I am
working on in Eiffel, and the structure I chose has these entities separated
into classes. I hope that this will be in the end cross-platformed just as
SDL is now. Eiffel has a garbage collector and my implementation has it that
SDL_Quit is called for each time SDL_Init is called. Any harm in this?

As for your response:

There’s no harm in calling separately. The only caveat is when working
on Windows and initializing both the audio and the video. In this case,
if you initialize them separately, the video should be initialized first.

What would happen if the audio is called before the video, and in particular
is there any order of preference for the 4 main initialization I am interested
in, which is video, audio, cdrom and timer. I am currently working in win32
but i hope to be at least cross-platformed to Linux as well.

later
hec

Hubert Cater wrote:

Hi Sam,

Thanks for your response, actually the reason why I ask is for a wrapper I am
working on in Eiffel, and the structure I chose has these entities separated
into classes. I hope that this will be in the end cross-platformed just as
SDL is now. Eiffel has a garbage collector and my implementation has it that
SDL_Quit is called for each time SDL_Init is called. Any harm in this?

If my reading of the SDL code was correct (a few weeks ago), it keeps
track of this with flags. So you should be able to call SDL_Quit any
number of times.

-John

If my reading of the SDL code was correct (a few weeks ago), it keeps
track of this with flags. So you should be able to call SDL_Quit any
number of times.

Right, but it doesn’t ref count, does it? Ie, if I have an app that
calls SDL_Init nested, will the first SDL_Quit shut me down? Is that
desirable or not?

m.On Thu, Jul 13, 2000 at 03:09:21PM -0700, John R. Hall wrote:


Programmer “Ha ha.” “Ha ha.” "What are you laughing at?"
Loki Software "Just the horror of being alive."
http://lokigames.com/~briareos/ - Tony Millionaire

Then would SDL_InitSubSystem not be a better choice?On Thu, 13 Jul 2000, Michael Vance wrote:

On Thu, Jul 13, 2000 at 03:09:21PM -0700, John R. Hall wrote:

If my reading of the SDL code was correct (a few weeks ago), it keeps
track of this with flags. So you should be able to call SDL_Quit any
number of times.

Right, but it doesn’t ref count, does it? Ie, if I have an app that
calls SDL_Init nested, will the first SDL_Quit shut me down? Is that
desirable or not?

m.


Programmer “Ha ha.” “Ha ha.” "What are you laughing at?"
Loki Software "Just the horror of being alive."
http://lokigames.com/~briareos/ - Tony Millionaire

Martin

Bother! said Pooh, as he mixed the lime with the coconut!

Michael Vance wrote:

If my reading of the SDL code was correct (a few weeks ago), it keeps
track of this with flags. So you should be able to call SDL_Quit any
number of times.

Right, but it doesn’t ref count, does it? Ie, if I have an app that
calls SDL_Init nested, will the first SDL_Quit shut me down? Is that
desirable or not?

No, it doesn’t ref count, and the first call will shut everything down.
But it won’t segfault if you shut it down twice.

-John> On Thu, Jul 13, 2000 at 03:09:21PM -0700, John R. Hall wrote:

If my reading of the SDL code was correct (a few weeks ago), it keeps
track of this with flags. So you should be able to call SDL_Quit any
number of times.

Use SDL_InitSubSystem() and SDL_QuitSubSystem().

SDL_Quit() shuts everything down. :slight_smile:

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Hi,

I’m pretty much new to SDL, and I can’t get past this little stumbling block
which prevents me from getting further…

Whenever I try to create a fullscreen app in SDL, under Windows, if I don’t
use the resolution I’m running in (say I try to create a fullscreen surface
@ 640x480, but running windows @ 1280x1024), all I get is a small black
rectangle at the top of the screen and the mouse cursor is confined to that
area. Could it have anything to do with my drivers? It happened even when
trying to use the sample code from the SDL Doc Project and it still
happened.

– Anthony T.

Yes, it does have to do with your drivers. I had the same problem in
Windows and Linux. I’ve fixed the window’s problem with new drivers, but
still working on the Linux. Just get new drivers. It should fix it.> ----- Original Message -----

From: thomasel@voyager.bxscience.edu (Anthony Thomasel)
To:
Sent: Sunday, October 07, 2001 6:27 PM
Subject: [SDL] newbie question

Hi,

I’m pretty much new to SDL, and I can’t get past this little stumbling
block
which prevents me from getting further…

Whenever I try to create a fullscreen app in SDL, under Windows, if I
don’t
use the resolution I’m running in (say I try to create a fullscreen
surface
@ 640x480, but running windows @ 1280x1024), all I get is a small black
rectangle at the top of the screen and the mouse cursor is confined to
that
area. Could it have anything to do with my drivers? It happened even when
trying to use the sample code from the SDL Doc Project and it still
happened.

– Anthony T.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl