- Timestamp:
- 02/12/2008 08:43:37 PM (4 years ago)
- Location:
- trunk/src
- Files:
-
- 20 edited
-
dice/theme1/five.xpm (modified) (1 diff)
-
dice/theme1/four.xpm (modified) (1 diff)
-
dice/theme1/one.xpm (modified) (1 diff)
-
dice/theme1/six.xpm (modified) (1 diff)
-
dice/theme1/three.xpm (modified) (1 diff)
-
dice/theme1/two.xpm (modified) (1 diff)
-
dice/theme2/five.xpm (modified) (1 diff)
-
dice/theme2/four.xpm (modified) (1 diff)
-
dice/theme2/one.xpm (modified) (1 diff)
-
dice/theme2/six.xpm (modified) (1 diff)
-
dice/theme2/three.xpm (modified) (1 diff)
-
dice/theme2/two.xpm (modified) (1 diff)
-
dice/theme3/1.xpm (modified) (1 diff)
-
dice/theme3/2.xpm (modified) (1 diff)
-
dice/theme3/3.xpm (modified) (1 diff)
-
dice/theme3/4.xpm (modified) (1 diff)
-
dice/theme3/5.xpm (modified) (1 diff)
-
dice/theme3/6.xpm (modified) (1 diff)
-
dice_graphics.cpp (modified) (2 diffs)
-
dice_graphics.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/dice/theme1/five.xpm
r131 r150 1 1 /* XPM */ 2 static char * theme1_five_xpm[] = {2 static char *five_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 246 2", -
trunk/src/dice/theme1/four.xpm
r131 r150 1 1 /* XPM */ 2 static char * theme1_four_xpm[] = {2 static char *four_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 221 2", -
trunk/src/dice/theme1/one.xpm
r131 r150 1 1 /* XPM */ 2 static char * theme1_one_xpm[] = {2 static char *one_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 203 2", -
trunk/src/dice/theme1/six.xpm
r131 r150 1 1 /* XPM */ 2 static char * theme1_six_xpm[] = {2 static char *six_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 255 2", -
trunk/src/dice/theme1/three.xpm
r131 r150 1 1 /* XPM */ 2 static char *th eme1_three_xpm[] = {2 static char *three_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 227 2", -
trunk/src/dice/theme1/two.xpm
r131 r150 1 1 /* XPM */ 2 static char *t heme1_two_xpm[] = {2 static char *two_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 218 2", -
trunk/src/dice/theme2/five.xpm
r131 r150 1 1 /* XPM */ 2 static char * theme2_five_xpm[] = {2 static char *five_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 190 2", -
trunk/src/dice/theme2/four.xpm
r131 r150 1 1 /* XPM */ 2 static char * theme2_four_xpm[] = {2 static char *four_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 171 2", -
trunk/src/dice/theme2/one.xpm
r131 r150 1 1 /* XPM */ 2 static char * theme2_one_xpm[] = {2 static char *one_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 200 2", -
trunk/src/dice/theme2/six.xpm
r131 r150 1 1 /* XPM */ 2 static char * theme2_six_xpm[] = {2 static char *six_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 206 2", -
trunk/src/dice/theme2/three.xpm
r131 r150 1 1 /* XPM */ 2 static char *th eme2_three_xpm[] = {2 static char *three_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 159 2", -
trunk/src/dice/theme2/two.xpm
r131 r150 1 1 /* XPM */ 2 static char *t heme2_two_xpm[] = {2 static char *two_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 131 2", -
trunk/src/dice/theme3/1.xpm
r131 r150 1 1 /* XPM */ 2 static char * theme3_1_xpm[] = {2 static char *one_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 53 1", -
trunk/src/dice/theme3/2.xpm
r131 r150 1 1 /* XPM */ 2 static char *t heme3_2_xpm[] = {2 static char *two_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 58 1", -
trunk/src/dice/theme3/3.xpm
r131 r150 1 1 /* XPM */ 2 static char *th eme3_3_xpm[] = {2 static char *three_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 61 1", -
trunk/src/dice/theme3/4.xpm
r131 r150 1 1 /* XPM */ 2 static char * theme3_4_xpm[] = {2 static char *four_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 61 1", -
trunk/src/dice/theme3/5.xpm
r131 r150 1 1 /* XPM */ 2 static char * theme3_5_xpm[] = {2 static char *five_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 61 1", -
trunk/src/dice/theme3/6.xpm
r131 r150 1 1 /* XPM */ 2 static char * theme3_6_xpm[] = {2 static char *six_xpm[] = { 3 3 /* columns rows colors chars-per-pixel */ 4 4 "64 64 61 1", -
trunk/src/dice_graphics.cpp
r131 r150 21 21 #include "dice_graphics.h" 22 22 23 #include "dice/theme1/one.xpm"24 #include "dice/theme1/two.xpm"25 #include "dice/theme1/three.xpm"26 #include "dice/theme1/four.xpm"27 #include "dice/theme1/five.xpm"28 #include "dice/theme1/six.xpm"29 30 #include "dice/theme2/one.xpm"31 #include "dice/theme2/two.xpm"32 #include "dice/theme2/three.xpm"33 #include "dice/theme2/four.xpm"34 #include "dice/theme2/five.xpm"35 #include "dice/theme2/six.xpm"36 37 #include "dice/theme3/1.xpm"38 #include "dice/theme3/2.xpm"39 #include "dice/theme3/3.xpm"40 #include "dice/theme3/4.xpm"41 #include "dice/theme3/5.xpm"42 #include "dice/theme3/6.xpm"43 23 44 24 DiceGraphics::DiceGraphics() 45 25 { 46 m_theme = 0; 47 48 LoadTheme1(); 49 LoadTheme2(); 50 LoadTheme3(); 26 m_theme = (DiceTheme*)new DiceTheme1(); 51 27 } 52 28 53 void DiceGraphics::LoadTheme1()29 DiceGraphics::~DiceGraphics() 54 30 { 55 m_bitmaps[0][0] = new wxBitmap(theme1_one_xpm); 56 m_bitmaps[0][1] = new wxBitmap(theme1_two_xpm); 57 m_bitmaps[0][2] = new wxBitmap(theme1_three_xpm); 58 m_bitmaps[0][3] = new wxBitmap(theme1_four_xpm); 59 m_bitmaps[0][4] = new wxBitmap(theme1_five_xpm); 60 m_bitmaps[0][5] = new wxBitmap(theme1_six_xpm); 31 delete m_theme; 61 32 } 62 33 63 void DiceGraphics::LoadTheme2()64 {65 m_bitmaps[1][0] = new wxBitmap(theme2_one_xpm);66 m_bitmaps[1][1] = new wxBitmap(theme2_two_xpm);67 m_bitmaps[1][2] = new wxBitmap(theme2_three_xpm);68 m_bitmaps[1][3] = new wxBitmap(theme2_four_xpm);69 m_bitmaps[1][4] = new wxBitmap(theme2_five_xpm);70 m_bitmaps[1][5] = new wxBitmap(theme2_six_xpm);71 }72 73 void DiceGraphics::LoadTheme3()74 {75 m_bitmaps[2][0] = new wxBitmap(theme3_1_xpm);76 m_bitmaps[2][1] = new wxBitmap(theme3_2_xpm);77 m_bitmaps[2][2] = new wxBitmap(theme3_3_xpm);78 m_bitmaps[2][3] = new wxBitmap(theme3_4_xpm);79 m_bitmaps[2][4] = new wxBitmap(theme3_5_xpm);80 m_bitmaps[2][5] = new wxBitmap(theme3_6_xpm);81 }82 34 /** 83 35 * \param i the number of the dice (1 to 6) … … 86 38 wxBitmap *DiceGraphics::GetDice(int i) 87 39 { 88 return m_ bitmaps[m_theme][i-1];40 return m_theme->GetDice(i); 89 41 } 42 43 namespace dicetheme1 { 44 #include "dice/theme1/one.xpm" 45 #include "dice/theme1/two.xpm" 46 #include "dice/theme1/three.xpm" 47 #include "dice/theme1/four.xpm" 48 #include "dice/theme1/five.xpm" 49 #include "dice/theme1/six.xpm" 50 } 51 DiceTheme1::DiceTheme1() { 52 m_bitmaps[0] = new wxBitmap(dicetheme1::one_xpm); 53 m_bitmaps[1] = new wxBitmap(dicetheme1::two_xpm); 54 m_bitmaps[2] = new wxBitmap(dicetheme1::three_xpm); 55 m_bitmaps[3] = new wxBitmap(dicetheme1::four_xpm); 56 m_bitmaps[4] = new wxBitmap(dicetheme1::five_xpm); 57 m_bitmaps[5] = new wxBitmap(dicetheme1::six_xpm); 58 } 59 60 /** 61 * \param i the number of the dice (1 to 6) 62 * \return a pointer to wxBitmap 63 */ 64 wxBitmap* DiceTheme1::GetDice(int i) 65 { 66 return m_bitmaps[i-1]; 67 } 68 69 namespace dicetheme2 { 70 #include "dice/theme2/one.xpm" 71 #include "dice/theme2/two.xpm" 72 #include "dice/theme2/three.xpm" 73 #include "dice/theme2/four.xpm" 74 #include "dice/theme2/five.xpm" 75 #include "dice/theme2/six.xpm" 76 } 77 DiceTheme2::DiceTheme2() { 78 m_bitmaps[0] = new wxBitmap(dicetheme2::one_xpm); 79 m_bitmaps[1] = new wxBitmap(dicetheme2::two_xpm); 80 m_bitmaps[2] = new wxBitmap(dicetheme2::three_xpm); 81 m_bitmaps[3] = new wxBitmap(dicetheme2::four_xpm); 82 m_bitmaps[4] = new wxBitmap(dicetheme2::five_xpm); 83 m_bitmaps[5] = new wxBitmap(dicetheme2::six_xpm); 84 } 85 86 /** 87 * \param i the number of the dice (1 to 6) 88 * \return a pointer to wxBitmap 89 */ 90 wxBitmap* DiceTheme2::GetDice(int i) 91 { 92 return m_bitmaps[i-1]; 93 } 94 95 namespace dicetheme3 { 96 #include "dice/theme3/1.xpm" 97 #include "dice/theme3/2.xpm" 98 #include "dice/theme3/3.xpm" 99 #include "dice/theme3/4.xpm" 100 #include "dice/theme3/5.xpm" 101 #include "dice/theme3/6.xpm" 102 } 103 DiceTheme3::DiceTheme3() { 104 m_bitmaps[0] = new wxBitmap(dicetheme3::one_xpm); 105 m_bitmaps[1] = new wxBitmap(dicetheme3::two_xpm); 106 m_bitmaps[2] = new wxBitmap(dicetheme3::three_xpm); 107 m_bitmaps[3] = new wxBitmap(dicetheme3::four_xpm); 108 m_bitmaps[4] = new wxBitmap(dicetheme3::five_xpm); 109 m_bitmaps[5] = new wxBitmap(dicetheme3::six_xpm); 110 } 111 112 /** 113 * \param i the number of the dice (1 to 6) 114 * \return a pointer to wxBitmap 115 */ 116 wxBitmap *DiceTheme3::GetDice(int i) 117 { 118 return m_bitmaps[i-1]; 119 } -
trunk/src/dice_graphics.h
r131 r150 24 24 #define NUM_OF_THEMES 3 25 25 26 /** 27 * This is the base class for the DiceThemes. It implements a Strategy design 28 * pattern 29 */ 30 class DiceTheme { 31 public: 32 virtual wxBitmap* GetDice(int i) = 0; 33 }; 34 26 35 class DiceGraphics { 27 36 public: 28 37 DiceGraphics(); 38 DiceGraphics(DiceTheme* theme); 39 ~DiceGraphics(); 29 40 wxBitmap *GetDice(int i); 30 41 31 42 private: 32 void LoadTheme1(); 33 void LoadTheme2(); 34 void LoadTheme3(); 35 wxBitmap *m_bitmaps[ NUM_OF_THEMES ][6]; 36 int m_theme; 43 DiceTheme *m_theme; 44 }; 37 45 46 class DiceTheme1 : public DiceTheme { 47 wxBitmap *m_bitmaps[6]; 48 public: 49 DiceTheme1(); 50 virtual wxBitmap* GetDice(int i); 51 }; 52 53 class DiceTheme2 : public DiceTheme { 54 wxBitmap *m_bitmaps[6]; 55 public: 56 DiceTheme2(); 57 virtual wxBitmap* GetDice(int i); 58 }; 59 60 class DiceTheme3 : public DiceTheme { 61 wxBitmap *m_bitmaps[6]; 62 public: 63 virtual wxBitmap* GetDice(int i); 64 DiceTheme3(); 38 65 }; 39 66
Note: See TracChangeset
for help on using the changeset viewer.
