Esempio n. 1
0
Class* DeclarationContext::FindClass(const std::string& Name, bool IsComplete,
        bool Create)
{
    auto _class = FindClass(Name);

    if (!_class)
    {
        if (Create)
        {
            _class = CreateClass(Name, IsComplete);
            Classes.push_back(_class);
        }
        
        return _class;
    }

    if (_class->IsIncomplete == !IsComplete)
        return _class;

    if (!Create)
        return nullptr;

    auto newClass = CreateClass(Name, IsComplete);

    // Replace the incomplete declaration with the complete one.
    if (_class->IsIncomplete)
    {
        _class->CompleteDeclaration = newClass;

        std::replace_if(Classes.begin(), Classes.end(),
            [&](Class* klass) { return klass == _class; }, newClass);
    }

    return newClass;
}
Esempio n. 2
0
File: test.c Progetto: ekuznets/PKM2
void Main()
{
	bseg1 = true;
	LoadSegment("test_seg1.c");
	CreateClass("modelr");
	CreateClass("dummy");
}
Esempio n. 3
0
bool CommonWnd::Create()
{
  if (!CreateClass())
  {
    return false;
  }

  // Step 2: Creating the Window
  _hwnd = CreateWindowEx(
    WS_EX_CLIENTEDGE,
    _szClassName.c_str(),
    _szClassName.c_str(),
    WS_OVERLAPPEDWINDOW,
    CW_USEDEFAULT, 
    CW_USEDEFAULT, 
    CW_USEDEFAULT, 
    CW_USEDEFAULT,
    nullptr,
    nullptr,
    _wc.hInstance,
    this);

  if (_hwnd == nullptr)
  {
    return false;
  }
  return true;
}
Esempio n. 4
0
File: newton.c Progetto: rolk/ug
INT NS_DIM_PREFIX InitNewtonSolver (void)
{
  if (CreateClass (NL_SOLVER_CLASS_NAME ".newton",
                   sizeof(NP_NEWTON), NewtonConstruct))
    REP_ERR_RETURN (__LINE__);

  return (0);
}
Esempio n. 5
0
XXObject* XXObjectMouse::CreateObject(XSWFCONTEXT *pCnt, XXVARLIST &list,XBOOL)
{
	XXObjectMouse*pObj=CreateClass(this,XFALSE,m_pRoot);
	if(pObj)
		pObj->m_pSuperObj=GetSuperObject();
	pCnt->pStack->Push((pObj));
	return pObj;
}
Esempio n. 6
0
SquirrelObject RegisterClassType(HSQUIRRELVM v,const SQChar * scriptClassName,SQUserPointer classType,SQFUNCTION constructor) {
  int top = sq_gettop(v);
  SquirrelObject newClass;
  if (CreateClass(v,newClass,classType,scriptClassName)) {
    SquirrelVM::CreateFunction(newClass,constructor,_T("constructor"));
  } // if
  sq_settop(v,top);
  return newClass;
} // RegisterClassType
Esempio n. 7
0
//---------------------------------------------------------
//	create window class and create win32 control
//---------------------------------------------------------
Bool Win32::GWindow::Init(TPtr<GWinControl>& pOwner, u32 Flags)
{
	//	window needs to create class first
	if ( ! CreateClass() )
	{
		return NULL;
	}

	return GWinControl::Init( pOwner, Flags );
}
Esempio n. 8
0
int WINAPI WinMain(HINSTANCE me, HINSTANCE x, LPSTR cmdline, int cmdShow) {
    ghInst = me;
    CreateClass();
    OpenWindow();
    Run();
    if (nl != 0) {
        nl->shutdown();
    }
    return 0;
}
Esempio n. 9
0
void WizardsPlugin::DoCreateNewClass()
{
    NewClassDlg *dlg = new NewClassDlg(EventNotifier::Get()->TopFrame(), m_mgr);
    if (dlg->ShowModal() == wxID_OK) {
        //do something with the information here
        NewClassInfo info;
        dlg->GetNewClassInfo(info);

        CreateClass(info);
    }
    dlg->Destroy();
}
Esempio n. 10
0
XXObject* XXObjectColor::CreateObject(XSWFCONTEXT *pCnt, XXVARLIST &list,XBOOL)
{
	XXObjectColor*pColor=CreateClass(this,XFALSE,m_pRoot);

	if(pColor)
	{
		pColor->m_pSuperObj=GetSuperObject();
		if(list.GetSize()>0&&list[0].IsObject())
		{
			XXObjectClip*p=(XXObjectClip*)list[0].pObject;
			if(p->IsObject(XXOBJ_CLIP))
			  pColor->m_pClip=(XXObjectClip*)REFOBJECT(p);
		}
	}
	pCnt->pStack->Push((pColor));
	return pColor;
}
Esempio n. 11
0
//+++++++++++++++++++++++++++++++++++++++++++++++++
// ゲーム本編の更新処理
//-------------------------------------------------
// ゲームのメイン処理部分
//--in---------------------------------------------
// ウィンドウハンドル
//--out--------------------------------------------
// なし
//+++++++++++++++++++++++++++++++++++++++++++++++++
void GameMain(HWND hWnd)
{
#if (DEBUG_ON)

	TCHAR	str[256];
	g_szDebug[0] = _T('\0');	//デバッグ ストリング バッファ初期化
	_stprintf_s(str, _T("FPS = %.1f PLAYER_POS: X:%.1f Y:%.1f Z:%.1f \n NUM: 1:%f 2:%f 3:%f \n"), GetFPS(), x, y, z, num1, num2, num3);
	lstrcat(g_szDebug, str);

#endif
	VECTOR3 vecx, vecy;
	//画面遷移
	switch(g_nStatus)
	{
	case INIT:
		CreateClass();			//クラス領域の確保とロード
		p_Field->Init();			//フィールド
		p_Result->Init();
		g_loadFlg = false;
		SetThread();
		g_nStatus = LOADING;	//スルー
	case LOADING:
		if(g_loadFlg)
		{
			g_nStatus = STARTINIT;
			CloseHandle(Loadhandle);
		}
		break;
	case STARTINIT:
		p_Op->Init();				//オープニング
		p_Camera->ResetOp();		//カメラのリセット
		g_nStatus = START;

		break;
	case START:
		p_Camera->SetOpCamera();	//カメラのセット
		if(p_Op->Update())
			g_nStatus = MENU_INIT;
		break;
	case MENU_INIT:
		p_Camera->ResetOp();		//カメラのリセット
		p_Select->Init();
		g_nStatus = MENU;
		break;
	case MENU:
		p_Camera->SetOpCamera();	//カメラのセット
		if(p_Select->Update())
		{
			switch(p_Select->GetSelect())
			{
			case 0:
				p_SE->PlaySE(YES);
				g_nStatus = GAME_INIT_START;
				p_Select->Release();
				break;
			case 1:
				break;
			case 2:
				break;
			case 3:
				g_nStatus = END;
				p_Select->Release();
				break;
			default:break;
			}
		}
		num3 = (float)p_Select->GetSelect();
		break;
	case GAME_INIT_START:
		g_loadFlg = false;
		p_Ambient->Init();			//環境
		p_Score->Init();			//スコアの初期化
		p_Player->Init();			//プレイヤー
		p_Enemy->Init(p_Player);	//エネミー
		p_PlayerHpBar->Init();		//プレイヤーバー
		p_BossHpBar->Init();		//ボスバー
		p_2D->Init();
		
		//SetThread();
		g_nStatus = GAME_INIT;	//スルー
	case GAME_INIT:
		//生成
		//p_Score->Load();
		//p_Ambient->Load();
		//p_Player->Load();
		//p_Enemy->Load();
		//p_BossHpBar->Load();
		p_2D->Load();
		p_EffectMng->Load();

		//リセット
		p_Ambient->Reset();			//環境のリセット
		p_Player->Reset();			//プレイヤーのリセット
		p_Score->Reset();			//スコアのリセット
		p_Enemy->Reset();			//エネミーのリセット
		p_Camera->ResetGame();		//カメラのリセット
		p_PlayerHpBar->Reset();
		p_BossHpBar->Reset();
		p_Time->Reset();
		g_CubeFlg = true;
		//SetExecTime(timeGetTime());
		//if(g_loadFlg)
		//{
		//	CloseHandle(Loadhandle);
			g_nStatus = GAME_FILLER_START;
		//}
		break;
	case GAME_FILLER_START:
		if(p_2D->Update())
		{
			g_nStatus = GAME;
			p_2D->Reset();
			p_Time->Start();
			p_2D->m_Cnt = 0;
			p_SE->PlayBG(BG_GAME_NORMAL);
		}

		break;
	case GAME_RESET:	//リセット
		p_Player->Reset();			//プレイヤーのリセット
		p_Camera->ResetGame();		//カメラのリセット
		p_PlayerHpBar->Reset();
		p_BossHpBar->Reset();
		g_nStatus = GAME;
		break;
	case GAME:
		if(GetAsyncKeyState(VK_F12)&0x0001)
			g_CubeFlg ^= 1;
		p_Time->Update();
		p_Score->Update(p_Enemy->m_DeadCnt, p_Enemy->m_BossCnt);	//スコア
		p_Field->Update();			//地形
		p_Camera->GetVecCamera();	//カメラ
		p_Enemy->Update();			//エネミー
		p_Player->Update(p_Camera->vecx, p_Camera->vecz);	//プレイヤー
		p_Collision->Update();		//衝突判定
		p_Ambient->Update(p_Enemy->m_DeadCnt, p_Enemy->m_pEnemyBoss->m_AppearBoss);
		p_PlayerHpBar->Update(p_Player->m_Life, 100);	//プレイヤーのHPバー
		p_BossHpBar->Update(p_Enemy->m_pEnemyBoss->m_Life, 100);	//ボスのHPバー

		//ボスが生きていてL1が押された時Z注目をする
		if(pInput->GetBtnState(BTN_L1) == PRESS && p_Enemy->m_pEnemyBoss->m_Live)
		{
			p_Camera->SetOperatable(false);
		}
		//L1が離されたときは通常処理に戻す
		else if( pInput->GetBtnState(BTN_L1) == RLS )
		{
			p_Camera->SetOperatable(true);
		}

		if(pInput->GetBtnState(BTN_L2) == PRESS && pInput->GetBtnState(BTN_B) == PRESS )
		{
			p_Enemy->m_DeadCnt = 100; //デバグボス出現用
		}
		p_Camera->Update(p_Player->m_Pos, p_Enemy->m_pEnemyBoss->m_Pos);
		p_EffectMng->UpDate();
		
		{	
			//デバック表示用
			x = p_Player->m_Pos.x;
			y = p_Player->m_Pos.y;
			z = p_Player->m_Pos.z;
			num1 = p_Player->m_Matrix._11;
			num2 = (float)p_Enemy->m_pEnemyBoss->m_Life;
			//rad = p_Player->m_Matrix._13;
			//num3 = (float)p_Player->m_Life;
			num3 = p_PlayerHpBar->nM;
		}
		

		//結果
		if(p_Enemy->m_BossCnt)
			g_nStatus = GAME_FILLER_END;
		
		if(p_Player->m_bRetry)
			g_nStatus = GAME_FILLER_END;

#if (DEBUG_ON)
		//デバック用
		if(GetAsyncKeyState(VK_RETURN) & 0x0001)
			g_nStatus = GAME_FILLER_END;
#endif
		break;
	case GAME_FILLER_END:
			g_nStatus = RESULT_INIT;

		break;
	case RESULT_INIT:
		
		p_SE->StopBG(BG_GAME_BOSS);
		p_SE->PlayBG(BG_RESULT);
		p_Camera->ResetOp();		//カメラのリセット	OPと同じ
		p_Camera->SetOpCamera();	//カメラのセット
		
		p_Result->Init();
		g_nStatus = RESULT;
		break;
	case RESULT:
		if(p_Result->Update())
		{
			p_SE->StopBG(BG_RESULT);
			p_Result->Release();
			g_nStatus = MENU_INIT;
		}
		break;
	case ENDINIT:
			//g_nStatus = MENU_INIT;
		break;
	case END:
		p_SE->del();			//サウンドの開放
		DeCreateClass();		//クラスの解放
		g_bEnd = true;			//ゲーム終了
		return;
	default:break;
	}
	
	if(pInput != NULL)
	{
		pInput->Update();
		
		//プレゼン用
		if(pInput->GetBtnState(BTN_L1) == PRESS && pInput->GetBtnState(BTN_R1) == PRESS
		&& pInput->GetBtnState(BTN_L2) == PRESS && pInput->GetBtnState(BTN_R2) == PRESS)
		{
			p_SE->Reset();		//サウンドリセット
			g_nStatus = STARTINIT;
		}
	}
}
Esempio n. 12
0
bool ff::Module::CreateClass(REFGUID classId, REFGUID interfaceId, void **obj) const
{
    return CreateClass(nullptr, classId, interfaceId, obj);
}
Esempio n. 13
0
File: amg_ug.c Progetto: rolk/ug
INT NS_DIM_PREFIX InitAMGSolver ()
{
  if (CreateClass(LINEAR_SOLVER_CLASS_NAME ".amg",sizeof(NP_AMG),AMGConstruct))
    return (__LINE__);
  return (0);
}
Esempio n. 14
0
void USkelModel::Serialize(FArchive &Ar)
{
	guard(USkelModel::Serialize);

	assert(Ar.IsLoading);					// no saving ...
	Super::Serialize(Ar);

	// USkelModel data
	int nummeshes;
	int numjoints;
	int numframes;
	int numsequences;
	int numskins;
	int rootjoint;

	FVector					PosOffset;		// Offset of creature relative to base
	FRotator				RotOffset;		// Offset of creatures rotation

	TArray<RMesh>			meshes;
	TArray<RJoint>			joints;
	TArray<FRSkelAnimSeq>	AnimSeqs;		// Compressed animation data for sequence
	TArray<RAnimFrame>		frames;

	Ar << nummeshes << numjoints << numframes << numsequences << numskins << rootjoint;
	Ar << meshes << joints << AnimSeqs << frames << PosOffset << RotOffset;

	int modelIdx;
	// create all meshes first, then fill them (for better view order)
	for (modelIdx = 0; modelIdx < meshes.Num(); modelIdx++)
	{
		// create new USkeletalMesh
		// use "CreateClass()" instead of "new USkeletalMesh" to allow this object to be
		// placed in GObjObjects array and be browsable in a viewer
		USkeletalMesh *sm = static_cast<USkeletalMesh*>(CreateClass("SkeletalMesh"));
		char nameBuf[256];
		appSprintf(ARRAY_ARG(nameBuf), "%s_%d", Name, modelIdx);
		const char *name = appStrdupPool(nameBuf);
		Meshes.Add(sm);
		// setup UOnject
		sm->Name         = name;
		sm->Package      = Package;
		sm->PackageIndex = INDEX_NONE;		// not really exported
		sm->Outer        = NULL;
	}
	// create animation
	Anim = static_cast<UMeshAnimation*>(CreateClass("MeshAnimation"));
	Anim->Name         = Name;
	Anim->Package      = Package;
	Anim->PackageIndex = INDEX_NONE;		// not really exported
	Anim->Outer        = NULL;
	ConvertRuneAnimations(*Anim, joints, AnimSeqs);
	Anim->ConvertAnims();					//?? second conversion
	// get baseframe
	assert(strcmp(Anim->AnimSeqs[0].Name, "baseframe") == 0);
	const TArray<AnalogTrack> &BaseAnim = Anim->Moves[0].AnimTracks;
	// compute bone coordinates
	TArray<CCoords> BoneCoords;
	BuildSkeleton(BoneCoords, joints, BaseAnim);

	// setup meshes
	for (modelIdx = 0; modelIdx < meshes.Num(); modelIdx++)
	{
		int i, j;
		const RMesh  &src = meshes[modelIdx];
		USkeletalMesh *sm = Meshes[modelIdx];
		sm->Animation = Anim;
		// setup ULodMesh
		sm->RotOrigin = RotOffset;
		sm->MeshScale.Set(1, 1, 1);
		sm->MeshOrigin = PosOffset;
		// copy skeleton
		sm->RefSkeleton.Empty(joints.Num());
		for (i = 0; i < joints.Num(); i++)
		{
			const RJoint &J = joints[i];
			FMeshBone *B = new(sm->RefSkeleton) FMeshBone;
			B->Name = J.name;
			B->Flags = 0;
			B->ParentIndex = (J.parent > 0) ? J.parent : 0;		// -1 -> 0
			// copy bone orientations from base animation frame
			B->BonePos.Orientation = BaseAnim[i].KeyQuat[0];
			B->BonePos.Position    = BaseAnim[i].KeyPos[0];
		}
		// copy vertices
		int VertexCount = sm->VertexCount = src.verts.Num();
		sm->Points.Empty(VertexCount);
		for (i = 0; i < VertexCount; i++)
		{
			const RVertex &v1 = src.verts[i];
			FVector *V = new(sm->Points) FVector;
			// transform point from local bone space to model space
			BoneCoords[v1.joint1].UnTransformPoint(CVT(v1.point1), CVT(*V));
		}
		// copy triangles and create wedges
		// here we create 3 wedges for each triangle.
		// it is possible to reduce number of wedges by finding duplicates, but we don't
		// need it here ...
		int TrisCount = src.tris.Num();
		sm->Triangles.Empty(TrisCount);
		sm->Wedges.Empty(TrisCount * 3);
		int numMaterials = 0;		// should detect real material count
		for (i = 0; i < TrisCount; i++)
		{
			const RTriangle &tri = src.tris[i];
			// create triangle
			VTriangle *T = new(sm->Triangles) VTriangle;
			T->MatIndex = tri.polygroup;
			if (numMaterials <= tri.polygroup)
				numMaterials = tri.polygroup+1;
			// create wedges
			for (j = 0; j < 3; j++)
			{
				T->WedgeIndex[j] = sm->Wedges.Num();
				FMeshWedge *W = new(sm->Wedges) FMeshWedge;
				W->iVertex = tri.vIndex[j];
				W->TexUV   = tri.tex[j];
			}
			// reverse order of triangle vertices
			Exchange(T->WedgeIndex[0], T->WedgeIndex[1]);
		}
		// build influences
		for (i = 0; i < VertexCount; i++)
		{
			const RVertex &v1 = src.verts[i];
			FVertInfluence *Inf = new(sm->VertInfluences) FVertInfluence;
			Inf->PointIndex = i;
			Inf->BoneIndex  = v1.joint1;
			Inf->Weight     = v1.weight1;
			if (Inf->Weight != 1.0f)
			{
				// influence for 2nd bone
				Inf = new(sm->VertInfluences) FVertInfluence;
				Inf->PointIndex = i;
				Inf->BoneIndex  = v1.joint2;
				Inf->Weight     = 1.0f - v1.weight1;
			}
		}
		// create materials
		for (i = 0; i < numMaterials; i++)
		{
			const char *texName = src.PolyGroupSkinNames[i];
			FMeshMaterial *M1 = new(sm->Materials) FMeshMaterial;
			M1->PolyFlags    = src.GroupFlags[i];
			M1->TextureIndex = sm->Textures.Num();
			if (strcmp(texName, "None") == 0)
			{
				// texture should be set from script
				sm->Textures.Add(NULL);
				continue;
			}
			// find texture in object's package
			int texExportIdx = Package->FindExport(texName);
			if (texExportIdx == INDEX_NONE)
			{
				appPrintf("ERROR: unable to find export \"%s\" for mesh \"%s\" (%d)\n",
					texName, Name, modelIdx);
				continue;
			}
			// load and remember texture
			UMaterial *Tex = static_cast<UMaterial*>(Package->CreateExport(texExportIdx));
			sm->Textures.Add(Tex);
		}
		// setup UPrimitive properties using 1st animation frame
		// note: this->BoundingBox and this->BoundingSphere are null
		const RAnimFrame &F = frames[0];
		assert(strcmp(AnimSeqs[0].Name, "baseframe") == 0 && AnimSeqs[0].StartFrame == 0);
		CVec3 mins, maxs;
		sm->BoundingBox = F.bounds;
		mins = CVT(F.bounds.Min);
		maxs = CVT(F.bounds.Max);
		CVec3 &center = CVT(sm->BoundingSphere);
		for (i = 0; i < 3; i++)
			center[i] = (mins[i] + maxs[i]) / 2;
		sm->BoundingSphere.R = VectorDistance(center, mins);

		// create CSkeletalMesh
		sm->ConvertMesh();
	}

	unguard;
}
Esempio n. 15
0
File: ewn.c Progetto: rolk/ug
INT NS_DIM_PREFIX InitEWN ()
{
  if (CreateClass(EW_SOLVER_CLASS_NAME ".ewn",sizeof(NP_EWN),EWNConstruct)) return (__LINE__);

  return (0);
}