1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
#include "c_defs.h"
/************************************************************************
*
* $Id: colorGL.c,v 1.3 2004/10/25 00:15:34 jon Exp $
*
* Copyright 1999-2004 Jon Trulson under the ARTISTIC LICENSE. (See LICENSE).
***********************************************************************/
/**********************************************************************/
/* Unix/C specific porting and supporting code Copyright (C)1994-1996 */
/* by Jon Trulson <jon@radscan.com> under the same terms and */
/* conditions of the original copyright by Jef Poskanzer and Craig */
/* Leres. */
/* */
/**********************************************************************/
#include "conqdef.h"
#include "context.h"
#include "conf.h"
#include "global.h"
#include "color.h" /* instantiate externs here */
#include "ui.h"
#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glx.h>
void uiPutColor(cqColor color)
{
GLfloat base = 0.7;
/* convert a 'conquest' color into something more useful in GL :) */
if (color & CQC_A_BOLD)
base += 0.2;
if (color & CQC_A_DIM)
base -= 0.2;
color &= CQC_FG_MASK; /* strip everything but color info */
if (color == NoColor) /* white */
glColor3f(base, base, base);
else if (color == RedColor) /* red */
glColor3f(base, 0.0, 0.0);
else if (color == GreenColor) /* green */
glColor3f(0.0, base, 0.0);
else if (color == BlueColor) /* blue */
glColor3f(0.0, 0.0, base);
else if (color == YellowColor) /* yellow */
glColor3f(base, base, 0.0);
else if (color == CyanColor) /* cyan */
glColor3f(0.0, base, base);
else if (color == MagentaColor) /* magenta */
glColor3f(base, 0.0, base);
else if (color == BlackColor) /* black */
glColor3f(0.0, 0.0, 0.0);
else /* unknown */
glColor3f(1.0, 1.0, 1.0);
return;
}
/* initialize color variables. assumes curses has been initialized. */
void uiInitColors(void)
{
/* nothing to do here - we translate in uiPutColor */
return;
}
|