/* * GRacer * * Copyright (C) 1999 Takashi Matsuda * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ #include #include #include #include #include "tcldefs.h" #include "glbind.h" #include "glutwidgets.h" #include "gluttclwidgets.h" #include "glutgame.h" #include "joystick.h" #include "sound.h" int main (int argc, char **argv) { Tcl_Interp *interp; int window; glutInit (&argc, argv); glutInitDisplayMode (GLUT_RGBA|GLUT_DOUBLE|GLUT_DEPTH); interp = Tcl_CreateInterp (); if (Tcl_Init (interp) == TCL_ERROR) { return -1; } if (Glbind_Init (interp) == TCL_ERROR) { fprintf (stderr, "GlBind initialization failed.\n"); return -1; } if (GlutTclWidget_Init (interp) == TCL_ERROR) { fprintf (stderr, "GlutTclWidget initialization failed.\n"); return -1; } if (GrViewer_Init (interp) == TCL_ERROR) { fprintf (stderr, "GrViewer initialization failed.\n"); return -1; } if (Joystick_Init (interp) == TCL_ERROR) { fprintf (stderr, "Joystick initialization failed.\n"); return -1; } if (Sound_Init (interp) == TCL_ERROR) { fprintf (stderr, "Sound initialization failed.\n"); return -1; } if (Tcl_EvalFile (interp, DATADIR "/scripts/init.tcl") == TCL_ERROR && Tcl_EvalFile (interp, "./init.tcl") == TCL_ERROR) { fputs (Tcl_GetVar (interp, "errorInfo", TCL_GLOBAL_ONLY), stderr); fprintf (stderr, "\ninitialization failed.\n"); return -1; } window = glutCreateWindow ("GRacer " VERSION); glutSetIconTitle ("gracer"); glutDisplayFunc (glut_display_func); glutReshapeFunc (glut_reshape_func); glutKeyboardFunc (glut_keyboard_func); glutSpecialFunc (glut_special_func); glutMouseFunc (glut_mouse_func); glutPassiveMotionFunc (glut_passive_motion_func); if (Tcl_EvalFile (interp, DATADIR "/scripts/postinit.tcl") == TCL_ERROR && Tcl_EvalFile (interp, "./postinit.tcl") == TCL_ERROR) { fputs (Tcl_GetVar (interp, "errorInfo", TCL_GLOBAL_ONLY), stderr); fprintf (stderr, "\npostinit script failed.\n"); return -1; } glutMainLoop (); return 0; }