http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

TheGrumpyProgrammer



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trig Tables, Console Apps



> xinc = sangle[<function here>(tmp, 360)] / 100;
> 
> I want it to get the remainder from tmp (float) / 360 and then call
> the array of that number from the sangle double float, divide it by
> 100 and store it in xinc (double float).

As mentioned, modulo (Modulus?), viz. "%", works. If you don't mind using
bytes or uints to measure your angle, another popular way of doing this is
to to use 2^8, 2^16, etc. (depending on accuracy) degrees in your circle
(rather than 360). Then just call sangle[var], where var is an undigned
type of the same size as the degrees in the circle. It should loop
automatically, including negative values (which mod doesn't handle as
well). Say for example you wanted to find the sine of an angle (I assume
that's what you're trying to do). You could use a 256-degree circle with a
lookup table something like this:

float Sin[256];
for(i = 0; i < 256; i++) Sin[i] = sin(i * PI / 128); // should be PI
divided by half the # of degrees
<sine of angle> = Sin[(unsigned char)<angle>];

Now for my (newbie) question. I feel like a total idiot asking this, but in
a DOS compiler, I've compiled DOS programs. In a Windows compiler, I've
compiled Windoze programs. Recently I read something about how easy it is
to use OpenGL with a console application. It sounded good to me, so I went
to try and figure out what a console application was by trying to compile
one with my Windows compiler. It came out in a DOS box, like a DOS program.
When I tried to use int 10h to switch video modes, though, it didn't do
anything. Now I'm guessing that a console application is a Windows program
running in a DOS interface? I can't seem to find any info on this on-line,
so I was hoping someone could explain to me what, exactly, a console
application is and what it can be used for. Is there a way to do graphics
directly (quickly) like modeX, or do I have to use OpenGL / DirectX. If so,
does anyone know of any resources I can look up on the subject or have an
opinion about using this (Is it slow, fast, portable, easy to use?) instead
of a normal Win or DOS app. It sounds promising to me because I don't like
using Windows, but I like the simplicity of not having to worry about all
the memory and compatibility issues of DOS.

-- Neil Edelman
-- ICQ UIN: 705130
-- email: mailto:dreaded.neil@phreaker.net?subject=sig
-- home: http://members.xoom.com/dreadedneil
-- moop: http://moop.bizland.com
-- "My air-to-air missile overrides your air traffic control clearance"
=================================================================
The GameProgrammer.Com mailing list is for the open discussion
of any topic related to the art, science, and business of
programming games. This list is especially tolerant of beginners.
We were all beginners once

To SUBSCRIBE or UNSUBSCRIBE please visit:
http://gameprogrammer.com/mailinglist.html