![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
00001 /* 00002 Copyright 2005-2010 Intel Corporation. All Rights Reserved. 00003 00004 This file is part of Threading Building Blocks. 00005 00006 Threading Building Blocks is free software; you can redistribute it 00007 and/or modify it under the terms of the GNU General Public License 00008 version 2 as published by the Free Software Foundation. 00009 00010 Threading Building Blocks is distributed in the hope that it will be 00011 useful, but WITHOUT ANY WARRANTY; without even the implied warranty 00012 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with Threading Building Blocks; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 00019 As a special exception, you may use this file as part of a free software 00020 library without restriction. Specifically, if other files instantiate 00021 templates or use macros or inline functions from this file, or you compile 00022 this file and link it with other files to produce an executable, this 00023 file does not by itself cause the resulting executable to be covered by 00024 the GNU General Public License. This exception does not however 00025 invalidate any other reasons why the executable file might be covered by 00026 the GNU General Public License. 00027 */ 00028 00029 #ifndef __BOARD_H__ 00030 #define __BOARD_H__ 00031 00032 #define WIN32_LEAN_AND_MEAN 00033 00034 #ifndef _CONSOLE 00035 #include <windows.h> 00036 00037 using namespace System; 00038 using namespace System::ComponentModel; 00039 using namespace System::Collections; 00040 using namespace System::Windows::Forms; 00041 using namespace System::Data; 00042 using namespace System::Drawing; 00043 #define LabelPtr Label^ 00044 #define BoardPtr Board^ 00045 #else 00046 #define LabelPtr int* 00047 #define BoardPtr Board* 00048 #endif 00049 00050 struct Matrix 00051 { 00052 int width; 00053 int height; 00054 char* data; 00055 }; 00056 00057 #ifndef _CONSOLE 00058 public ref class Board : public System::Windows::Forms::UserControl 00059 #else 00060 class Board 00061 #endif 00062 { 00063 public: 00064 Board(int width, int height, int squareSize, LabelPtr counter); 00065 virtual ~Board(); 00066 void seed(int s); 00067 void seed(const BoardPtr s); 00068 #ifndef _CONSOLE 00069 protected: 00070 virtual void OnPaint(PaintEventArgs^ e) override; 00071 void Board::draw(Graphics^ g); 00072 00073 private: 00074 System::ComponentModel::Container ^components; 00075 00076 #pragma region Windows Form Designer generated code 00077 void InitializeComponent(void) 00078 { 00079 this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; 00080 } 00081 #pragma endregion 00082 00083 private: delegate void drawDelegate(Int32); 00084 public: 00086 void draw( Int32 nCurIteration ) 00087 { 00088 if (this->InvokeRequired) 00089 { 00090 drawDelegate^ d = gcnew drawDelegate(this, &Board::draw); 00091 IAsyncResult^ result = BeginInvoke(d, nCurIteration); 00092 EndInvoke(result); 00093 return; 00094 } 00095 m_counter->Text = nCurIteration.ToString(); 00096 Invalidate(); 00097 } 00098 #endif 00099 public: 00100 Matrix *m_matrix; 00101 00102 private: 00103 #ifndef _CONSOLE 00104 SolidBrush^ m_occupiedBrush; 00105 SolidBrush^ m_freeBrush; 00106 Graphics^ m_graphics; 00107 Graphics^ m_mem_dc; 00108 Bitmap^ m_bmp; 00109 #endif 00110 int m_width; 00111 int m_height; 00112 int m_squareSize; 00113 LabelPtr m_counter; 00114 }; 00115 #endif
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.