Example #1
0
void TestScene::Init()
{
	font = new DxFont();
	this->AppendObject(font, 1, true);
	this->AppendItemBox("font", font);

	tex = new Texture("soccerball.png");
	sprite = new Sprite(tex);
	this->AppendItemBox("tex", tex);
	this->AppendItemBox("sprite", sprite);

	r=0.f;

	AppendObject(new BGMusic("Kalimba.mp3"), 5, "BGM", true);
	AppendItemBox("BGM", FindObject("BGM"));
	bgm = dynamic_cast<BGMusic*>(this->FindItemBox("BGM"));
	//if(bgm) bgm->Play();

    input = (Input*)FindObject("input");  
    if(input == NULL){  
        input = new Input();  
        AppendObject(input, 0, "input", true);  
    } 

	sound.Load("missile.wav");
	Sound *se = new Sound(*(Sound*)FindItemBox("burst"));
	//se->EnableDeleteByEnd();
	se->Play();
}
Example #2
0
void CEnemy3::Exec()
{
	// 移動
	if(y <= 150){
		y += 1.0f;
	}else{
		// 途中から水平移動に切り替え
		if(left == true){
			x += 1.0f;
		}else{
			x -= 1.0f;
		}

		if(x > 704.0f && x < -64.0f){
			RemoveObject(this);
			return;
		}
	}

	// 弾の発射
	if(frame % 120 == 0 && frame > 0){
		//120フレームごとに連射フラグを切り替える
		shoot = !shoot;

		// 連射終了直後であれば
		// 真下に向かって5way弾を発射する
		if(shoot == false){
			float angle[5] = {90.0f, 70.0f, 50.0f, 110.0f, 130.0f};
			for(int i = 0; i < 5; i++){
			AppendObject(
				new CEnemyBullet(x, y + 18, d2r(angle[i]), 2.5f),
				ENEMYBULLET_PRIORITY, true);
			}
		}
	}
	
	// 連射フラグが有効になっているのであれば
	// 20フレームごとに真下に弾を発射
	if(shoot == true){
		if(frame % 20 == 0){
			AppendObject(
				new CEnemyBullet(x - 40, y + 37, d2r(90.0f), 2.0f),
				ENEMYBULLET_PRIORITY, true);
			AppendObject(
				new CEnemyBullet(x + 40, y + 37, d2r(90.0f), 2.0f),
				ENEMYBULLET_PRIORITY, true);
		}
	}

	frame++;

	sprite.Draw(x, y);

	if(this->HitTest(player)){
		player->Destroy();
		this->Damaged();
	}
}
Example #3
0
WindowClass::WindowClass() : Window()
{
	m_screen = 0;

	AppendObject(label_1 = new Label(m_screen, Rect(2, 2, 61, 10), "Press L+R+START+SELECT to unlock screen"));

	int button_width = 124;
	AppendObject(button_left = new Button(m_screen, Rect(2, 8, button_width, 12), "Left Click", &ButtonLeftFunction));
	AppendObject(button_right = new Button(m_screen, Rect(button_width + 4, 8, button_width + 1, 12), "Right Click", &ButtonRightFunction));
}
Example #4
0
void CBoss::Exec()
{
    switch(status){
    case boss_pattern1: Action1(); break;
    case boss_pattern2: Action2(); break;
    case boss_pattern3: Action3(); break;
    default:
        if(ActionDestroy() == true){
			// ゲームクリアー画面を表示
			AppendObject(new CContinue(true), CONTINUE_PRIORITY, true);

            // 完了フラグが返されたら自身を消去
            RemoveObject(this);
            return;
        }
    }

	sprite.Draw(x, y);				// 右半分描画
	sprite.Draw(x, y, -1.0f, 1.0f);	// 左右反転して左半分描画

	battery.Draw(x - BUTTERY_X, y - BUTTERY_Y, bangle[0]);
	battery.Draw(x + BUTTERY_X, y - BUTTERY_Y, bangle[1]);

	if(this->HitTest(player) && hardness > 0){
		player->Destroy();
	}
}
Example #5
0
void CEnemy2::Exec()
{
	if(shoot == false && y > 100){
		float angle = atan2f(player->GetPosY() - y, player->GetPosX() - x);
		AppendObject(
			new CEnemyBullet(x, y, angle, 2.0f),
			ENEMYBULLET_PRIORITY, true);
		shoot = true;
	}

	y += 2.0f;

	if(y > 480.0f + 16.0f || x < -16.0f || x > 640.0f + 16.0f)
	{
		RemoveObject(this);
		return;
	}

	sprite.Draw(x, y);

	if(this->HitTest(player)){
		player->Destroy();
		this->Damaged();
	}
}
Example #6
0
LRESULT OnLButtonUp(HWND hWnd,WPARAM wParam,LPARAM lParam)
{
    RECT crt,irt;
    int SwapResult;

    if (DragMode==DM_DRAW) {
        if (AppendObject(NowTool,sx,sy,oldx,oldy)==TRUE) {
            NowSel=arNum-1;
        } else {
            NowTool=DT_SELECT;
            NowSel=-1;
        }
        InvalidateRect(hWnd,NULL,TRUE);
    }
    if (DragMode==DM_MOVE || DragMode==DM_SIZE) {
        SwapResult=NormalizeRect(&dObj.rt);
        GetClientRect(hWnd,&crt);
        InflateRect(&crt,-10,-10);
        IntersectRect(&irt,&crt,&dObj.rt);
        if (!IsRectEmpty(&irt)) {
            arObj[NowSel]->rt=dObj.rt;
            arObj[NowSel]->Flag ^= SwapResult;
        }
        InvalidateRect(hWnd,NULL,TRUE);
    }
    DragMode=DM_NONE;
    ReleaseCapture();
    return 0;
}
void
nsXBLResourceLoader::AddResourceListener(nsIContent* aBoundElement) 
{
  if (aBoundElement) {
    mBoundElements.AppendObject(aBoundElement);
  }
}
Example #8
0
void CBoss::Action2()
{
    // 左右に移動
    if(moveflag1 == 0){
        x -= 0.5f;
        if(x < 100.0f) moveflag1 = 1;
    }else{
        x += 0.5f;
        if(x > 540.0f) moveflag1 = 0;
    }

    frame++;
    if(frame % 40 == 0){
        ShootFromNozzle(2.0f);
    }

    if(frame == 240){
        // 中央部分から拡散弾
        float range[] = {30.0f, 60.0f, 90.0f, 120.0f, 150.0f};
        for(int i = 0; i < 5; i++){
            AppendObject(
                new CEnemyBullet(x, y + 50.0f, d2r(range[i]), 3.0f),
                ENEMYBULLET_PRIORITY, true);
        }

        frame = 0;
    }
}
Example #9
0
//----------------------------------------------------
bool EScene::OnLoadSelectionAppendObject(CCustomObject* obj)
{
    string256 				buf;
    GenObjectName			(obj->ClassID,buf,obj->Name);
    obj->Name				= buf;
    AppendObject			(obj, false);
    obj->Select				(true);
    return 					true;
}
void Burger::LinkedListObjects::AppendObject(void *pData,Object::ProcDataDelete pDataDelete)
{
	// Create the new object
	Object *pObject = Object::New(pData,pDataDelete);
	// If successful, append it
	if (pObject) {
		AppendObject(pObject);
	}
}
Example #11
0
LRESULT OnLButtonUp(HWND hWnd,WPARAM wParam,LPARAM lParam)
{
	if (DragMode==DM_DRAW) {
		AppendObject(NowTool,sx,sy,oldx,oldy);
		InvalidateRect(hWnd,NULL,TRUE);
	}
	DragMode=DM_NONE;
	ReleaseCapture();
	return 0;
}
Example #12
0
void CEnemy3::Damaged()
{
	hardness--;
	if(hardness == 0){
		// 10個の爆炎をランダムで拡散させる
		for(int i = 0; i < 10; i++){
			float angle = d2r((float)(36 * i));
			float size = 0.5f + 2.0f * (float)rand() / (float)(RAND_MAX + 1);
			float speed = 1.0f + 5.0f * (float)rand() / (float)(RAND_MAX + 1);
			AppendObject(new CExplosion(x, y, size, angle, speed),
				EXPLOSION_PRIORITY, true);
		}

		CSound *se = new CSound(*(CSound*)FindItemBox("explode2"));
		se->EnableDeleteByEnd();
		se->Play();

		AppendObject(new CPowerupItem(x, y), PLAYER_PRIORITY, true);
		RemoveObject(this);
	}
}
void Burger::LinkedListObjects::AppendObject(const char *pString)
{
	char *pStringCopy = StringDuplicate(pString);
	if (pStringCopy) {
		// Create the new object
		Object *pObject = Object::New(pStringCopy);
		// If successful, append it
		if (pObject) {
			AppendObject(pObject);
		}
	}
}
Example #14
0
bool CBoss::ActionDestroy()
{
	frame++;
	if(frame < 500){
		// 500フレーム目まではボス周辺でランダムに爆炎を発生させる
		if(frame % 5 == 0){
			float xx = x + (float)(rand() % 500 - 250);
			float yy = y + (float)(rand() % 300 - 150);
			float sz = 1.0f + 2.0f * (float)rand() / (float)RAND_MAX;
			AppendObject(new CExplosion(xx, yy, sz, 0.0f, 0.0f),
				EXPLOSION_PRIORITY, true);
		}

		y += 0.2f;

		if(frame % 15 == 0){
			((CSound*)FindItemBox("explode1"))->Play();
		}

		return false;
	}else{
		// 500フレーム目で大爆発を起こす
		float xx, yy, a, s, z;
		for(int i = 0; i < 50; i++){
			xx = x + (float)(rand() % 100 - 50);
			yy = y + (float)(rand() % 100 - 50);
			a = atan2f(x - xx, yy - y);
			s = 5.0f + 10.0f * (float)rand() / (float)RAND_MAX;
			z = 3.0f + 8.0f * (float)rand() / (float)RAND_MAX;
			AppendObject(new CExplosion(xx, yy,
				2.0f, a, s), EXPLOSION_PRIORITY, true);
		}

        CSound *se = new CSound(*(CSound*)FindItemBox("explode3"));
        se->EnableDeleteByEnd();
        se->Play();

		return true;
	}
}
Example #15
0
// Append the given pObject to the OMObjectVector.
AAFRESULT STDMETHODCALLTYPE ImplAAFRefArrayValue::AppendElement(
  ImplAAFPropertyValue* pPropertyValue)
{
  AAFRESULT result = AAFRESULT_SUCCESS;
  if (NULL == pPropertyValue)
    return AAFRESULT_NULL_PARAM;
    
  ImplAAFStorable * pObject = GetStorableFromPropertyValue(pPropertyValue, result);
  if (AAFRESULT_FAILED(result))
    return result;
  
  result = AppendObject(pObject); 
  return result;
}
Example #16
0
void CEnemyBase::Damaged()
{
	// 残り耐久度を1減らす
	hardness--;
	if(hardness == 0){
		CSound *se = new CSound(*(CSound*)FindItemBox("explode1"));
		se->EnableDeleteByEnd();
		se->Play();

		// 爆発処理を追加
		AppendObject(new CExplosion(x, y), EXPLOSION_PRIORITY, true);
		// 自身を削除
		RemoveObject(this);
	}
}
Example #17
0
void CBoss::MiniExplosion()
{
    // 大小からなる30個の爆炎を拡散させる
    float xx, yy, a, s;
    for(int i = 0; i < 30; i++){
        xx = x + (float)(rand() % 300 - 150);
        yy = y + (float)(rand() % 100 - 50);
        a = atan2f(x - xx, yy - y);
        s = 2.0f + 4.0f * (float)rand() / (float)RAND_MAX;
        AppendObject(new CExplosion(xx, yy,
            2.0f, a, s), EXPLOSION_PRIORITY, true);
    }

	((CSound*)FindItemBox("explode2"))->Play();
}
Example #18
0
nsAccessible*
AccCollector::EnsureNGetObject(PRUint32 aIndex)
{
  PRInt32 childCount = mRoot->GetChildCount();
  while (mRootChildIdx < childCount) {
    nsAccessible* child = mRoot->GetChildAt(mRootChildIdx++);
    if (!mFilterFunc(child))
      continue;

    AppendObject(child);
    if (mObjects.Length() - 1 == aIndex)
      return mObjects[aIndex];
  }

  return nsnull;
}
Example #19
0
PRInt32
AccCollector::EnsureNGetIndex(nsAccessible* aAccessible)
{
  PRInt32 childCount = mRoot->GetChildCount();
  while (mRootChildIdx < childCount) {
    nsAccessible* child = mRoot->GetChildAt(mRootChildIdx++);
    if (!mFilterFunc(child))
      continue;

    AppendObject(child);
    if (child == aAccessible)
      return mObjects.Length() - 1;
  }

  return -1;
}
Example #20
0
void CBoss::ShootFromNozzle(float speed)
{
	// 砲弾から弾の発射
	for(int i = 0; i < 2; i++){
		// 砲台口の中心位置を計算
		float xx = -sinf(bangle[i]) * MUZZLE_Y;
		float yy = cosf(bangle[i]) * MUZZLE_Y;
		if(i == 0){
			xx += x - BUTTERY_X;
		}else{
			xx += x + BUTTERY_X;
		}
		yy += y + BUTTERY_Y;

		// 弾を発射
		AppendObject(
			new CEnemyBullet(xx, yy, bangle[i] + d2r(90.0f), speed),
			ENEMYBULLET_PRIORITY, true);
	}
}
Example #21
0
void InsertBitmap(int x,int y)
{
    OPENFILENAME OFN;
    char lpstrFile[MAX_PATH]="";
    HANDLE hFile;
    DWORD FileSize, dwRead;
    BYTE *pBmp;
    BITMAPINFOHEADER *ih;

    memset(&OFN, 0, sizeof(OPENFILENAME));
    OFN.lStructSize = sizeof(OPENFILENAME);
    OFN.hwndOwner=hWndMain;
    OFN.lpstrFilter="비트맵 파일\0*.bmp\0모든 파일(*.*)\0*.*\0";
    OFN.lpstrFile=lpstrFile;
    OFN.nMaxFile=256;
    if (GetOpenFileName(&OFN)!=0) {
        hFile=CreateFile(lpstrFile,GENERIC_READ,0,NULL,
                         OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
        if (hFile!=INVALID_HANDLE_VALUE) {
            FileSize=GetFileSize(hFile,NULL);
            pBmp=(BYTE *)malloc(FileSize);
            ReadFile(hFile,pBmp,FileSize,&dwRead,NULL);
            CloseHandle(hFile);
            if (*pBmp != 0x42 || *(pBmp+1) != 0x4d) {
                free(pBmp);
                return;
            }
            ih=(BITMAPINFOHEADER *)(pBmp+sizeof(BITMAPFILEHEADER));
            AppendObject(DT_BITMAP,x,y,x+ih->biWidth,y+ih->biHeight);
            arObj[arNum-1]->Bitmap=pBmp;
            arObj[arNum-1]->Len=FileSize;

            InvalidateRect(hWndMain,NULL,TRUE);
            NowTool=DT_SELECT;
            NowSel=arNum-1;
        }
    }
}
Example #22
0
void CEnemyPattern::Exec()
{
	if(frame == 0){
		CBGMusic *bgm = (CBGMusic*)FindObject("bgm1");
		bgm->Play(true);
	}else if(frame > 150 && frame < 400){
		if(frame % 20 == 0){
			AppendObject(new CEnemy1(40.0f), ENEMY_PRIORITY, true);
		}
	}else if(frame >= 600 && frame < 850){
		if(frame % 20 == 0){
			AppendObject(new CEnemy1(600.0f), ENEMY_PRIORITY, true);
		}
	}else if(frame >= 1050 && frame < 1300){
		if(frame % 40 == 0){
			AppendObject(new CEnemy1(40.0f), ENEMY_PRIORITY, true);
		}else if(frame % 40 == 20){
			AppendObject(new CEnemy1(600.0f), ENEMY_PRIORITY, true);
		}
	}else if(frame == 1500){
		AppendObject(new CEnemy3(100.0f), ENEMY_PRIORITY, true);
	}else if(frame > 2000 && frame <= 2400){
		if(frame % 30 == 0){
			AppendObject(new CEnemy2
				((float)(50 + (rand() % 540))), ENEMY_PRIORITY, true);
		}

		if(frame == 2400){
			CBGMusic *bgm = (CBGMusic*)FindObject("bgm1");
			bgm->Fade(5000, -5000);
		}
	}else if(frame == 2600){
		CBGMusic *bgm = (CBGMusic*)FindObject("bgm2");
		bgm->Play(true);
		AppendObject(new CBoss(), ENEMY_PRIORITY, true);
	}

	frame++;
}
Example #23
0
void InsertMeta(int x,int y)
{
    OPENFILENAME OFN;
    char lpstrFile[MAX_PATH]="";
    HANDLE hFile;
    DWORD FileSize, dwRead;
    BYTE *pMeta;

    memset(&OFN, 0, sizeof(OPENFILENAME));
    OFN.lStructSize = sizeof(OPENFILENAME);
    OFN.hwndOwner=hWndMain;
    OFN.lpstrFilter="메타 파일\0*.wmf\0모든 파일(*.*)\0*.*\0";
    OFN.lpstrFile=lpstrFile;
    OFN.nMaxFile=256;
    if (GetOpenFileName(&OFN)!=0) {
        hFile=CreateFile(lpstrFile,GENERIC_READ,0,NULL,
                         OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
        if (hFile!=INVALID_HANDLE_VALUE) {
            FileSize=GetFileSize(hFile,NULL);
            pMeta=(BYTE *)malloc(FileSize);
            ReadFile(hFile,pMeta,FileSize,&dwRead,NULL);
            CloseHandle(hFile);
            if(*((DWORD *)pMeta) != 0x9ac6cdd7l) {
                free(pMeta);
                return;
            }
            AppendObject(DT_META,x,y,x+100,y+100);
            arObj[arNum-1]->Meta=pMeta;
            arObj[arNum-1]->Len=FileSize;

            InvalidateRect(hWndMain,NULL,TRUE);
            NowTool=DT_SELECT;
            NowSel=arNum-1;
        }
    }
}
Example #24
0
pgCollection *ctlTree::AppendCollection(pgObject *parent, pgaFactory &factory)
{
	pgCollection *collection = factory.CreateCollection(parent);
	AppendObject(parent, collection);
	return collection;
}
Example #25
0
BOOL AppendObject(DTool Type,RECT *prt)
{
	return AppendObject(Type,prt->left,prt->top,prt->right,prt->bottom);
}
Example #26
0
WindowClass::WindowClass() : Window()
{
	m_screen = 0;
	int x = 97;
	int y = 90;
	int w = 15;
	int h = 15;
	int gap = 6;

	AppendObject(label_entry      = new Label(m_screen, Rect(64,24+3,40,10), ""));
	AppendObject(edit_entry       = new Edit(m_screen, Rect(96,24,95,10), "", &VoidFunction));

	AppendObject(button_1         = new Button(m_screen, Rect(x + 0, y, w, h), "1", &Button1Function));
	AppendObject(button_2         = new Button(m_screen, Rect(x + w + gap, y, w, h), "2", &Button2Function));
	AppendObject(button_3         = new Button(m_screen, Rect(x + (w * 2) + (gap * 2), y, w, h), "3", &Button3Function));
	y += h + gap;
	AppendObject(button_4         = new Button(m_screen, Rect(x + 0, y, w, h), "4", &Button4Function));
	AppendObject(button_5         = new Button(m_screen, Rect(x + w + gap, y, w, h), "5", &Button5Function));
	AppendObject(button_6         = new Button(m_screen, Rect(x + (w * 2) + (gap * 2), y, w, h), "6", &Button6Function));
	y += h + gap;
	AppendObject(button_7         = new Button(m_screen, Rect(x + 0, y, w, h), "7", &Button7Function));
	AppendObject(button_8         = new Button(m_screen, Rect(x + w + gap, y, w, h), "8", &Button8Function));
	AppendObject(button_9         = new Button(m_screen, Rect(x + (w * 2) + (gap * 2), y, w, h), "9", &Button9Function));
	y += h + gap;
	AppendObject(button_period    = new Button(m_screen, Rect(x + 0, y, w, h), ".", &ButtonPeriodFunction));
	AppendObject(button_0         = new Button(m_screen, Rect(x + w + gap, y, w, h), "0", &Button0Function));
	AppendObject(button_backspace = new Button(m_screen, Rect(x + (w * 2) + (gap * 2), y, w, h), "<", &ButtonBackspaceFunction));
	y += h + gap;
	AppendObject(button_enter     = new Button(m_screen, Rect(x + 0, y, 42, h), "Enter", &ButtonEnterFunction));
}
Example #27
0
bool EScene::OnLoadAppendObject(CCustomObject* O)
{
	AppendObject	(O,false);
    return true;
}
Example #28
0
LRESULT OnLButtonDown(HWND hWnd,WPARAM wParam,LPARAM lParam)
{
    int TempSel;
    int nHit;
    TCHAR *pText;

    if (NowTool==DT_TEXT) {
        pText=NULL;
        if (DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_TEXT),hWnd,
                           TextDlgProc,(LPARAM)&pText) == IDOK) {
            if (lstrlen(pText) == 0) {
                free(pText);
            } else {
                AppendObject(DT_TEXT,LOWORD(lParam),HIWORD(lParam),
                             LOWORD(lParam)+200,HIWORD(lParam)+50);
                arObj[arNum-1]->Text=pText;
                arObj[arNum-1]->Len=lstrlen(pText)+1;
                arObj[arNum-1]->PlaneColor=-1;
                InvalidateRect(hWndMain,NULL,TRUE);
            }
            NowTool=DT_SELECT;
            NowSel=arNum-1;
        }
        return 0;
    }
    if (NowTool==DT_BITMAP) {
        InsertBitmap(LOWORD(lParam),HIWORD(lParam));
        return 0;
    }
    if (NowTool==DT_META) {
        InsertMeta(LOWORD(lParam),HIWORD(lParam));
        return 0;
    }
    if (NowTool==DT_SELECT) {
        nHit=TrackerHitTest(LOWORD(lParam),HIWORD(lParam));
        if (nHit != 0) {
            oldx=LOWORD(lParam);
            oldy=HIWORD(lParam);
            AdjustToGrid(oldx,oldy);
            dObj=*arObj[NowSel];
            SizeCorner=nHit;
            DrawTemp(&dObj);
            DragMode=DM_SIZE;
        } else {
            TempSel=FindObject(LOWORD(lParam),HIWORD(lParam));
            if (NowSel != TempSel) {
                NowSel=TempSel;
                InvalidateRect(hWnd,NULL,TRUE);
                UpdateWindow(hWnd);
            }
            if (NowSel != -1) {
                oldx=LOWORD(lParam);
                oldy=HIWORD(lParam);
                AdjustToGrid(oldx,oldy);
                dObj=*arObj[NowSel];
                DrawTemp(&dObj);
                DragMode=DM_MOVE;
            }
        }
    } else {
        sx=LOWORD(lParam);
        sy=HIWORD(lParam);
        AdjustToGrid(sx,sy);
        oldx=sx;
        oldy=sy;
        DragMode=DM_DRAW;
    }
    SetCapture(hWnd);
    return 0;
}