void KeyState::Enter(Ndk::StateMachine& fsm) { m_text.SetVisible(true); DrawMenu(); Nz::EventHandler& eventHandler = m_context.window.GetEventHandler(); m_keyPressedSlot.Connect(eventHandler.OnKeyPressed, [&] (const Nz::EventHandler*, const Nz::WindowEvent::KeyEvent& key) { ManageInput(KeyStatus::Pressed, key, fsm); }); m_keyReleasedSlot.Connect(eventHandler.OnKeyReleased, [&] (const Nz::EventHandler*, const Nz::WindowEvent::KeyEvent& key) { ManageInput(KeyStatus::Released, key, fsm); }); }
// Called each loop iteration bool S_SceneAI::Update(float dt) { ManageInput(dt); SDL_Rect rect1 = { 0, 0, 0, 0 }; App->render->Blit(mapTexture, &rect1, true); if (renderMap) App->map->Draw(); //Render current tile iPoint p = App->map->MapToWorld(currentTile_x, currentTile_y); SDL_Rect pos = { p.x, p.y, 8, 8 }; SDL_Rect rect = { 0, 0, 64, 64 }; App->render->Blit(debug_tex, &pos, true, &rect); return true; }
bool UIInputText::Update(float dt) { if (textChanged) { UpdateTextTexture(); textChanged = false; } if (App->gui->GetFocus() == this) { //Deactivate default text if (defaultText) { if (defaultText->active = true) { defaultText->active = false; defaultOn = false; } } ManageInput(); RenderCursor(); } if (!defaultOn) { //Rendering input text int x, y; x = GetWorldRect().x + offsetX - App->render->camera.x - textDisplacement; y = GetWorldRect().y + offsetY - App->render->camera.y; if (text_texture) App->render->Blit(text_texture, x, y, &textRect); } return true; }