File: main.c | Size: 1,998 bytes | Download file | Back to directory listing | BWPOW's homepage
/*
    expC - Expressions analyzator and viewer
    Copyright (C) 2004 Samuel Kupka
 
    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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
 
#include <stdio.h>
#include <string.h>
#include <allegro.h>
 
#include "expC.h"
 
void main_koniec(char *text)
{
  expr_exit();
  set_gfx_mode(-1,0,0,0,0);
  if(strlen(text)>0){
    allegro_message(text);
  }
  allegro_exit();
  exit(0);
}
 
int main(void)
{
  allegro_init();
 
  install_keyboard();
  install_timer();
  install_mouse();
  expr_init();
 
  set_color_depth(16);
  if(set_gfx_mode(GFX_AUTODETECT_FULLSCREEN,800,600,0,0)!=0){
    set_color_depth(24);
    if(set_gfx_mode(GFX_AUTODETECT_FULLSCREEN,800,600,0,0)!=0){
      main_koniec("Can't set graphics mode!");
    }
  }
  set_uformat(U_ASCII);
 
  basic_box(screen,300,290,200,20,6);
  textout_centre_ex(screen,font,"Nahravam data",400,296,0,-1);
 
  actual=create_bitmap(800,600);
  bmp2=create_bitmap(800,600);
 
  packfile_password("IdeaZ");
  data=load_datafile("#");
  if(data==0){
     data=load_datafile("expC.dat");
     if(data==0) main_koniec("Nemozem najst datovy subor!");
  }
  set_mouse_sprite(data[mouse_std].dat);
  set_mouse_sprite_focus(2,2);
 
  font=(FONT *)data[dfont].dat;
 
  gui_start();
 
  main_koniec("");
  return 0;
}
END_OF_MAIN();