30.06.2013 Aufrufe

Softwareentwicklung in C++ - ASC

Softwareentwicklung in C++ - ASC

Softwareentwicklung in C++ - ASC

MEHR ANZEIGEN
WENIGER ANZEIGEN

Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.

YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.

47 SimpleOutputHandl<strong>in</strong>g & output handler ;<br />

48<br />

10.2 Das DDD 299<br />

49 /∗ Whenever a card i s s e l e c t e d f o r turn<strong>in</strong>g i t i s r e g i s t e r e d<br />

50 ∗ <strong>in</strong> the current cardpair . This v a r i a b l e can be asked i f i t<br />

51 ∗ already holds both cards or only one and then the game<br />

52 ∗ c o n t r o l can r e a c t accord<strong>in</strong>gly .<br />

53 ∗/<br />

54 MemoryCardpair c u r r e n t c a r d p a i r ;<br />

55<br />

56 /∗ This i s the i n t e r n a l event handl<strong>in</strong>g s t a t e and the v a r i a b l e<br />

57 ∗ can take one of the two values o f the constants above . I t<br />

58 ∗ i s always stored here , what the c o n t r o l i s wait<strong>in</strong>g f o r <strong>in</strong><br />

59 ∗ r e s p e c t to the coords . Either i t waits f o r both coords<br />

60 ∗ o f a card or the row already a r r i v e d and i t waits only f o r<br />

61 ∗ the column of a s e l e c t e d card .<br />

62 ∗/<br />

63 u<strong>in</strong>t8 c o o r d w a i t s t a t u s ;<br />

64<br />

65 /∗ I f the row was already passed as an event i t i s <strong>in</strong> the<br />

66 ∗ meantime stored <strong>in</strong> t h i s v a r i a b l e u n t i l the column a r r i v e s .<br />

67 ∗/<br />

68 u<strong>in</strong>t32 stored row num ;<br />

69<br />

70 public :<br />

71<br />

72 /∗ Standard Constructor<br />

73 ∗ The gameboard that t h i s c o n t r o l i n stance i s r e s p o n s i b l e f o r<br />

74 ∗ and the output handler f o r d i s p l a y i n g o f the gameboard<br />

75 ∗ are passed to i t and stored <strong>in</strong> the appropriate i n t e r n a l<br />

76 ∗ v a r i a b l e s . All other v a r i a b l e s have to be i n i t i a l i z e d to<br />

77 ∗ t h e i r accord<strong>in</strong>g 0 values<br />

78 ∗ @param gameboard The gameboard to be c o n t r o l l e d . I t comes<br />

79 ∗ without any cards on i t . A c a l l to the method<br />

80 ∗ putCardsOnGameboard then f i l l s i t with appropriate<br />

81 ∗ c a r d p a i r s .<br />

82 ∗ @param output handler The output handler that i s r e s p o n s i b l e<br />

83 ∗ f o r d i s p l a y i n g the gameboard .<br />

84 ∗/<br />

85 MemoryGameControl(MemoryGameboard &gameboard ,<br />

86 SimpleOutputHandl<strong>in</strong>g &output handler ) :<br />

87 gameboard ( gameboard ) ,<br />

88 output handler ( output handler ) ,<br />

89 c o o r d w a i t s t a t u s (WAITING FOR ROW AND COL) ,<br />

90 stored row num ( 0) { }<br />

91<br />

92<br />

93 /∗ Destructor<br />

94 ∗ Just to make sure that a v i r t u a l d e s t r u c t o r e x i s t s<br />

95 ∗/<br />

96 virtual ˜ MemoryGameControl ( ) { }<br />

97<br />

98 /∗ This method i s c a l l e d to t r i g g e r f i l l i n g o f the gameboard . I t<br />

99 ∗ u t i l i z e s an <strong>in</strong>stance of MemoryCardSymbolGenerator and then<br />

100 ∗ d i s t r i b u t e s a pair of cards f o r each symbol randomly on the<br />

101 ∗ board .<br />

102 ∗/<br />

103 virtual void putCardsOnGameboard ( ) ;<br />

104<br />

105 /∗ This i s the c a l l b a c k f o r word events that are a r e s u l t o f the<br />

106 ∗ u sers ’ <strong>in</strong>put . Here a l l the a c t i o n s are t r i g g e r e d accord<strong>in</strong>g to<br />

107 ∗ the game ’ s l o g i c .<br />

108 ∗ @param event An event com<strong>in</strong>g from the <strong>in</strong>put handler . Only<br />

109 ∗ events of c l a s s WordEvent a r r i v e here .<br />

110 ∗ @param dispatcher The Input handler that c a l l e d t h i s<br />

111 ∗ method to dispatch the event .<br />

112 ∗/

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!