Beispiel #1
0
void Draw(Bitmap* surface)
{
    const RLEBitmap * animationStep = nukular[katze.animation];

	DrawRLEBitmap(surface, &bg_lab, 0, 0);
	DrawRLEBitmap(surface, animationStep, katze.xpos, katze.ypos);
}
Beispiel #2
0
void Draw(Bitmap *surface) {
	ClearBitmap(surface);

	if (pause_mode)
	{
		DrawText(surface, "PAUSE", 50, 180);
	} else {
		for(int i=0;i<NumberOfStars;i++)
		{
			DrawRLEBitmap(surface,sprites[stars[i].f],(stars[i].x),stars[i].y);

			stars[i].y+=stars[i].dy;
			if(stars[i].y>=(200))
			{
				stars[i].y=(0);
				stars[i].x=GetRandomInteger()%320;
				stars[i].f=(stars[i].f%7)+(GetRandomInteger()%6)*7;

			}
			const RLEBitmap sprite = *sprites[stars[i].f];
			const RLEBitmap spaceBitmap = *spacecraft[0];
			if (RectRectIntersection(stars[i].x, stars[i].y, sprite.width, sprite.height, pos_x, pos_y, spaceBitmap.width, spaceBitmap.height))
			{
				gameOver(surface, pos_x, pos_y);
			}
		}
	}

	DrawRLEBitmap(surface, spacecraft[dir+1], pos_x, pos_y);
}
Beispiel #3
0
void Bullet_Draw(void* bullet, Bitmap* surface) {
    Bullet* this = (Bullet*)bullet;
	if(this->entity->collisionType == COLLISION_TYPE_BULLET_ENEMY)
	{
		DrawRLEBitmap(surface, &Projectile_Laser, this->entity->posX - camera->posX, this->entity->posY);
	}
	else
	{
		DrawRLEBitmap(surface, &Projectile_Big, this->entity->posX - camera->posX, this->entity->posY);
	}    
}
Beispiel #4
0
void TiledMap_draw(Bitmap *surface, TiledMap *map, int xo, int yo)
{
  if (map->tileSize != 0)
  {
    // Indices of top-left most tile to draw
    int tx = divRD(xo, SCREEN_X);
    int ty = divRD(yo, SCREEN_Y);
    // Number of tiles per screen
    int txs = divRD(SCREEN_X, map->tileSize + 1);
    int tys = divRD(SCREEN_Y, map->tileSize + 1);

    ClipRectangle(&tx, &ty, &txs, &tys, map->sizeX, map->sizeY);

    for (int y = ty; y < tys + ty; y++)
      for (int x = tx; x < txs + tx; x++)
        DrawRLEBitmap(surface,
            map->tileInfo[ TiledMap_getTile(map, x, y) ].bitmap,
            xo + (x * map->tileSize),
            yo + (y * map->tileSize));
  }

  // Draw objects
  list_el *i = map->objects.head;
  while (i)
  {
    MObj_draw(surface, (MapObject*) i->val, xo, yo);
    i = i->next;
  }
}
Beispiel #5
0
void Draw(Bitmap* surface)
{
  memset(surface->pixels,255,surface->bytesperrow*surface->height);

	DrawText(surface, "Controller Test v0.1", 5, 1);

  DrawRLEBitmap(surface, controller, 5, 10);

  if (state1.buttons.Up )
    OffsDrawFilledRectangle(surface,  67, 81, 10, 15, RGB(255,0,0));
  if ( state1.buttons.Down )
    OffsDrawFilledRectangle(surface,  65, 115, 10, 15, RGB(255,0,0));
  if (state1.buttons.Left )
    OffsDrawFilledRectangle(surface,  48, 100, 15, 10, RGB(255,0,0));
  if (state1.buttons.Right )
    OffsDrawFilledRectangle(surface,  85, 100, 15, 10, RGB(255,0,0));
  if (state1.buttons.Start )
    OffsDrawFilledRectangle(surface, 155, 103, 15, 15, RGB(255,0,0));
  if (state1.buttons.Select )
    OffsDrawFilledRectangle(surface, 120, 103, 15, 15, RGB(255,0,0));
  if (state1.buttons.A )
    OffsDrawFilledRectangle(surface, 268,  95, 20, 20, RGB(255,0,0));
  if (state1.buttons.B )
    OffsDrawFilledRectangle(surface, 238, 115, 20, 20, RGB(255,0,0));
  if (state1.buttons.X )
    OffsDrawFilledRectangle(surface, 240,  74, 20, 20, RGB(255,0,0));
  if (state1.buttons.Y )
    OffsDrawFilledRectangle(surface, 209,  96, 20, 20, RGB(255,0,0));
  if (state1.buttons.L )
    OffsDrawFilledRectangle(surface,  48,  32, 50,  5, RGB(255,0,0));
  if (state1.buttons.R )
    OffsDrawFilledRectangle(surface, 216,  32, 50,  5, RGB(255,0,0));

  if (state2.buttons.Up )
    OffsDrawFilledRectangle(surface,  67, 81, 10, 15, RGB(0,255,0));
  if ( state2.buttons.Down )
    OffsDrawFilledRectangle(surface,  65, 115, 10, 15, RGB(0,255,0));
  if (state2.buttons.Left )
    OffsDrawFilledRectangle(surface,  48, 100, 15, 10, RGB(0,255,0));
  if (state2.buttons.Right )
    OffsDrawFilledRectangle(surface,  85, 100, 15, 10, RGB(0,255,0));
  if (state2.buttons.Start )
    OffsDrawFilledRectangle(surface, 155, 103, 15, 15, RGB(0,255,0));
  if (state2.buttons.Select )
    OffsDrawFilledRectangle(surface, 120, 103, 15, 15, RGB(0,255,0));
  if (state2.buttons.A )
    OffsDrawFilledRectangle(surface, 268,  95, 20, 20, RGB(0,255,0));
  if (state2.buttons.B )
    OffsDrawFilledRectangle(surface, 238, 115, 20, 20, RGB(0,255,0));
  if (state2.buttons.X )
    OffsDrawFilledRectangle(surface, 240,  74, 20, 20, RGB(0,255,0));
  if (state2.buttons.Y )
    OffsDrawFilledRectangle(surface, 209,  96, 20, 20, RGB(0,255,0));
  if (state2.buttons.L )
    OffsDrawFilledRectangle(surface,  48,  32, 50,  5, RGB(0,255,0));
  if (state2.buttons.R )
    OffsDrawFilledRectangle(surface, 216,  32, 50,  5, RGB(0,255,0));

}
Beispiel #6
0
void Storyboard_Draw(void* storyboard, Bitmap* surface)
{
    Storyboard* this = storyboard;
    extern const RLEBitmap storyboard_back;
    DrawRLEBitmap(surface, &Storyboard_Back, this->entity->posX, this->entity->posY);
    //setFont(Font_White16x16);
    setFont(Font_White7x7);
    DrawText(surface, this->text, this->entity->posX + 10, this->entity->posY + 10);



}
Beispiel #7
0
void Menu_Draw(Bitmap* b){

	//Create Background
	DrawFilledRectangle(b, borderX, borderY, SCREEN_X - 2 * borderX, SCREEN_Y - 2 * borderY, RGB(0,0,0));
	//Inner red Border
	DrawRectangle(b, borderX + rectBorder, borderY + rectBorder ,
	 (SCREEN_X - 2 * borderX) - 2 * rectBorder , (SCREEN_Y - 2 * borderY ) - 2 * rectBorder, RGB(193,0,0));

	//Column Header
	char *itemHeader;
	asprintf(&itemHeader, "Itemname    SPD  SPW   INV    PRZ");
	DrawText(b, itemHeader, listEdgeX + 0 * colWidth, listEdgeY - rowHeight -2);
	free(itemHeader);

	//Items
	for(int i = 0 ; i < maxListRows ; i++){
		itemIndex = i + menuSelectedItem - 4;
		if (itemIndex >= 0 && itemIndex <= itemCount){
			//Mark Items you can't afford
			if(itemList[itemIndex]->prize > p1.money){
				DrawFilledCircle(b, listEdgeX +circleRadius , listEdgeY + rowHeight * i + circleRadius + 1, circleRadius ,RGB(255,0,0));
			}	
			//Item Owned
			if(listCount(&p1.inventory, (Item*)itemList[itemIndex]) >= 1){
				DrawFilledCircle(b, listEdgeX +circleRadius , listEdgeY + rowHeight * i + circleRadius + 1, circleRadius ,RGB(0,255,0));
			}
			//Item name
			char *itemName;
			asprintf(&itemName, itemList[itemIndex]->name);
			DrawText(b, itemName, listEdgeX + 0 * colWidth, listEdgeY + rowHeight * i);
			free(itemName);

			//Item Dig-Speed
			char *itemSPD;
			asprintf(&itemSPD, "% 3d", itemList[itemIndex]->speedDigMod);
			DrawText(b, itemSPD, listEdgeX + 6 * colWidth, listEdgeY + rowHeight * i);
			free(itemSPD);

			//Item Walk-Speed
			char *itemSPW;
			asprintf(&itemSPW, "% 2d", itemList[itemIndex]->speedWalkMod);
			DrawText(b, itemSPW, listEdgeX + 9 * colWidth, listEdgeY + rowHeight * i);
			free(itemSPW);	

			//Item Inventory size
			char *itemINV;
			asprintf(&itemINV, "% 4d", itemList[itemIndex]->inventorySizeTaken);
			DrawText(b, itemINV, listEdgeX + 11 * colWidth, listEdgeY + rowHeight * i);
			free(itemINV);		

			//Item Prize
			char *itemPRZ;
			asprintf(&itemPRZ, "% 5d", itemList[itemIndex]->prize);
			DrawText(b, itemPRZ, listEdgeX + 14 * colWidth, listEdgeY + rowHeight * i);
			free(itemPRZ);
			setFont(fontwhite8);
		}else{
			// dunno
		}
	}
	//Draw Border around current selection
	DrawRectangle(b, listEdgeX , listEdgeY + 4 * rowHeight -2, SCREEN_X - (2 * borderX + 2 * 2 * rectBorder + 2), rowHeight + 2 * 1, RGB(128, 0, 0));

	//Separate ItemList from Character Infos
	DrawHorizontalLine(b, listEdgeX , listEdgeY + 10 * rowHeight + 2 , SCREEN_X - (2 * 2 * rectBorder + 2 * borderX + 2), RGB(255,255,255));

	//Draw Player Info (Cash / Free Space)
	setFont(fontwhite16);
	char *playerCash;
	asprintf(&playerCash, "$:%3d Inv:%3d", p1.money, getFreeInvSpace(&p1));
	DrawText(b, playerCash, listEdgeX , listEdgeY + rowHeight * 11);
	free(playerCash);
	setFont(fontwhite8);	


	//Draw Players Minerals
	//Coal
	DrawRLEBitmap(b,sprt_coal,listEdgeX + 1 * colWidth,listEdgeY + rowHeight * 13);
	//Iron
	DrawRLEBitmap(b,sprt_treasure1,listEdgeX + 5 * colWidth,listEdgeY + rowHeight * 13);
	//Gold
	DrawRLEBitmap(b,sprt_gold,listEdgeX + 9 * colWidth,listEdgeY + rowHeight * 13);
	//Diamonds
	DrawRLEBitmap(b,sprt_diam_red,listEdgeX + 13 * colWidth,listEdgeY + rowHeight * 13);

	char *playerMinerals;
	asprintf(&playerMinerals, "     % 3d     % 3d     % 3d     % 3d",
		getMineralAmount(&p1, MIN_COAL),
		getMineralAmount(&p1, MIN_IRON),
		getMineralAmount(&p1, MIN_GOLD),
		getMineralAmount(&p1, MIN_DIAMOND));
	DrawText(b, playerMinerals, listEdgeX - colWidth / 2, listEdgeY + rowHeight * 13.5);
	free(playerMinerals);	


}
Beispiel #8
0
void Healthpack_Draw(void* healthpack, Bitmap* surface) {
    Healthpack* this = healthpack;
    DrawRLEBitmap(surface, &Healthpack_Cake, this->entity->posX - camera->posX, this->entity->posY);
}