LRESULT WINAPI ScreenSaverProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static HDC hDC; static HGLRC hRC; static RECT rect; switch (message) { case WM_CREATE: GetClientRect(hWnd, &rect); Width = rect.right; Height = rect.bottom; InitGL(hWnd, hDC, hRC); InitAnim(); SetTimer(hWnd, TIMER, 10, NULL); return 0; case WM_DESTROY: KillTimer(hWnd, TIMER); DestroyAnim(); CloseGL(hWnd, hDC, hRC); return 0; case WM_TIMER: DoAnim(); SwapBuffers(hDC); return 0; } return DefScreenSaverProc(hWnd, message, wParam, lParam); }
Player::Player(int setWidth, int setHeight, float setX, float setY, int setSprite, bool setCollision) { InitAnim(); width = setWidth; height = setHeight; x = setX; y = setY; sprite = setSprite; collision = setCollision; timer = 0; currentFrame = 0; frameMax = 0; type = 0; shoot = true; shotTimer = 0; state = 0; currentBullet = 0; bulletSize = 24; alive = true; bullet = new Bullet[bulletSize]; for(int i=0; i<bulletSize; i++) { bullet[i] = Bullet(4, 16, -32, -32, CreateSprite("./images/Laser.png", 4, 16, true), 0); } }
void USkeletalMeshComponent::SetAnimClass(class UClass* NewClass) { if (NewClass != NULL) { UAnimBlueprintGeneratedClass* NewGeneratedClass = Cast<UAnimBlueprintGeneratedClass>(NewClass); ensure(NULL != NewGeneratedClass); // set the animation mode AnimationMode = EAnimationMode::Type::AnimationBlueprint; if (NewGeneratedClass != AnimBlueprintGeneratedClass) { // Only need to initialize if it hasn't already been set. AnimBlueprintGeneratedClass = NewGeneratedClass; ClearAnimScriptInstance(); InitAnim(true); } } else { // Need to clear the instance as well as the blueprint. // @todo is this it? AnimBlueprintGeneratedClass = NULL; ClearAnimScriptInstance(); } }
void USkeletalMeshComponent::SetSkeletalMesh(USkeletalMesh* InSkelMesh) { if (InSkelMesh == SkeletalMesh) { // do nothing if the input mesh is the same mesh we're already using. return; } UPhysicsAsset* OldPhysAsset = GetPhysicsAsset(); Super::SetSkeletalMesh(InSkelMesh); #if WITH_EDITOR ValidateAnimation(); #endif if (GetPhysicsAsset() != OldPhysAsset && IsPhysicsStateCreated()) { RecreatePhysicsState(); } UpdateHasValidBodies(); InitAnim(false); #if WITH_APEX_CLOTHING ValidateClothingActors(); #endif }
Player::Player(void) { InitAnim(); bulletSize = 24; width = 0; height = 0; x = 0; y = 0; sprite = CreateSprite( "./images/Ship_Idle.png", 64, 64, true); collision = true; state = 0; }
void USkeletalMeshComponent::OnRegister() { Super::OnRegister(); InitAnim(false); if (MeshComponentUpdateFlag == EMeshComponentUpdateFlag::OnlyTickPoseWhenRendered && !FApp::CanEverRender()) { SetComponentTickEnabled(false); } }
void USkeletalMeshComponent::InitializeComponent() { Super::InitializeComponent(); InitAnim(false); #if EXPERIMENTAL_PARALLEL_CODE PrimaryComponentTick.TickGroup = TG_ParallelAnimWork; PrimaryComponentTick.bRunOnAnyThread = true; #endif }
Animation::Animation(std::string nombre, SpriteSheet* spriteSheet, int initAnim, int endAnim, float animSpeed, bool pause, bool loop ) { m_spriteSheet = spriteSheet; m_animationName = nombre; m_initAnim = initAnim; m_endAnim = endAnim; m_frames = new std::vector<sf::IntRect>; m_animSpeed = animSpeed; m_pause = pause; m_loop = loop; InitAnim(); }
/************************************************************************ cMouse::Constructor() Initialize DI device *************************************************************************/ cMouse::cMouse(LPDIRECTINPUT8 pDI, HWND hwnd, bool isExclusive) { cLog *Log = cLog::Instance(); HRESULT hr; hr = pDI->CreateDevice(GUID_SysMouse, &m_pDIDev, NULL); if(FAILED(hr)) { Log->Error(hr,"Creating mouse device"); } hr = m_pDIDev->SetDataFormat(&c_dfDIMouse); if(FAILED(hr)) { Log->Error(hr,"Setting mouse data format"); } //DIMOUSESTATE Structure - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/input/ref/structs/dimousestate.asp DWORD flags; if (isExclusive) { flags = DISCL_FOREGROUND | DISCL_EXCLUSIVE | DISCL_NOWINKEY; } else { flags = DISCL_FOREGROUND | DISCL_NONEXCLUSIVE; //ShowCursor(false); } hr = m_pDIDev->SetCooperativeLevel(hwnd, flags); if (FAILED(hr)) { Log->Error(hr,"Setting mouse cooperative level"); } hr = m_pDIDev->Acquire(); if(FAILED(hr)) { Log->Error(hr,"Acquiring mouse"); } hr = m_pDIDev->GetDeviceState(sizeof(DIMOUSESTATE), &m_state); if(FAILED(hr)) { Log->Error(hr,"Getting mouse device state"); } SetPointer(NORMAL); SetSelection(SELECT_NOTHING); InitAnim(); }