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?
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.
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