⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 board.h

📁 通用网络游戏开发框架
💻 H
字号:
// This file needs -*- c++ -*- mode
// ============================================================================
// Board interface
//
// (c) 2003 Ken Reed
//
// This is free software. You can redistribute it and/or modify it under the
// terms of the GNU General Public License version 2 as published by the Free
// Software Foundation.
// ============================================================================

#pragma once

#include "cell.h"
#include "point.h"

enum  Mouse_Command {Left_Mouse, Shift_Left_Mouse, Right_Mouse};
const int board_x_size = 55; // 60;
const int board_y_size = 28; // 35;

class Board {
 public:
   Board();
   
   void   draw          ();
   Point  get_size      ();
   void   initialise    (bool explore, bool hide, bool decay, bool disrupt);
   void   key           (int player, int           key,     Point position);
   void   mouse         (int player, Mouse_Command command, Point position);
   void   setup_player  (int player, int num_bases, bool group_bases);
   void   update        (double elapsed);

   void   end_of_updates();
   void   get_updates   (Socket * socket);
   void   receive       (Socket * socket);
   void   send_updates  (Socket * socket);
   void   transmit      (Socket * socket);

   int    player;
   HWND   window;

private:
   Cell   cells[board_y_size][board_x_size];

   bool   attrition;
   bool   disrupt;
   bool   exploring;
   bool   hidden;
   Point  size;

   Cell * get_cell      (Point p);
   Cell * get_cell      (int x, int y, int side);
   Cell * random_cell   (int i, int j);

   Point  get_base      (int player, int bi, int bj);

   void   attack        (int player, Cell * cell);
   void   fill_sea      (int player, Cell * cell);
   void   scuttle       (int player, Cell * cell);

   void   move_troops   (int j, int i, double elapsed);
   void   update_march  (int j, int i, double elapsed);
   void   new_data      (Socket * socket);

   void   setup_terrain ();
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -