1: /* File: fbn.h
     2:    Submitted as part of Project 4 for EECS 672, Spring 2007
     3:    by Douglas McClendon, KUID 0536810
     4: */
     5: 
     6: 
     7: /*
     8:  * fbn.h
     9:  *
    10:  * This is a Game Development Toolkit, providing mini-api's for
    11:  * sound, opengl text rendering, joystick, and more...
    12:  */
    13: 
    14: #ifndef FBN_H 
    15: #define FBN_H 1 
    16: 
    17: #include <stdio.h> 
    18: #include <stdlib.h> 
    19: #include <sys/stat.h> 
    20: #include <GL/gl.h> 
    21: #include "TexFont.h" 
    22: 
    23: // OSS includes
    24: #include <sys/ioctl.h> 
    25: #include <unistd.h> 
    26: #include <fcntl.h> 
    27: #include <sys/soundcard.h> 
    28: 
    29: #define FBN_SND_STEREO 0 
    30: #define FBN_SND_SPEED 8000 
    31: #define FBN_SND_FORMAT AFMT_U8 
    32: 
    33: #define MAX_SOUNDS 16 
    34: #define debug printf 
    35: #define output printf 
    36: 
    37: #define FBN_SET_RGBA(COLOR, R, G, B, A) COLOR[0]=R; \ 
    38:                                    COLOR[1]=G; \
    39:                                    COLOR[2]=B; \
    40:                                    COLOR[3]=A;
    41: 
    42: #define FBN_SET_XYWH(POS, X, Y, W, H) POS.x=X; \ 
    43:                                       POS.y=Y; \
    44:                                       POS.w=W; \
    45:                                       POS.h=H; 
    46: 
    47: typedef struct Sound_tag{
    48:   const char * sound_file;
    49:   void * data;
    50:   int data_length;
    51: }Sound;
    52: 
    53: typedef struct SoundSet_tag{
    54:   int numsounds;
    55:   Sound sounds[MAX_SOUNDS];
    56: } SoundSet;
    57: 
    58: typedef struct Camera_tag{
    59:   GLdouble eyex;
    60:   GLdouble eyey;
    61:   GLdouble eyez;
    62:   GLdouble centerx;
    63:   GLdouble centery;
    64:   GLdouble centerz;
    65:   GLdouble upx;
    66:   GLdouble upy;
    67:   GLdouble upz;
    68: } Camera;
    69: 
    70: // sound engine functions
    71: int  fbnSoundInit();
    72: void fbnSoundFini();
    73: void fbnSoundLoadData(SoundSet *soundset);
    74: void fbnSoundUnloadData(SoundSet *soundset);
    75: void fbnSoundPlay(int sound_id, SoundSet *soundset);
    76: void fbnSoundPlay_subthread(void *ptr);
    77: void fbnSoundWait(void);
    78: 
    79: int fbnSizeofFile(const char *filename);
    80: 
    81: // txf extented functions
    82: void fbnTxfGLStateSet(void);
    83: void fbnTxfGLStateUnset(void);
    84: void fbnTxfRenderString(char *screen_string, char *maxstring,
    85: 		     float x, float y, float w, float h,
    86: 		     float r, float g, float b, float a,
    87: 		     TexFont *txf);
    88: void fbnTxfRenderStringExtruded(char *string, char *maxstring,
    89: 			       float center_x, float center_y,
    90: 			       float width, float height, 
    91: 			       float extrude_x, float extrude_y,
    92: 			       int steps,
    93: 			       float fg_r, 
    94: 			       float fg_g, 
    95: 			       float fg_b, 
    96: 			       float fg_a, 
    97: 			       float bg_r, 
    98: 			       float bg_g, 
    99: 			       float bg_b, 
   100: 			       float bg_a, 
   101: 			       TexFont *txf);
   102: 
   103: // misc functions
   104: void fbnSetPlaceString(char *placestring, int place);
   105: 
   106: /*
   107:  * Globals
   108:  */
   109: int audio_fd;  
   110: 
   111: #endif 
   112: