Revision: 1.1 - (view) (download) (as text)
1 : | ktanaka | 1.1 | #include <string> |
2 : | #include "BitmapFont.h" | ||
3 : | #include "Assumption.h" | ||
4 : | |||
5 : | /* @ : 黒 */ | ||
6 : | /* . : 白 */ | ||
7 : | /* else(?) : どちらでも */ | ||
8 : | class PatMatch{ | ||
9 : | private: | ||
10 : | int width, height; | ||
11 : | string pat; | ||
12 : | Assumption assumption; | ||
13 : | public: | ||
14 : | PatMatch(int w,int h,string s,Assumption as) | ||
15 : | :width(w), height(h), pat(s), assumption(as){ | ||
16 : | assert(pat.length() == (unsigned int)width*height); | ||
17 : | } | ||
18 : | bool isMatch(const BitmapFont& bf, int x, int y) const{ | ||
19 : | for(int i=0;i<width;i++) | ||
20 : | for(int j=0;j<height;j++){ | ||
21 : | if(bf.get(x+i,y+j)){ | ||
22 : | if(pat[j*width+i]=='.') return false; | ||
23 : | } | ||
24 : | else if(pat[j*width+i]=='@') return false; | ||
25 : | } | ||
26 : | return true; | ||
27 : | } | ||
28 : | }; |
ktanaka Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |