void VikeWin::GeneralHandler(int keyCode, bool skip) { int state = GetState(); if(state == VIKE_INVALID){ ResetState(); return; } /* Clear status on VIKE_END */ if(state == VIKE_END){ ClearKeyStatus(); ResetState(); } /* Not skip, update key status and status bar */ if(!skip){ if(state == VIKE_SEARCH || state == VIKE_COMMAND){ ClearKeyStatus(); }else if(state != VIKE_END){ AppendKeyStatus(keyCode); } UpdateStatusBar(); } }
void ApplyBuoyancy(Surface velocity, Surface temperature, Surface density, Surface dest) { GLuint p = Programs.ApplyBuoyancy; glUseProgram(p); GLint tempSampler = glGetUniformLocation(p, "Temperature"); GLint inkSampler = glGetUniformLocation(p, "Density"); GLint ambTemp = glGetUniformLocation(p, "AmbientTemperature"); GLint timeStep = glGetUniformLocation(p, "TimeStep"); GLint sigma = glGetUniformLocation(p, "Sigma"); GLint kappa = glGetUniformLocation(p, "Kappa"); glUniform1i(tempSampler, 1); glUniform1i(inkSampler, 2); glUniform1f(ambTemp, AmbientTemperature); glUniform1f(timeStep, TimeStep); glUniform1f(sigma, SmokeBuoyancy); glUniform1f(kappa, SmokeWeight); glBindFramebuffer(GL_FRAMEBUFFER, dest.FboHandle); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, velocity.TextureHandle); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, temperature.TextureHandle); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, density.TextureHandle); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); ResetState(); }
void SubtractGradient(Surface velocity, Surface pressure, Surface obstacles, Surface dest) { GLuint p = Programs.SubtractGradient; glUseProgram(p); GLint inverseSize = glGetUniformLocation(p, "InverseSize"); glUniform2f(inverseSize, 1.0f / GridWidth, 1.0f / GridHeight); GLint gradientScale = glGetUniformLocation(p, "GradientScale"); glUniform1f(gradientScale, GradientScale); GLint halfCell = glGetUniformLocation(p, "HalfInverseCellSize"); glUniform1f(halfCell, 0.5f / CellSize); GLint sampler = glGetUniformLocation(p, "Pressure"); glUniform1i(sampler, 1); sampler = glGetUniformLocation(p, "Obstacles"); glUniform1i(sampler, 2); glBindFramebuffer(GL_FRAMEBUFFER, dest.FboHandle); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, velocity.TextureHandle); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, pressure.TextureHandle); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, obstacles.TextureHandle); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); ResetState(); }
void Advect(Surface velocity, Surface source, Surface boundaries, Surface dest, float dissipation) { GLuint p = Programs.Advect; glUseProgram(p); GLint inverseSize = glGetUniformLocation(p, "InverseSize"); GLint timeStep = glGetUniformLocation(p, "TimeStep"); GLint dissLoc = glGetUniformLocation(p, "Dissipation"); GLint sourceTexture = glGetUniformLocation(p, "SourceTexture"); GLint boundariesTexture = glGetUniformLocation(p, "Boundaries"); glUniform2f(inverseSize, 1.0f / g_iWidth, 1.0f / g_iHeight); glUniform1f(timeStep, TimeStep); glUniform1f(dissLoc, dissipation); glUniform1i(sourceTexture, 1); glUniform1i(boundariesTexture, 2); glBindFramebuffer(GL_FRAMEBUFFER, dest.FboHandle); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, velocity.TextureHandle); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, source.TextureHandle); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, boundaries.TextureHandle); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); ResetState(); }
void DXAPI::ChangeWindowed(){ HRESULT hr; Logger::Debug("[GraphicAPI] Change Window Type "); Logger::Debugln(gamemode?"Fullsc -> Window":"Window->Fullsc"); if (gamemode){ hr = lpd3ddev->Reset(&d3dpw); }else{ hr = lpd3ddev->Reset(&d3dpf); } if (FAILED(hr)){ Logger::Println("[GraphicAPI] Device Reset Fail"); SendMessage(hWnd,WM_DESTROY,0,0L); return; } if (gamemode){ //make window SetWindowLong(hWnd,GWL_STYLE,WS_OVERLAPPEDWINDOW&(~WS_MAXIMIZEBOX)&(~WS_MINIMIZEBOX)&(~WS_THICKFRAME)); SetWindowPos(hWnd, NULL,winx,winy,width + GetSystemMetrics(SM_CXDLGFRAME) * 2, height + GetSystemMetrics(SM_CYDLGFRAME) * 2 +GetSystemMetrics(SM_CYCAPTION),SWP_SHOWWINDOW); }else{ //make fullsc SetWindowLong(hWnd,GWL_STYLE,WS_POPUP|WS_VISIBLE); SetWindowPos(hWnd, NULL,0,0,width,height,SWP_SHOWWINDOW); } gamemode=!gamemode; ResetState(); return; }
void Jacobi(Surface pressure, Surface divergence, Surface boundaries, Surface dest) { GLuint p = Programs.Jacobi; glUseProgram(p); GLint alpha = glGetUniformLocation(p, "Alpha"); GLint inverseBeta = glGetUniformLocation(p, "InverseBeta"); GLint dSampler = glGetUniformLocation(p, "Divergence"); GLint bSampler = glGetUniformLocation(p, "Boundaries"); glUniform1f(alpha, -CellSize * CellSize); glUniform1f(inverseBeta, 0.25f); glUniform1i(dSampler, 1); glUniform1i(bSampler, 2); glBindFramebuffer(GL_FRAMEBUFFER, dest.FboHandle); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, pressure.TextureHandle); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, divergence.TextureHandle); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, boundaries.TextureHandle); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); ResetState(); }
void CDialogActorContext::BeginSession() { DiaLOG::Log(DiaLOG::eAlways, "[DIALOG] CDialogActorContext::BeginSession: %s Now=%f 0x%p actorID=%d ", m_pSession->GetDebugName(), m_pSession->GetCurTime(), this, m_actorID); ResetState(); IEntitySystem* pES = gEnv->pEntitySystem; pES->AddEntityEventListener( m_entityID, ENTITY_EVENT_AI_DONE, this ); pES->AddEntityEventListener( m_entityID, ENTITY_EVENT_DONE, this ); pES->AddEntityEventListener( m_entityID, ENTITY_EVENT_RESET, this ); switch (GetAIBehaviourMode()) { case CDialogSession::eDIB_InterruptAlways: ExecuteAI( m_goalPipeID, "ACT_ANIM" ); break; case CDialogSession::eDIB_InterruptMedium: ExecuteAI( m_goalPipeID, "ACT_DIALOG" ); break; case CDialogSession::eDIB_InterruptNever: break; } m_bNeedsCancel = true; }
void Controls::DoRotation(std::vector<GameObject*> &levelAssets, Vector2 mousePos, float dt) { m_GUI->DisablePanel(true); if (mR_state) { if (dynamic_cast<Cannon*>(SelectedGO)) { Vector2 toolToMouse = mousePos - SelectedGO->getPos(); Vector2 up(0, 1); float angleBetween = (toolToMouse).AngleBetween(up); dynamic_cast<Cannon*>(SelectedGO)->getAngleByReference() = (-angleBetween); oldPos = mousePos; if ((fabs)((fabs)(anglePrev) - (fabs)(angleBetween)) >= 0.05f) { float cannonPower = ((Cannon*)(SelectedGO))->GetPower(); Vector2 cannonForce = Vector2(0, 1) * cannonPower; cannonForce.rotateVector(-angleBetween); trajectoryFeedback = ((Balls*)(ball))->GetPath(levelAssets, SelectedGO->getPos(), cannonForce, dt, 0.2, 1.4f); } anglePrev = angleBetween; } } else ResetState(); }
ODSItemState :: ODSItemState ( ) { ResetState(); is_total++; if ( is_max < ++is_count ) is_max = is_count; }
CGlobalUnsynced::CGlobalUnsynced() { rng.Seed(time(NULL) % ((spring_gettime().toNanoSecsi() + 1) * 9007)); assert(playerHandler == NULL); ResetState(); }
void CNetTurnManager::QuickLoad() { TIMER(L"QuickLoad"); if (m_QuickSaveState.empty()) { LOGERROR("Cannot quickload game - no game was quicksaved"); return; } std::stringstream stream(m_QuickSaveState); if (!m_Simulation2.DeserializeState(stream)) { LOGERROR("Failed to quickload game"); return; } if (g_GUI && !m_QuickSaveMetadata.empty()) g_GUI->RestoreSavedGameData(m_QuickSaveMetadata); LOGMESSAGERENDER("Quickloaded game"); // See RewindTimeWarp ResetState(0, 1); }
void EnterState_SendI(bool dropMode = false) { m_random.setSeed( CUseTrueRandom ? time(0) : 35654); m_state = SEND_I; GenerateParam(dropMode); ResetState(); }
void Advect(Shader& advect, Surface velocity, Surface source, Surface obstacles, Surface dest, float dissipation) { GLuint p = advect.Program; glUseProgram(p); float TimeStep = 0.1f; GLint inverseSize = glGetUniformLocation(p, "InverseSize"); GLint timeStep = glGetUniformLocation(p, "TimeStep"); GLint dissLoc = glGetUniformLocation(p, "Dissipation"); GLint sourceTexture = glGetUniformLocation(p, "SourceTexture"); GLint obstaclesTexture = glGetUniformLocation(p, "Obstacles"); glUniform2f(inverseSize, 1.0f / GridWidth * 0.5, 1.0f / GridHeight * 0.5); glUniform1f(timeStep, TimeStep); glUniform1f(dissLoc, dissipation); glUniform1i(sourceTexture, 1); glUniform1i(obstaclesTexture, 2); glBindFramebuffer(GL_FRAMEBUFFER, dest.FboHandle); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, velocity.TextureHandle); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, source.TextureHandle); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, obstacles.TextureHandle); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); ResetState(); }
FSMReader::FSMReader() { strcpy(Type, CFSMP_ParserTags[FSM_MSG_FSM]); //Type of parser ResetState(); cStateList = NULL; FSMReset(); }
//GAME INITIALIZATION void FSMReader::Init(char *FileName) { LogFile.open(FileName); if (LogFile) //NAME the file ResetState(); else exit(0); };
/** * Initializes variables in CGlobalSynced */ CGlobalSynced::CGlobalSynced() { randSeed = 18655; initRandSeed = randSeed; assert(teamHandler == NULL); ResetState(); }
void RenderingContext::RestoreState() { if (mStateNode!=nullptr) { mStateNode->Restore(); } ResetState(); }
void CBinocular::OnDropped(EntityId actorId) { ResetState(); if(GetOwnerActor() == NULL) return; GetOwnerActor()->SelectLastItem(true, true); }
CLanguageReader::CLanguageReader(char * versionP, char* tituloP) { strcpy(Type,CLaP_LanguageParserMsgs[LOG_LANGUAGE_LANGUAGE]); //Type of parser ResetState(); StateStack.push(NIL_D); AssignTags (CLaP_Tags, CLaP_OwnTags, LAN_MAX_TAGS); version = versionP; titulo = tituloP; }
void CScrobbler::Init() { if (!CanScrobble()) return; ResetState(); LoadCredentials(); LoadJournal(); if (!IsRunning()) Create(); }
void CScrobbler::Init() { if (!CanScrobble()) return; ResetState(); LoadCredentials(); LoadJournal(); if (!ThreadHandle()) Create(); }
LocallyOptimalAllocator::LocallyOptimalAllocator(OptimizationTarget opt_target, SpeedupModelType speedup_model, double core_power, double uncore_power, int num_cores) : BaseAllocator(opt_target, speedup_model, core_power, uncore_power, num_cores) , process_scaling() , process_serial_runtime() { ResetState(); }
virtual void ProcessEvent( EFlowEvent event, SActivationInfo * pActInfo ) { switch (event) { case eFE_ConnectInputPort: // Count the number if inputs connected. if (pActInfo->connectPort < NUM_INPUTS) m_inputCount++; break; case eFE_DisconnectInputPort: // Count the number if inputs connected. if (pActInfo->connectPort < NUM_INPUTS) m_inputCount--; break; case eFE_Initialize: ResetState(); // Fall through to check the input. case eFE_Activate: // Inputs int ntrig = 0; for (int i=0; i<NUM_INPUTS; i++) { if (!m_triggered[i] && IsPortActive(pActInfo,i)) m_triggered[i] = (event == eFE_Activate); if (m_triggered[i]) ntrig++; } // Reset if (IsPortActive(pActInfo, NUM_INPUTS)) { ResetState(); ntrig = 0; } // If all inputs have been triggered, trigger output. // make sure we actually have connected inputs! if (!m_outputTrig && m_inputCount > 0 && ntrig == m_inputCount) { ActivateOutput(pActInfo,0,true); m_outputTrig = (event == eFE_Activate); } break; } }
CScrobbler::CScrobbler(const CStdString &strHandshakeURL, const CStdString &strLogPrefix) : CThread("CScrobbler") { m_bBanned = false; m_bBadAuth = false; m_pHttp = NULL; m_strHandshakeURL = strHandshakeURL; m_strLogPrefix = strLogPrefix; ResetState(); }
// Remove object from database void Object::Delete(bool reset_state) { if (m_id != 0) { database.DeleteObject(m_id); } if (reset_state) { ResetState(); } }
/** * @fn BeginParse * @param DWORD dwAppData: represents the open file * @param bool bAbort: represents if the parser is aborted * This function starts the debugger parser */ void FSMReader::BeginParse(DWORD dwAppData, bool &bAbort) { UNUSED_ALWAYS(dwAppData); bAbort = false; #ifdef FSM_DEBUG //Class HTML_FSM Parser Debug activated LogFile << CP_ParserMsgs[LOG_STARTING_INTERPRETATION] << "\n"; #endif ResetState(); //Stack reset StateStack.push(NIL_FSM); }
void CLanguageReader::Init(char *File) { if (NULL != File) { LogFile.open(File); if (!LogFile) //NAME the file exit(0); } ResetState(); StateStack.push(NIL_D); };
CPUWrapper::CPUWrapper() : memory(0x10000), cartridge("res/test_roms/06.gb") { processor = new CPU(&memory); processor->InsertCartridge(&cartridge); Init(); ResetState(); }
void Webserver::Init() { // initialise the webserver class longWait = platform->Time(); webserverActive = true; numSessions = clientsServed = 0; uploadIp = 0; // initialise all protocol handlers ResetState(); }
OpScopeNetworkHost::~OpScopeNetworkHost() { // OpScopeNetwork will cleanup socket, socketaddr and connected flag // It will also notify external listeners if needed ResetState(); if (GetClient()) DetachClient(); if (OpScopeHostManager *manager = GetHostManager()) manager->ReportDestruction(this); }