#include #include #include #include #include #include"main.h" #include"RubikCube.h" static int g_v; // 現在の選択列 static int g_k[CUBES]; // キューブの添字 D3DXMATRIX g_matCube[CUBES]; // キューブの回転行列 // キューブの回転行列の初期化 void InitCubeMatrix(void) { for(int i=0;iLock(sizeof(ColorBuffer)*8*index,sizeof(ColorBuffer)*8,(void**)&pColorBuffer,0); if(FAILED(hr)) return DXTRACE_ERR_MSGBOX(_T("InitDXGraphics Lock ColorBuffer"),hr); pColorBuffer[0].color=D3DCOLOR_ARGB(alpha,0xff,0x00,0x00); pColorBuffer[1].color=D3DCOLOR_ARGB(alpha,0x00,0xff,0x00); pColorBuffer[2].color=D3DCOLOR_ARGB(alpha,0x00,0x00,0xff); pColorBuffer[3].color=D3DCOLOR_ARGB(alpha,0x00,0x00,0x00); pColorBuffer[4].color=D3DCOLOR_ARGB(alpha,0xff,0xff,0x00); pColorBuffer[5].color=D3DCOLOR_ARGB(alpha,0xff,0x00,0xff); pColorBuffer[6].color=D3DCOLOR_ARGB(alpha,0x00,0xff,0xff); pColorBuffer[7].color=D3DCOLOR_ARGB(alpha,0x00,0x00,0x00); hr=g_pD3DVBColor->Unlock(); if(FAILED(hr)) return DXTRACE_ERR_MSGBOX(_T("InitDXGraphics UnLock ColorBuffer"),hr); return S_OK; } // 不透明にする static HRESULT UnClear(int index) { ColorBuffer *pColorBuffer; HRESULT hr=g_pD3DVBColor->Lock(sizeof(ColorBuffer)*8*index,sizeof(ColorBuffer)*8,(void**)&pColorBuffer,0); if(FAILED(hr)) return DXTRACE_ERR_MSGBOX(_T("InitDXGraphics Lock ColorBuffer"),hr); pColorBuffer[0].color=D3DCOLOR_ARGB(0xff,0xff,0x00,0x00); pColorBuffer[1].color=D3DCOLOR_ARGB(0xff,0x00,0xff,0x00); pColorBuffer[2].color=D3DCOLOR_ARGB(0xff,0x00,0x00,0xff); pColorBuffer[3].color=D3DCOLOR_ARGB(0xff,0x00,0x00,0x00); pColorBuffer[4].color=D3DCOLOR_ARGB(0xff,0xff,0xff,0x00); pColorBuffer[5].color=D3DCOLOR_ARGB(0xff,0xff,0x00,0xff); pColorBuffer[6].color=D3DCOLOR_ARGB(0xff,0x00,0xff,0xff); pColorBuffer[7].color=D3DCOLOR_ARGB(0xff,0x00,0x00,0x00); hr=g_pD3DVBColor->Unlock(); if(FAILED(hr)) return DXTRACE_ERR_MSGBOX(_T("InitDXGraphics UnLock ColorBuffer"),hr); return S_OK; } // 指定の選択列の最初の添字を返す static int operate(int index) { switch(index) { case 1: return 0; case 2: return 1; case 3: return 2; case 4: return 0; case 5: return 3; case 6: return 6; case 7: return 0; case 8: return 9; case 9: return 18; default: return -1; // error } } // 現在の選択列を示す void Indicate(int index) { int i,min,max,start,end; int a=operate(index); switch(index) { case 1: case 2: case 3: // x軸を回転軸にして回転 for(i=0;i=min && i%9=start && i=min && i%9