Пример #1
0
/*  loadEssentials()

Loads support variables such as mousePic, screenBuffer, etc.

*/
void loadEssentials()
{
	screenBuffer = create_bitmap(1024, 768);
	loadBackground = makeBitmap("Images/Loading Background.gif");
	mousePic = makeBitmap("Images/GameMouse.gif");
   font15 = makeFont("Text/Hand15.pcx");
}
Пример #2
0
void showAssignment()
{
     BITMAP *background = makeBitmap("Menu_Images/Instructions0.gif");

     draw_sprite(menuBuffer, background, 0, 0);
     blit(menuBuffer, screen, 0,0,0,0,1024,768);
		clear_keybuf();
		readkey();
		background = makeBitmap("Menu_Images/Instructions1.gif");
     draw_sprite(menuBuffer, background, 0, 0);
     blit(menuBuffer, screen, 0,0,0,0,1024,768);
		clear_keybuf();
		readkey();
}
Пример #3
0
/* set up the system */
static void setup (struct state *st)
{
    XWindowAttributes xgwa;
    XGCValues gcv;

    XGetWindowAttributes (st->dpy, st->window, &xgwa);

    st->visual = xgwa.visual;
    st->cmap = xgwa.colormap;
    st->windowWidth = xgwa.width;
    st->windowHeight = xgwa.height;

    gcv.background = get_pixel_resource (st->dpy, xgwa.colormap,
                                         "background", "Background");
    gcv.foreground = get_pixel_resource (st->dpy, xgwa.colormap,
                                         "foreground", "Foreground");
    st->fg_pixel = gcv.foreground;
    st->theGC = XCreateGC (st->dpy, st->window, GCForeground|GCBackground, &gcv);

    st->theBitmap = makeBitmap(BARCODE_WIDTH * MAX_MAG, BARCODE_HEIGHT * MAX_MAG);
    st->theImage = XCreateImage(st->dpy, st->visual, 1, XYBitmap, 0, st->theBitmap->buf,
			    st->theBitmap->width, st->theBitmap->height, 8,
			    st->theBitmap->widthBytes);
    st->theImage->bitmap_bit_order = LSBFirst;
    st->theImage->byte_order       = LSBFirst;
}
Пример #4
0
int makeSlider(slider_t *theSlider)
{
  SAMPLE *slideNoise = makeSample("Menu_Sounds/SliderNoise.wav");
	BITMAP *bar = makeBitmap("Menu_Images/Slider.bmp");

	if (mouse_b && menu_mouseIsOverSlider(theSlider))
	{
			theSlider->position += (mouse_x - theSlider->position)/ 4;
            stop_sample(slideNoise);
            play_sample(slideNoise, 155, 0, 1000, 0);
	}
	draw_sprite(menuBuffer, bar, theSlider->position - 10, theSlider->top + 5);

    theSlider->current = (int)(((theSlider->position - theSlider->left) * theSlider->values)/theSlider->width) + 1;

    if (theSlider->current > theSlider->values)
    {
       theSlider->current = theSlider->values;
    }
    else if (theSlider->current < 1)
    {
       theSlider->current = 1;
    }
	return (theSlider->current);
}
Пример #5
0
void initializeButton(MENUBUTTON *theButton, int left, int top, int width, int height, char *fileName)
{
     theButton->left = left;
     theButton->top = top;
     theButton->width = width;
     theButton->height = height;
     theButton->picture = makeBitmap(fileName);
}
Пример #6
0
    void onDraw(const int loops, SkCanvas* canvas) override {
        makeBitmap();

        for(int i = 0; i < loops; i++) {
            SkPaint paint;
            paint.setImageFilter(fImageFilter);
            canvas->drawBitmap(fBitmap, 0, 0, &paint);
        }
    }
Пример #7
0
void printScenarioOptions()
{
    static int firstTime = 1;
    static slider_t moneySlider;

     if (firstTime)
     {
         initializeSlider(&moneySlider, 493, 190, 442, 50, 4, 1, 700);
     }
    static MENUBUTTON forwardArrow;
    initializeButton(&forwardArrow, 920, 677, 57, 50, "Menu_Images/Forward Arrow.bmp");

    BITMAP *newBackground = makeBitmap("Menu_Images/Scenario Menu 01.bmp");

    draw_sprite(menuBuffer, newBackground, 0, 0);
    makeSlider(&moneySlider);

    if (menu_mouseIsOver(&forwardArrow))
           {
                 forwardArrow.picture = makeBitmap("Menu_Images/Forward ArrowH.bmp");
           }
           else if (!menu_mouseIsOver(&forwardArrow))
           {
               forwardArrow.picture = makeBitmap("Menu_Images/Forward Arrow.bmp");
           }

        if (mouse_b)
        {
             if (menu_mouseIsOver(&forwardArrow))
             {
                showAssignment();
               stop_sample(newAmbient);
               loadingPhase = 0;
               inGame = 1;
               initializeAllObjects();
               initializeMapSquares();
                SPQR_Game();
					emptyGame();
             }
        }
        draw_sprite(menuBuffer, forwardArrow.picture, forwardArrow.left, forwardArrow.top);
        firstTime = 0;
}
Пример #8
0
/* set up the model */
static void setupModel (struct state *st)
{
    int i;

    st->barcode_max = 20;
    st->barcode_count = 0;
    st->barcodes = malloc (sizeof (Barcode) * st->barcode_max);

    for (i = 0; i < st->barcode_max; i++)
    {
	st->barcodes[i].bitmap = makeBitmap(BARCODE_WIDTH * MAX_MAG, 
					BARCODE_HEIGHT * MAX_MAG);
    }
}
Пример #9
0
void showIntro()
{
     SAMPLE *copyAmbient = makeSample("Menu_Sounds/Intro Wind.wav");
     BITMAP *copyBackground = makeBitmap("Menu_Images/Copyright Intro Screen.bmp");
     double startTime;

     blit(copyBackground, screen, 0,0,0,0,1024,768);//Draw the buffer to the screen
      play_sample(copyAmbient, 255, 0, 1000, 0);
      startTime = time(0);
      while (startTime + 10 > time(0) && !key[KEY_ESC])
      {
      }
      stop_sample(copyAmbient);
		destroy_sample(copyAmbient);
		destroy_bitmap(copyBackground);
}
Пример #10
0
void initializeShip()
{
	theShip.x = 500;
	theShip.y = 500;
	theShip.rotation = 0;
	theShip.velRotation = 0;
	theShip.velX = 0;
	theShip.velY = -1;
   theShip.rotorPower = 1;
   theShip.rocketPower = 0;
	theShip.width = 100;
	theShip.height = 100;
	theShip.maxHealth = 1000;
	theShip.health = 1000;
	theShip.picture = makeBitmap("Images/Ship.gif");
	theShip.next = NULL;
	theShip.previous = NULL;
}
Пример #11
0
/*  initializeAllObjects()

Loads all images, sounds, etc.
Operations are quite self-explanatory

*/
void initializeAllObjects()
{
	screenBuffer = create_bitmap(1024, 768);
	loadBackground = makeBitmap("Images/Loading Background.gif");
	mousePic = makeBitmap("Images/GameMouse.gif");
   font15 = makeFont("Text/Hand15.pcx");
	loadAllObjects();

   showLoadingBar("Building Sounds");

   buildingSound[EMPTY] = makeSample("Sound/Building/BUILD1.wav");
   buildingSound[ROAD] = makeSample("Sound/Building/BUILD1.wav");
   buildingSound[MARKET] = makeSample("Sound/Building/COIN.wav");
   buildingSound[FARM] = makeSample("Sound/Building/GRANARY1.wav");
   buildingSound[FOUNTAIN] = makeSample("Sound/Building/FOUNTAIN.wav");
   buildingSound[THEATRE] = makeSample("Sound/Building/ART_PIT.wav");
   buildingSound[TEMPLE] = makeSample("Sound/Building/ORACLE.wav");
   buildingSound[POTTERSHOP] = makeSample("Sound/Building/CLAY_PIT.wav");
   buildingSound[BARBERSHOP] = makeSample("Sound/Building/BARBER.wav");
   buildingSound[FURNITUREWORKSHOP] = makeSample("Sound/Building/FORUM.wav");
   buildingSound[WINEPRESS] = makeSample("Sound/Building/wine_workshop.wav");
   buildingSound[BATHHOUSE] = makeSample("Sound/Building/BATHS.wav");
   buildingSound[SLAVETRADER] = makeSample("Sound/Building/CLINIC.wav");
   buildingSound[OLIVEPRESS] = makeSample("Sound/Building/MINE.wav");
   buildingSound[ACADEMY] = makeSample("Sound/Building/FORUM.wav");
   buildingSound[TENT] = makeSample("Sound/Building/HOUSING.wav");



   selector = makeBitmap("Images/Selector.gif");


	showLoadingBar("People");


	personPic[0] = makeBitmap("Images/Person0.gif");
	personPic[1] = makeBitmap("Images/Person1.gif");
	personPic[2] = makeBitmap("Images/Person2.gif");
	personPic[3] = makeBitmap("Images/Person3.gif");
	personPic[4] = makeBitmap("Images/Person4.gif");
	personPic[5] = makeBitmap("Images/Person5.gif");

	infoFile = fopen("Text/InfoFile.txt", "w");

	HUD = makeBitmap("Images/HUD.bmp");

   int tY[NUMHUDBUTTONS] = {49, 100, 151, 202, 254, 304, 355, 401, 452, 508, 559, 610, 661, 712};
	for (int i = 0; i < NUMHUDBUTTONS; i++)
	{
		resourceButton[i].left = 968;
		resourceButton[i].top = tY[i];
		resourceButton[i].width = 34;
		resourceButton[i].height = 34;
	}

	menuButton.left = 309;
	menuButton.top = 0;
	menuButton.width = 77;
	menuButton.height = 33;

	buildingButton.left = 802;
	buildingButton.top = 42;
	buildingButton.width = 63;
	buildingButton.height = 115;

	personButton.left = 867;
	personButton.top = 42;
	personButton.width = 63;
	personButton.height = 115;

	placmentOutline = makeBitmap("Images/placmentOutline.bmp");

	showLoadingBar("Ambient Sounds");

   ambientSound[0] = makeSample("Sound/Bird0.wav");
   ambientSound[1] = makeSample("Sound/Bird1.wav");
   ambientSound[2] = makeSample("Sound/Bird2.wav");
   ambientSound[3] = makeSample("Sound/Bird3.wav");
   ambientSound[4] = makeSample("Sound/Bird4.wav");
   ambientSound[5] = makeSample("Sound/Bird5.wav");
   ambientSound[6] = makeSample("Sound/Bird6.wav");
   ambientSound[7] = makeSample("Sound/Bird7.wav");

    font70 = makeFont("Text/Hand70.pcx");
    font15 = makeFont("Text/Hand15.pcx");

	resourceColour[FOOD] = makecol(255, 255,0);
	resourceColour[WATER] = makecol(0,0,255);
	resourceColour[ENTERTAINMENT] = makecol(255 ,0,0);
	resourceColour[RELIGION] = makecol(170, 170, 170);
	resourceColour[POTTERY] = makecol(230, 196, 113);
	resourceColour[BARBER] = makecol(214, 214, 214);
	resourceColour[FURNITURE] = makecol(94, 74,0);
	resourceColour[WINE] = makecol(255, 43, 124);
	resourceColour[BATHING] = makecol(0,0,255);
	resourceColour[SLAVES] = makecol(255,100,100);
	resourceColour[OLIVE_OIL] = makecol(0, 143, 75);
	resourceColour[EDUCATION] = makecol(255,255,255);


	showLoadingBar("Resource Icons");

	resourceIcon[0] = makeBitmap("Images/Icon0.gif");
	resourceIcon[1] = makeBitmap("Images/Icon1.gif");
	resourceIcon[2] = makeBitmap("Images/Icon2.gif");
	resourceIcon[3] = makeBitmap("Images/Icon3.gif");
	resourceIcon[4] = makeBitmap("Images/Icon4.gif");
	resourceIcon[5] = makeBitmap("Images/Icon5.gif");
	resourceIcon[6] = makeBitmap("Images/Icon6.gif");
	resourceIcon[7] = makeBitmap("Images/Icon7.gif");
	resourceIcon[8] = makeBitmap("Images/Icon8.gif");
	resourceIcon[9] = makeBitmap("Images/Icon9.gif");
	resourceIcon[10] = makeBitmap("Images/Icon10.gif");
	resourceIcon[11] = makeBitmap("Images/Icon11.gif");

	draw_sprite(screenBuffer, loadBackground, 0, 0);
	rectfill(screenBuffer, 209, 524, 209 + (int)(((float)((float)loadingPhase)/(float)(loadingPhases)) * (810 - 209)), 531, makecol(255, 0, 0));
	textprintf_centre_ex(screenBuffer, font15, 509, 482, 0, -1, "Loading Complete!       Press any key to continue");
	textprintf_centre_ex(screenBuffer, font15, 510, 480, makecol(255, 255, 255), -1, "Loading Complete!       Press any key to continue");
	draw_sprite(screenBuffer, mousePic, mouseX, mouseY);
	blit(screenBuffer, screen, 0,0,0,0,1024,768);
   clear_bitmap(screenBuffer);
	destroy_bitmap(loadBackground);

	readkey();
}
Пример #12
0
CustomCircle::CustomCircle(void)
{
    On = false;
    bmp = makeBitmap(SCREEN_W, SCREEN_H, TRANSPARENT);
    reset();
}
Пример #13
0
Card::Card(Suit s, unsigned int v)
  : NSWindow(true, gameWindow, 0, 0, cardWidth, cardHeight, 1, BlackPixel(dpy, 0))
{
#ifdef SHAPE
  if (Option::roundCard() && !initialized) {
    //Shape
    boundingMask = XCreateBitmapFromData(dpy, root(), (char*)boundingMask_bits,
                                         boundingMask_width,
                                         boundingMask_height);
    clipMask = XCreateBitmapFromData(dpy, root(), (char*)clipMask_bits,
                                     clipMask_width, clipMask_height);

    //Cursor
    XColor fore, back, xc;
    Pixmap p, mask;
    Colormap cm = DefaultColormap(dpy, 0);

    p =  XCreateBitmapFromData(dpy, gameWindow, (char*) cursor_bits,
                               cursor_width, cursor_height);
    mask = XCreateBitmapFromData(dpy, gameWindow, (char*) cursor_back_bits,
                                 cursor_back_width, cursor_back_height);
    XAllocNamedColor(dpy, cm, "white", &fore, &xc);
    XAllocNamedColor(dpy, cm, "black", &back, &xc);
    cursor = XCreatePixmapCursor(dpy, p,mask, &fore, &back, 0, 0);

    initialized = true;
  }
#endif

  _parent = 0;
  _stack = 0;
  _suit = s;
  _value = v;
  _removed = false;
  makeBitmap(s, v, bitmap);

  // initialization on X things
  unsigned long fore, back, hilight;

  if (suitColor(s) == RedSuit)
    fore = getColor(dpy, "red");
  else
    fore = getColor(dpy, "black");
  back = WhitePixel(dpy, 0);
  hilight = getColor(dpy, "lightskyblue4");

  _usualPixmap = XCreatePixmapFromBitmapData(dpy, gameWindow, bitmap,
                                             cardWidth - 2, cardHeight - 2,
                                             fore, back,
                                     DefaultDepth(dpy, DefaultScreen(dpy)));
  _hilightedPixmap = XCreatePixmapFromBitmapData(dpy, gameWindow, bitmap, cardWidth - 2,
                                                 cardHeight - 2, fore, hilight,
                                     DefaultDepth(dpy, DefaultScreen(dpy)));

  selectInput(ButtonPressMask | EnterWindowMask | LeaveWindowMask);
  backgroundPixmap(_usualPixmap);

#ifdef SHAPE
  if (Option::roundCard()) {
    XShapeCombineMask(dpy, window(), ShapeBounding, 0, 0, boundingMask, ShapeSet);
    XShapeCombineMask(dpy, window(), ShapeClip, 0, 0, clipMask, ShapeSet);
  }
#endif

  NSWindow::move(0, 0);

  map();
}
Пример #14
0
Card::Card(Suit s, unsigned int v)
  : NSWindow(true, gameWindow, 0, 0, cardWidth, cardHeight, 1, XC_BLACK)
{
  if (!initialized) {
#ifdef SHAPE
    if (Option::roundCard()) {
     	    //Shape
	    boundingMask = XCreateBitmapFromData(dpy, root(),
				boundingMask_bits, boundingMask_width,
				boundingMask_height);
	    clipMask = XCreateBitmapFromData(dpy, root(), clipMask_bits,
				clipMask_width, clipMask_height);
    }
#endif

    //Cursor
    //XColor fore, back, xc;
    //gi_window_id_t p, mask;
    //Colormap cm = DefaultColormap(dpy, 0);
    //p =  XCreateBitmapFromData(dpy, gameWindow, (char*) cursor_bits, cursor_width, cursor_height);
    //mask = XCreateBitmapFromData(dpy, gameWindow, (char*) cursor_back_bits, cursor_back_width, cursor_back_height);
    //XAllocNamedColor(dpy, cm, "white", &fore, &xc);
    //XAllocNamedColor(dpy, cm, "black", &back, &xc);
    //cursor = XCreatePixmapCursor(dpy, p,mask, &fore, &back, 0, 0);

#ifdef GIXOK
    uint16_t *p = gi_create_bitmap_from_data(16, 16, cursor_width, cursor_height, cursor_bits,
    	TRUE,TRUE);
    uint16_t *mask =  gi_create_bitmap_from_data(16, 16, cursor_back_width, cursor_back_height,
    	cursor_back_bits, TRUE,TRUE);
    cursor = GrNewCursor(16, 16, 8, 0, XC_BLACK, XC_WHITE, p, mask);
    free(p);
    free(mask);
#endif

    initialized = true;
  }

  _parent = 0;
  _stack = 0;
  _suit = s;
  _value = v;
  _removed = false;
  makeBitmap(s, v, bitmap);

  // initialization on X things
  unsigned long fore, back, hilight;

  if (suitColor(s) == RedSuit)
    fore = getColor( XC_RED);
  else
    fore = getColor( XC_BLACK);
  back = XC_WHITE;
  hilight = getColor( XC_LIGHTSKYBLUE4);


  _usualPixmap = 
    gi_create_pixmap_from_bitmap( gameWindow, bitmap, cardWidth - 2,
	cardHeight - 2, fore, back, gi_screen_format() );
  _hilightedPixmap = 
    gi_create_pixmap_from_bitmap( gameWindow, bitmap, cardWidth - 2,
	cardHeight - 2, fore, hilight, gi_screen_format() );


  selectInput(GI_MASK_BUTTON_DOWN | GI_MASK_MOUSE_ENTER | GI_MASK_MOUSE_EXIT);
  backgroundPixmap(_usualPixmap);

#ifdef SHAPE
  if (Option::roundCard()) {
    XShapeCombineMask(dpy, window(), ShapeBounding, 0, 0, boundingMask, ShapeSet);
    XShapeCombineMask(dpy, window(), ShapeClip, 0, 0, clipMask, ShapeSet);
  }
#endif

  NSWindow::move(0, 0);

  map();
}
Пример #15
0
int main(int argc, char *argv[])
{
	allegInitializations();
	loadEssentials();

    int i = 0;

    MENUBUTTON aButton[5];
    initializeButton(&aButton[0], 359, 356, 305, 55, "Menu_Images/Check Box.bmp");
    initializeButton(&aButton[1], 359, 432, 305, 55, "Menu_Images/Check Box.bmp");
    initializeButton(&aButton[2], 359, 507, 305, 55, "Menu_Images/Check Box.bmp");
    initializeButton(&aButton[3], 359, 583, 305, 55, "Menu_Images/Check Box.bmp");
    initializeButton(&aButton[4], 359, 659, 305, 55, "Menu_Images/Check Box.bmp");

    int buttonClicked = 0;
    menuBuffer = create_bitmap(1024,768);
    BITMAP *menuBackground[7];
    menuBackground[0] = makeBitmap("Menu_Images/Menu Background 04.bmp");
    menuBackground[1] = makeBitmap("Menu_Images/Menu Background 05.bmp");
    menuBackground[2] = makeBitmap("Menu_Images/Menu Background 06.bmp");
    menuBackground[3] = makeBitmap("Menu_Images/Menu Background 07.bmp");
    menuBackground[4] = makeBitmap("Menu_Images/Menu Background 08.bmp");
    menuBackground[5] = makeBitmap("Menu_Images/Menu Background 09.bmp");
    menuBackground[6] = makeBitmap("Menu_Images/Menu Background 10.bmp");
    BITMAP *highlighter = makeBitmap("Menu_Images/Menu Selector.bmp"); // Load our picture
    BITMAP *mouse = makeBitmap("Menu_Images/Mouse.bmp"); // Load our picture
    BITMAP *mouseH = makeBitmap("Menu_Images/MouseH.bmp"); // Load our picture
    SAMPLE *menuClick[5];
    menuClick[0] = makeSample("Menu_Sounds/Menu Select 1.wav");
    menuClick[1] = makeSample("Menu_Sounds/Menu Select 2.wav");
    menuClick[2] = makeSample("Menu_Sounds/Menu Select 3.wav");
    menuClick[3] = makeSample("Menu_Sounds/Menu Select 4.wav");
    menuClick[4] = makeSample("Menu_Sounds/Menu Select 5.wav");
    double startTime = 0;
    SAMPLE *menuButtonClick[5];
    menuButtonClick[0] = makeSample("Menu_Sounds/New Game.wav");
    menuButtonClick[1] = makeSample("Menu_Sounds/Load Game.wav");
    menuButtonClick[2] = makeSample("Menu_Sounds/Options.wav");
    menuButtonClick[3] = makeSample("Menu_Sounds/Credits.wav");
    menuButtonClick[4] = makeSample("Menu_Sounds/Quit Game.wav");

    SAMPLE *menuAmbient = makeSample("Menu_Sounds/Menu Ambient.wav");

    int randomizer = 0;

    srand(time(0));

    showIntro();

    draw_sprite(menuBuffer, menuBackground[0], 0, 0);
    draw_sprite(menuBuffer, highlighter, 6, 186);
    blit(menuBuffer, screen, 0,0,0,0,1024,768);//Draw the buffer to the screen
    play_sample(menuAmbient, 255, 0, 1000, 1);

    while (true)
    {
        if (fireCounter != fireCheck)
        {
           randomizer = rand() % 7;
				fireCheck = fireCounter;

        }
        draw_sprite(menuBuffer, menuBackground[randomizer], 0, 0);
        draw_sprite(menuBuffer, mouse, mouse_x, mouse_y);

        if (mouse_b)
        {
           draw_sprite(menuBuffer, mouseH, mouse_x, mouse_y);
           for (i = 0; i <= 4; i++)
               {
                  if (menu_mouseIsOver(&aButton[i]))
                  {
                     buttonClicked = i;
                  }
               }
          switch (buttonClicked)
          {
                 case 0:
                      play_sample(menuButtonClick[0], 200, 0, 1000, 0);
                      stop_sample(menuClick[randomizer]);
                      stop_sample(menuAmbient);
                      goToNewGameMenu();
                      play_sample(menuAmbient, 255, 0, 1000, 1);
                      buttonClicked = -1;
                 break;
                 case 1:
                      play_sample(menuButtonClick[1], 200, 0, 1000, 0);
                      //loadGame();
                 break;
                 case 2:
                      play_sample(menuButtonClick[2], 200, 0, 1000, 0);
                 break;
                 case 3:
                      play_sample(menuButtonClick[3], 50, 0, 1000, 0);
                 break;
                 case 4:
                      stop_sample(menuAmbient);
                      play_sample(menuButtonClick[4], 255, 0, 1000, 0);
                      startTime = time(0);
                      while (startTime + 4 > time(0))
                      {
                      }
                      return 0;
                 break;
                 default:
                         stop_sample(menuClick[randomizer]);
                         randomizer = rand() % 5;
                         play_sample(menuClick[randomizer], 255, 0, 500, 0);
                 break;
          }
        }
        else
        {
            buttonClicked = -1;
        }
        blit(menuBuffer, screen, 0,0,0,0,1024,768);//Draw the buffer to the screen
        clear_bitmap(menuBuffer); // Clear the contents of the buffer bitmap

     }

}END_OF_MAIN()
Пример #16
0
void goToNewGameMenu()
{
     int i = 0;
     int finishedSelecting = 0;

    BITMAP *check =  makeBitmap("Menu_Images/Checked Box.bmp");
    BITMAP *empty =  makeBitmap("Menu_Images/Check Box.bmp");

    MENUBUTTON aToggle[3];
           initializeButton(&aToggle[0], 65, 38, 314, 46, "Menu_Images/Check Box.bmp");
           initializeButton(&aToggle[1], 65, 111, 314, 46, "Menu_Images/Check Box.bmp");
           initializeButton(&aToggle[2], 65, 186, 314, 46, "Menu_Images/Check Box.bmp");

   MENUBUTTON backArrow;
       initializeButton(&backArrow, 10, 715, 50, 50, "Menu_Images/Back Arrow.bmp");


     int toggleClicked = -1;


     BITMAP *newBackground = makeBitmap("Menu_Images/New Game Initial.bmp");

     BITMAP *mouse =  makeBitmap("Menu_Images/Mouse.bmp");
     newAmbient = makeSample("Menu_Sounds/Battle Drums.wav");
     SAMPLE *toggleNoise = makeSample("Menu_Sounds/ToggleNoise.wav");

     play_sample(newAmbient, 100, 0, 1000, 1);

     while (1)
     {
           if (mouse_b)
           {
                for (i = 0; i <= 2; i++)
                {
                          if (menu_mouseIsOver(&aToggle[i]))
                          {
                             toggleClicked = i;
                             aToggle[i].picture = check;
                             stop_sample(toggleNoise);
                             play_sample(toggleNoise, 255, 0, 1000, 0);
                             finishedSelecting = 1;
                             //newBackground = load_bitmap("New Game Background 01.bmp", NULL);
                          }


                 }

                 if (menu_mouseIsOver(&backArrow))
                 {
                    stop_sample(newAmbient);
                    return;
                 }
           }
           for (i = 0; i <= 2; i++)
           {
               if (toggleClicked != i)
               {
                    aToggle[i].picture = empty;
               }
           }

           draw_sprite(menuBuffer, newBackground, 0, 0);

           if (finishedSelecting)
           {
               if (toggleClicked == 0)
               {
                  textprintf_centre_ex(menuBuffer, font, 500, 300, makecol(255, 255, 255), -1, "Not availible in the demo version!");
                  //printCampaignOptions();
               }
               if (toggleClicked == 1)
               {
                  printScenarioOptions();
               }
               if (toggleClicked == 2)
               {
                  textprintf_centre_ex(menuBuffer, font, 500, 300, makecol(255, 255, 255), -1, "Not availible in the demo version!");
                  //printBattleOptions();
               }
           }
           if (menu_mouseIsOver(&backArrow))
           {
                 backArrow.picture = makeBitmap("Menu_Images/Back ArrowH.bmp");
           }
           else
           {
               backArrow.picture = makeBitmap("Menu_Images/Back Arrow.bmp");
           }
           draw_sprite(menuBuffer, backArrow.picture, backArrow.left, backArrow.top);
           for (i = 0; i <= 2; i++)
           {
                draw_sprite(menuBuffer, aToggle[i].picture, aToggle[i].left, aToggle[i].top);
           }
           draw_sprite(menuBuffer, mouse, mouse_x, mouse_y);
           blit(menuBuffer, screen, 0,0,0,0,1024,768);
           clear_bitmap(menuBuffer);
     }
     stop_sample(newAmbient);
}
Пример #17
0
void initializeGame()
{
   screenBuffer = create_bitmap(1024, 768);
   reticle = makeBitmap("Images/Reticle.gif");
	machineGun = makeBitmap("Images/MachineGun.gif");
	bulletPic = makeBitmap("Images/Bullet.gif");
	missilePic = makeBitmap("Images/Missile.gif");

	explosionPic[0] = makeBitmap("Images/Explosion0.gif");
	explosionPic[1] = makeBitmap("Images/Explosion1.gif");
	explosionPic[2] = makeBitmap("Images/Explosion2.gif");
	explosionPic[3] = makeBitmap("Images/Explosion4.gif");
	explosionPic[4] = makeBitmap("Images/Explosion6.gif");
	explosionPic[5] = makeBitmap("Images/Explosion8.gif");
	explosionPic[6] = makeBitmap("Images/Explosion9.gif");
	explosionPic[7] = makeBitmap("Images/Explosion9.gif");
	explosionPic[8] = makeBitmap("Images/Explosion10.gif");
	explosionPic[9] = makeBitmap("Images/Explosion10.gif");
	explosionPic[10] = makeBitmap("Images/Explosion11.gif");
	explosionPic[11] = makeBitmap("Images/Explosion11.gif");

	smokePic[0] = makeBitmap("Images/GoodSmoke0.gif");
	smokePic[1] = makeBitmap("Images/GoodSmoke0.gif");
	smokePic[2] = makeBitmap("Images/GoodSmoke0.gif");
	smokePic[3] = makeBitmap("Images/GoodSmoke0.gif");
	smokePic[4] = makeBitmap("Images/GoodSmoke0.gif");
	smokePic[5] = makeBitmap("Images/GoodSmoke1.gif");
	smokePic[6] = makeBitmap("Images/GoodSmoke2.gif");
	smokePic[7] = makeBitmap("Images/GoodSmoke2.gif");
	smokePic[8] = makeBitmap("Images/GoodSmoke1.gif");
	smokePic[9] = makeBitmap("Images/GoodSmoke2.gif");
	smokePic[10] = makeBitmap("Images/GoodSmoke2.gif");
	smokePic[11] = makeBitmap("Images/GoodSmoke1.gif");
	smokePic[12] = makeBitmap("Images/GoodSmoke2.gif");
	smokePic[13] = makeBitmap("Images/GoodSmoke1.gif");
	smokePic[14] = makeBitmap("Images/GoodSmoke2.gif");

	enemyPic[0] = makeBitmap("Images/Enemy0.gif");

   foreground = makeBitmap("Images/Foreground.bmp");

   planePic = makeBitmap("Images/Plane.gif");
   debrisPic = makeBitmap("Images/Chunk.gif");

	initializeShip();
}
Пример #18
0
void printCampaignOptions()
{
     int i = 0;

    static int firstTime = 1;
    static int timeClicked = 0;
    static int sliderClicked = 1;

    BITMAP *check =  makeBitmap("Menu_Images/Checked Box.bmp");
    BITMAP *empty =  makeBitmap("Menu_Images/Check Box.bmp");

    static MENUBUTTON aSlider[3];


    static MENUBUTTON forwardArrow;


    static MENUBUTTON tutorial;

    BITMAP *newBackground = makeBitmap("Menu_Images/Campaign Menu 01.bmp");


   BITMAP *slider =  makeBitmap("Menu_Images/Slider.bmp");
   static BITMAP *difficulties[3];

   SAMPLE *slideNoise = makeSample("Menu_Sounds/SliderNoise.wav");

    if (firstTime)
    {
       initializeButton(&aSlider[0], 490, 180, 150, 50, "Menu_Images/Slider.bmp");
       initializeButton(&aSlider[1], 625, 180, 150, 50, "Menu_Images/Slider.bmp");
       initializeButton(&aSlider[2], 810, 180, 150, 50, "Menu_Images/Slider.bmp");
       initializeButton(&forwardArrow, 920, 677, 57, 50, "Menu_Images/Forward Arrow.bmp");
       initializeButton(&tutorial, 530, 340, 290, 46, "Menu_Images/Checked Box.bmp");
       difficulties[0] = makeBitmap("Menu_Images/Senator.bmp");
       difficulties[1] = makeBitmap("Menu_Images/Consul.bmp");
       difficulties[2] = makeBitmap("Menu_Images/Emperor.bmp");
    }

    draw_sprite(menuBuffer, newBackground, 0, 0);

    if (menu_mouseIsOver(&forwardArrow))
    {
                 forwardArrow.picture = makeBitmap("Menu_Images/Forward ArrowH.bmp");
    }
    else if (!menu_mouseIsOver(&forwardArrow))
    {
               forwardArrow.picture = makeBitmap("Menu_Images/Forward Arrow.bmp");
    }

    switch(sliderClicked)
    {
        case 0:
             draw_sprite(menuBuffer, slider, 498, 197);
             draw_sprite(menuBuffer, difficulties[0], 617, 255);
        break;
        case 1:
             draw_sprite(menuBuffer, slider, 700, 197);
             draw_sprite(menuBuffer, difficulties[1], 617, 255);
        break;
        case 2:
             draw_sprite(menuBuffer, slider, 913, 197);
             draw_sprite(menuBuffer, difficulties[2], 617, 255);
        break;
    }

        if (mouse_b)
        {
            for (i = 0; i <= 2; i++)
            {
                      if (menu_mouseIsOver(&aSlider[i]))
                      {
                         sliderClicked = i;
                         stop_sample(slideNoise);
                         play_sample(slideNoise, 155, 0, 1000, 0);
                         break;
                      }
             }
             if (menu_mouseIsOver(&forwardArrow))
             {
                return;
             }
             if (menu_mouseIsOver(&tutorial) && timeClicked < time(0))
             {
                timeClicked = time(0);
                if (tutorial.picture == empty)
                {
                   tutorial.picture = check;
                }
                else
                {
                    tutorial.picture = empty;
                }
             }
        }
        draw_sprite(menuBuffer, tutorial.picture, tutorial.left, tutorial.top);
        draw_sprite(menuBuffer, forwardArrow.picture, forwardArrow.left, forwardArrow.top);
        firstTime = 0;
}
Пример #19
0
void printBattleOptions()
{

     static slider_t aBattleSlider[3];

     static int firstTime = 1;
     static int characterClicked = 0;
    static BITMAP *godNames[3];

     if (firstTime)
     {
         initializeSlider(&aBattleSlider[0], 493, 190, 442, 50, 4, 1, 700);
         initializeSlider(&aBattleSlider[1], 493, 315, 442, 50, 4, 1, 700);
         initializeSlider(&aBattleSlider[2], 493, 600, 442, 50, 4, 1, 700);
         firstTime = 0;

    godNames[0] = makeBitmap("Menu_Images/Jupiter Name.bmp");
    godNames[1] = makeBitmap("Menu_Images/Mars Name.bmp");
    godNames[2] = makeBitmap("Menu_Images/Neptune Name.bmp");
     }

    BITMAP *newBackground = makeBitmap("Menu_Images/Single Battle Menu 01.bmp");
    int i = 0;
    int j = 0;
    static MENUBUTTON forwardArrow;
    initializeButton(&forwardArrow, 920, 677, 57, 50, "Menu_Images/Forward Arrow.bmp");

    static MENUBUTTON aGod[3];
    initializeButton(&aGod[0], 475, 434, 129, 66, "Menu_Images/Zeus.bmp");
    initializeButton(&aGod[1], 649, 434, 129, 66, "Menu_Images/Mars.bmp");
    initializeButton(&aGod[2], 825, 434, 129, 66, "Menu_Images/Neptune.bmp");

    static SAMPLE *aGodSound[3];
    aGodSound[0] = makeSample("Menu_Sounds/Jupiter.wav");
    aGodSound[1] = makeSample("Menu_Sounds/Mars.wav");
    aGodSound[2] = makeSample("Menu_Sounds/Neptune.wav");

    draw_sprite(menuBuffer, newBackground, 0, 0);

     for(i = 0; i <= 2; i++)
     {
     makeSlider(&aBattleSlider[i]);
     }

     if (menu_mouseIsOver(&forwardArrow))
           {
                 forwardArrow.picture = makeBitmap("Menu_Images/Forward ArrowH.bmp");
           }
           else
           {
               forwardArrow.picture = makeBitmap("Menu_Images/Forward Arrow.bmp");
           }

        if (mouse_b)
        {
           for (i=0; i<=2; i++)
           {
                 if (menu_mouseIsOver(&aGod[i]))
                 {
                       characterClicked = i;
                       for (j=0; j<=2; j++)
                       {
                            stop_sample(aGodSound[i]);
                       }
                       play_sample(aGodSound[i], 155, 0, 1000, 0);
                 }
           }
             if (menu_mouseIsOver(&forwardArrow))
             {
                return;
             }
        }
        aGod[0].picture = makeBitmap("Menu_Images/Zeus.bmp");
        aGod[1].picture = makeBitmap("Menu_Images/Mars.bmp");
        aGod[2].picture = makeBitmap("Menu_Images/Neptune.bmp");
        switch(characterClicked)
        {
            case 0:
                 aGod[0].picture = makeBitmap("Menu_Images/ZeusH.bmp");
            break;
            case 1:
                 aGod[1].picture = makeBitmap("Menu_Images/MarsH.bmp");
            break;
            case 2:
                 aGod[2].picture = makeBitmap("Menu_Images/NeptuneH.bmp");
            break;
        }
        for (i=0; i<=2; i++)
        {
                 draw_sprite(menuBuffer, aGod[i].picture, aGod[i].left, aGod[i].top);
        }
        draw_sprite(menuBuffer, godNames[characterClicked], 616, 515);
        draw_sprite(menuBuffer, forwardArrow.picture, forwardArrow.left, forwardArrow.top);
}