SEO [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送

DxLibEx.hpp

解説を見る。
00001     
00002 
00003 #ifndef _DxLibEx__
00004 #define _DxLibEx__
00005 
00006 #include <assert.h>
00007 #include <string>
00008 #include <deque>
00009 #include <list>
00010 
00011 
00012 
00013 
00014 #ifndef MB
00015 #   define MB(s) ::MessageBox(NULL,s,"MESSAGE",MB_OK)
00016 #endif
00017 
00018 #ifndef ODS
00019 #   define ODS(s) ::OutputDebugString(s)
00020 #endif
00021 
00022 #ifndef DKINGYO_NOT_MOUNTED
00023 #   define DKINGYO_NOT_MOUNTED -100
00024 #endif
00025 
00026 
00027 #ifndef VISUAL_LASTERROR
00028 
00029 #   define VISUAL_LASTERROR() \
00030     {\
00031         LPVOID lpMsgBuf;\
00032         FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,\
00033                      NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL );\
00034         ::MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );\
00035         LocalFree( lpMsgBuf );\
00036     }
00037 #endif
00038 
00039 
00040 
00041 //FilpまたはCopyする関数のポインタ定義。
00042 typedef int (*DXLIB_FLIP_OR_COPY)(void);
00043 
00044 
00046 #define _DKINGYO_JOYPAD_NUM 10
00047 
00048 
00050 typedef struct tugInputData{
00051     char buff[256];
00052     int JoyPadAndKeybord;
00053     int JoyPadNum;
00054     int JoyPadInputState[_DKINGYO_JOYPAD_NUM];
00055     int JoyPadAnalogX[_DKINGYO_JOYPAD_NUM],JoyPadAnalogY[_DKINGYO_JOYPAD_NUM];
00056     int MouseX,MouseY;
00057     bool MouseLeft,MouseRight,MouseMiddle;
00058 }DKINGYO_INPUT_DATA;
00059 
00060 
00061 typedef struct tugDxLibSetup_{
00062     DWORD dwSize;//よくMS系の構造体にあるよね^^;自分の構造体のサイズを入れる奴。
00063     int FileVersion;//意味無さそう^^;
00064     int ScreenModeWinTrueFullFalse;//Window?FullScreen?
00065     bool _3D_true_or_Soft_false;
00066     bool BasicBlendUsed_true;
00067     bool UseVramUsed_true;
00068     bool VsyncWaitUsed_true;
00069 
00070     int SetDrawModeFunctionArg;  
00071     /*DX_DRAWMODE_NEAREST : ネアレストネイバー法で描画する
00072                    (標準)
00073        DX_DRAWMODE_BILINEAR : バイリニア法で描画する
00074     */
00075     bool MusicMode_MCIUsed_true;
00076     bool ScreenWhichDraw_BackUserd_true;
00077     /*
00078     DX_SCREEN_FRONT : 表の画面(表示されている画面)
00079   DX_SCREEN_BACK  : 裏の画面(表示されていない画面)
00080     */
00081     bool DrawingMode_FilpUsed_true;
00082     bool SetAlwaysRun_is_true;//アクティブじゃなくても動くならTRUE
00083     bool SetUseDivGraph_is_true;//TRUEなら画像データを分割してVRAMに保持
00084     int SoundDataType;//sound_dataのタイプを入れる。
00085 /* DX_SOUNDDATATYPE_MEMNOPRESS (デフォルト)
00086     説明:WAVEデータを直接再生できる状態にしてメモリ上に保存
00087     読み込み速度:遅い 再生負荷:速い 必要メモリ領域:大きい
00088   DX_SOUNDDATATYPE_MEMPRESS 
00089     説明: 圧縮されているWAVEデータをメモリ上に保存、再生時に
00090        リアルタイムで圧縮データを展開、WAVEデータが圧縮されて
00091        いない場合は DX_SOUNDDATATYPE_MEMNOPRESS よりかえって
00092        必要メモリ容量、再生負荷、読み込み速度全ての面で不利になる
00093     読み込み速度:普通 再生負荷:少し重い 必要メモリ領域:普通
00094   DX_SOUNDDATATYPE_FILE
00095     説明: WAVEデータを再生時にファイルからリアルタイムに
00096        メモリ上に読み込む、WAVEデータが圧縮されている場合は
00097        読み込んだ時に展開する
00098     読み込み速度:速い 再生負荷:重い 必要メモリ領域:軽い ) 
00099 */
00100     //display Driver and setting
00101     GUID id;//なんか意味無いかもTT
00102     char CardName[512];//こんくらい?
00103     
00104     int width,height,bitdepth,hz;//横 縦 色の深さ リフレッシュレート
00105     
00106 }DXLIBSETUP_STRUCTURE;
00107 
00108 class IdKingyoSetupTools{
00109 public:
00110     IdKingyoSetupTools(){}
00111     virtual ~IdKingyoSetupTools(){}
00113     virtual int Init(HINSTANCE hInstance,HINSTANCE hPrevInstance,
00114         LPSTR lpCmdLine,int nCmdShow) = 0;
00115     //**********************************************************
00116     //Userに設定させるダイアログ自身の処理
00117     //**********************************************************
00119     virtual int FileNameSet(char *str) = 0;
00121     virtual HWND GetDialogWindowHandle()=0;
00126 
00127     virtual int OpenDialog(bool modalflag=false) = 0;
00129     virtual int CloseDialog() = 0;
00131     virtual int UnenableWindowInDialog(int ID) = 0;
00132     //**********************************************************
00133     //ライブラリ自体の処理
00134     //**********************************************************
00136     virtual int Construct(int flag,void *point=NULL) = 0;
00138     virtual int Destruct() = 0;
00140     virtual int MyDefinedDataSet(int flag,void *InsertData)=0;
00141     virtual void *MyDefinedDataGet(int flag,void *data=NULL)=0;
00142     //**********************************************************
00143     //デバック情報Windowの表示とかをサポート
00144     //**********************************************************
00145     virtual int OpenDebugWindow(int passID,void *pass) = 0;
00146     virtual int CloseDebugWindow() = 0;
00147 };
00148 
00150 class IdKingyoInputManager{
00151 public:
00152     IdKingyoInputManager(){}
00153     virtual ~IdKingyoInputManager(){}
00154     virtual int GetInputAll() = 0;
00155     virtual int GetJoypadNum() = 0;
00156     virtual int GetJoypadState(int ID) = 0;
00157     virtual int GetJoypadAnalogInput( int *XBuf , int *YBuf , int InputType) =0;
00158     
00159     virtual int SetMouseDispFlag( bool DispFlag ) = 0;
00160     virtual int GetMousePoint( int *XBuf, int *YBuf ) = 0;
00161     virtual int SetMousePoint( int PointX , int PointY ) = 0;
00162     virtual int GetMouseInput( ) =0;
00163     virtual int GetMouseWheelRotVol( ) =0;
00164 
00165     virtual int CheckHitKeyAll(  ) =0;
00166     virtual int CheckHitKey( int KeyCode ) =0;
00167     virtual int GetHitKeyStateAll( char *KeyStateBuf ) =0;
00168 };
00169 
00170 
00171 
00172 
00173 
00174 
00175 
00176 
00177 //dxex = dxlib extention
00178 namespace dxex{
00181     int DrawTile(int h);
00182 
00193     inline void DrawTileBase(int px,int py,int xcheck,int ycheck,
00194         int gx,int gy,int h,bool transflag=true)
00195     {
00196         for(int i=0;i<xcheck;i++){
00197             for(int j=0;j<ycheck;j++){
00198                 int x=px + (gx * i);int y=py + (gy * j);
00199                 ::DrawGraph( x, y , h, transflag ) ;
00200                 //::DrawGraph( px + (gx * i), py + (gy * j) , h, transflag ) ;
00201             }
00202         }
00203     }
00220 
00221     int DrawShake(int x,int y,int accuracy,int shake1,
00222         int shake2,int sx,int sy,int gy,int gx,int h,int counter,
00223         bool transflag=true,int isXShake=TRUE);
00224     
00231 
00232     int DrawMoveTile(int getx,int gety,int h,bool transflag=true);
00233 
00234     
00236     int DrawAllScreenMoveTile(int getx,int gety,int h,bool transflag=true);
00237 
00238    
00239 
00240     inline int SetBlendAdd(int pal){return ::SetDrawBlendMode(DX_BLENDMODE_ADD,pal);}
00241     inline int SetBlendAlpha(int pal){return ::SetDrawBlendMode(DX_BLENDMODE_ALPHA,pal);}
00242     inline int SetBlendSub(int pal){return ::SetDrawBlendMode(DX_BLENDMODE_SUB,pal);}
00243     inline int SetBlendNormal(){return ::SetDrawBlendMode(DX_BLENDMODE_NOBLEND,0);}
00245     inline int CalcCenter(int screen,int graphs){return ((screen) >> 1) - ((graphs) >> 1);}
00246     
00248     inline bool CheckCollision(RECT &a,RECT &g){
00249         if(a.right<g.left || a.left>g.right || a.top>g.bottom || a.bottom<g.top)
00250         {//当たっていない
00251             return false;
00252         }else{//当たっている
00253             return true;
00254         }
00255     }
00256 
00257     inline bool CheckCollisionDot(int x,int y,int x2,int y2){
00258         RECT r={x,y,x,y};
00259         RECT r2={x2,y2,x2,y2};
00260         return CheckCollision(r,r2);
00261     }
00263     inline bool CheckCollisionMaybeFast(RECT &r1,RECT &r2){
00264         LONG a1 = r1.left - r2.right;
00265     LONG a2 = r2.left - r1.right;
00266         if((a1 & a2) >= 0)
00267             return false;
00268         return true;
00269         /*
00270         LONG a1 = -16 - p[i].x;
00271         LONG a2 = p[i].x - (640+16);
00272         LONG a3 = -16 - p[i].y;
00273         LONG a4 = p[i].y - (480+16);
00274         if((a1 | a2 | a3 | a4) < 0)
00275             res[i] = 0;
00276         else
00277             res[i] = 1;
00278         */
00279     }
00280     inline bool CheckCollisionX(RECT &a,RECT &g){
00281         if(a.right<g.left || a.left>g.right)
00282         {//当たっていない
00283             return false;
00284         }else{//当たっている
00285             return true;
00286         }
00287     }
00288     inline bool CheckCollisionY(RECT &a,RECT &g){
00289         if(a.top>g.bottom || a.bottom<g.top)
00290         {//当たっていない
00291             return false;
00292         }else{//当たっている
00293             return true;
00294         }
00295     }
00297     inline int SetDrawArea(const RECT *rc){
00298         return ::SetDrawArea(rc->left,rc->top,rc->right,rc->bottom);
00299     }
00301     inline int SafeDeleteGraph(int *handle){
00302         int h=(*handle);
00303         int r=-1;
00304         if(h != -1){
00305             r = ::DeleteGraph(h);
00306             (*handle) = -1;
00307         }
00308         return r;
00309     }
00316     inline int DrawCenterString(int y,int screenX,int color,char *c){
00317         int x = CalcCenter(screenX,GetDrawStringWidth( c , strlen(c)));
00318         return ::DrawString(x,y,c,color);
00319     }
00320 }//end of dxex namespace
00321 
00322 
00323 #endif

DxLib Extension Library ( DxEx )に対してThu Aug 21 13:18:57 2003に生成されました。 doxygen1.3