Some questions

Hi!

I am new in SDL. I've some questions about SDL. First, does SDL

application
must be run under some window manager? i.e. under X window in Linux.
Because
I always get the error “no video devices available” when I just run some
demo programs
under linux console.

Second, is there any basic drawing funtion in SDL? i.e. "DrawLine"

“DrawArc” “FillArc”
“FillArc” “FillPolygon” etc. I just found only one “SDL_FillRect” in
API reference. And
are there any clipping functions in SDL?

Another one doubt is how to handle displaying font in SDL? If I need to

display other language
character set beside English, for example, Chinese big-5, how to do
that? Shold I use unnicode?
Or how to handle with two-byte charater set?

Thanks... :)

Moya

Hi Moya,

First, does SDL application must be run under some window manager?
i.e. under X window in Linux.

X is not a window-manager, it’s a level below that. Enlightenment, Afterstep,
WindowMaker are examples for windowmanagers.

Because I always get the error “no video devices available” when I just
run some demo programs under linux console.

What about just trying it under X ? :slight_smile: Ok, perhaps you don’t have it
installed. You need either X, fbcon, svga-lib or ggi, of which I only
ever tried X.

Second, is there any basic drawing funtion in SDL? i.e. “DrawLine”
“DrawArc” “FillArc” “FillArc” “FillPolygon” etc.

I don’t think so (wouldn’t fit the “simple” in “SDL” :wink:

And are there any clipping functions in SDL?

Yes, from SDL_video.h:

extern DECLSPEC void SDL_SetClipping(SDL_Surface *surface,
int top, int left, int bottom, int right);

HTH,
robOn Thu, Feb 24, 2000 at 10:50:08AM +0800, Moya wrote:

Moya wrote:

Second, is there any basic drawing funtion in SDL? i.e. "DrawLine"

“DrawArc” “FillArc”
“FillArc” “FillPolygon” etc. I just found only one “SDL_FillRect” in
API reference. And
are there any clipping functions in SDL?

I have written a few of these functions, i.e. for drawing lines,
polygons, and filled polygons. Since my ten units at school plus a
small business I’m helping set up are eating a lot of my time I haven’t
been able to package these drawing primitives up into a library which is
fit for public consumption. If you want I can send you a tarball of the
source files I have at this point. Mail me privately if you’re
interested.–

| Rafael R. Sevilla @Rafael_R_Sevilla |
| Instrumentation, Robotics, and Control Laboratory |

College of Engineering, University of the Philippines, Diliman

I have written a few of these functions, i.e. for drawing lines,
polygons, and filled polygons. Since my ten units at school plus a
small business I’m helping set up are eating a lot of my time I haven’t
been able to package these drawing primitives up into a library which is
fit for public consumption. If you want I can send you a tarball of the
source files I have at this point. Mail me privately if you’re
interested.

Yes, please!

Thanks,

Steve Madsen
H2Eye Ltd
24-28 Hatton Wall
London EC1N 8JH
Tel:+44 (0) 207 404 9600
Fax: +44 (0) 207 404 9490
Email: @Steve_Madsen

Steve Madsen wrote:

I have written a few of these functions, i.e. for drawing lines,
polygons, and filled polygons. Since my ten units at school plus a
small business I’m helping set up are eating a lot of my time I haven’t
been able to package these drawing primitives up into a library which is
fit for public consumption. If you want I can send you a tarball of the
source files I have at this point. Mail me privately if you’re
interested.

Yes, please!

Here it is, and a brief explanation of what the files inside are for:

convpoly.c: Convex polygons

This file contains functions for detecting whether a polygon is convex
(actually, monotone vertical polygons; for what this means, read Mike
Abrash’s Black Book). Is significantly faster than the routines in
polyfill.c for polygons they apply to.

low-draw.c: Low-level drawing functions

Two different line-drawing functions are in this file: a regular
unantialiased Bresenham line drawer (which you’ll probably use more
often), and an antialiased line drawing function based on an algorithm
by Xiaolin Wu. Also has some horizontal span drawing functions used by
the polygon fill functions.

polyfill.c: Generic filled polygon functions

The big tamale. The functions here should fill any possible polygon you
can throw at it. Uses the winding rule to determine what parts of the
polygon are inside. Detects monotone vertical polygons and uses the
monotone vertical fill routine instead when applicable.

polygon.h: definitions

polytest1.c: convex polygon fill test (regular polygons)

polytest2.c: general polygon fill test

Compiling convpoly.c, low-draw.c, and polyfill.c and linking the
associated objects to the test programs or a program of your own that
uses it should do the trick. If you have any problems, feel free to
ask. Licensing for this code: BSD/X Windows. In other words, you can
do what you want with it as long as you thank me for it.–

| Rafael R. Sevilla @Rafael_R_Sevilla |
| Instrumentation, Robotics, and Control Laboratory |

College of Engineering, University of the Philippines, Diliman

-------------- next part --------------
A non-text attachment was scrubbed…
Name: polygon.tar.gz
Type: application/x-gzip
Size: 8996 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20000225/7f75d816/attachment.bin