예제 #1
0
/*
===============================================================================
SL_PrintPattern

Debug routine -- it helps me checking if pattern is decoded OK.
===============================================================================
*/
static void SL_PrintPattern(void)
{
  int           i, j;
  char          Notes[12][2] =
{
 "C-", "C#", "D-", "D#", "E-", "F-", "F#", "G-", "G#", "A-", "A#", "B-"
};
  PATT          *CurPat;
  char          Note[3];

  vmode(3);
  printf("ORD: %d\n", Mod.Orders[0]);
  getch();
  for (i = 0; i < 20; i++)
  {
    printf("%02d³", i);
    for (j = 0; j < Mod.NrChans; j++)
    {
      CurPat = Mod.Patterns[Mod.Orders[0]] + (i * Mod.NrChans) + j;
      memcpy(Note, Notes[CurPat->Note%12], 2);
      Note[2] = '\0';

      if (CurPat->Note == NONOTE)
        printf("---");
      else if (CurPat->Note == KEYOFF)
        printf("^^^");
      else
        printf("%2s%1d", Note, CurPat->Note/12);
      if (CurPat->Sample)
        printf("%02d", CurPat->Sample);
      else
        printf("--");
      if (CurPat->Cmd != NOCMD)
        printf("%X%02X³", CurPat->Cmd, CurPat->CmdParm);
      else
        printf("---³");
    }
    printf("\n");
  }
}
예제 #2
0
void scrInit(void)
{
    textmode(C80);
    if (vmode() == 7)  {
		color  = BLACK;
		bgrd   = LIGHTGRAY;
		ccolor = LIGHTGRAY;
		cbgrd  = BLACK;
        mcolor = BLACK;
        mbgrd  = LIGHTGRAY;
    }
    else  {
		color  = BLACK;
		bgrd   = LIGHTGRAY;
		ccolor = BLUE;
		cbgrd  = LIGHTGRAY;
        mcolor = LIGHTGRAY;
		mbgrd  = MAGENTA;
	}
	textcolor(color);
	textbackground(bgrd);
	clrscr();
}
예제 #3
0
파일: main.cpp 프로젝트: kubatrt/Arkanoid11
int main()
{
  std::cout << appName << " Version " << Arkanoid11_VERSION_MAJOR << "." << Arkanoid11_VERSION_MINOR << std::endl;


  // setup game objects
  Ball ball{windowWidth / 2, windowHeight / 2};
  Paddle paddle{windowWidth / 2, windowHeight - paddleHeight * 2};
  std::vector<Brick> bricks;
  bricks.reserve(countBlocksX * countBlocksY);

  for(int ix{0}; ix < countBlocksX; ++ix)
    for(int iy{0}; iy < countBlocksY; ++iy)
      bricks.emplace_back( (ix + 1) * (brickWidth + 4) + 20,
                           (iy + 1) * (brickHeight + 4),
                           brickColors[iy / 2]);


  sf::VideoMode vmode(windowWidth, windowHeight);
  sf::RenderWindow window(vmode, appName);
  window.setFramerateLimit(60);

  while(window.isOpen())
  {
    window.clear();

    if(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Escape))
        window.close();

    sf::Event event;
    while(window.pollEvent(event))
    {
      if(event.type == sf::Event::Closed)
          window.close();
    }

    // update
    ball.update();
    paddle.update();
    testCollision(paddle, ball);

    for(auto& brick : bricks) 
        testCollision(brick, ball);

    // remove all destroyed bricks
    bricks.erase(std::remove_if(std::begin(bricks), std::end(bricks),
                 [](const Brick& brick) { return brick.destroyed; }),
                 std::end(bricks));

    // winning conditions
    bool won = std::all_of(std::begin(bricks), std::end(bricks), 
            [](const Brick& brick) { return brick.destroyed; });

    if(won)
        window.close();

    // Draw
    window.draw(paddle.shape);
    window.draw(ball.shape);
    for(auto& brick : bricks)
        window.draw(brick.shape);

    window.display();
  }

  return 0;
}