Fix 'K' key to display "K" instead of "L". Fix keys being improperly deleted/added to new keybinds list. Allow keybinds to now be changed. Fix keybind update request message not updating properly for menu keys.
This commit is contained in:
parent
1f244777c9
commit
0ca94369ac
@ -162,7 +162,7 @@
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\discord-files;C:\Users\sigon\Documents\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\discord-files;C:\Users\sigon\OneDrive\Documents\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>/MP8 %(AdditionalOptions)</AdditionalOptions>
|
||||
<TreatSpecificWarningsAsErrors>4099;5030;4715;4172;4834</TreatSpecificWarningsAsErrors>
|
||||
</ClCompile>
|
||||
|
@ -3078,10 +3078,10 @@ const uint8_t AiL::BossEncounterMobCount()const{
|
||||
}
|
||||
|
||||
|
||||
void AiL::GetAnyKeyPress(Key key){
|
||||
void AiL::GetAnyKeyRelease(Key key){
|
||||
if(key!=0){
|
||||
#pragma region New keyboard input binding listener
|
||||
if(Menu::stack.back()==Menu::menus[NEW_INPUT]){ //We are requesting a brand new input.
|
||||
if(Menu::IsMenuOpen()&&Menu::stack.back()==Menu::menus[NEW_INPUT]){ //We are requesting a brand new input.
|
||||
if(key==ESCAPE){ //If we hit escape we don't bother with setting the input and leave immediately.
|
||||
Menu::CloseMenu();
|
||||
return;
|
||||
@ -3089,11 +3089,18 @@ void AiL::GetAnyKeyPress(Key key){
|
||||
using A=Attribute;
|
||||
if(InputGroup::menuNamesToInputGroups.count(Menu::menus[NEW_INPUT]->S(A::KEYBIND))){
|
||||
InputGroup::menuNamesToInputGroups[Menu::menus[NEW_INPUT]->S(A::KEYBIND)]->SetNewPrimaryKeybind(Input{KEY,key});
|
||||
Menu::alreadyClicked=true;
|
||||
Menu::CloseMenu();
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
GameState::STATE->GetAnyKeyRelease(key);
|
||||
}
|
||||
}
|
||||
|
||||
void AiL::GetAnyKeyPress(Key key){
|
||||
if(key!=0){
|
||||
GameState::STATE->GetAnyKeyPress(key);
|
||||
}
|
||||
}
|
@ -154,7 +154,8 @@ public:
|
||||
bool OnUserCreate() override;
|
||||
bool OnUserUpdate(float fElapsedTime) override;
|
||||
bool OnUserDestroy() override;
|
||||
void GetAnyKeyPress(Key key)override;
|
||||
void GetAnyKeyPress(Key key)override final;
|
||||
void GetAnyKeyRelease(Key key)override final;
|
||||
public:
|
||||
geom2d::rect<float>NO_COLLISION={{0.f,0.f,},{0.f,0.f}};
|
||||
TileTransformedView view;
|
||||
|
@ -79,4 +79,5 @@ void GameState::ChangeState(States::State newState,float fadeOutDuration){
|
||||
|
||||
GameState::~GameState(){}
|
||||
|
||||
void GameState::GetAnyKeyPress(Key k){}
|
||||
void GameState::GetAnyKeyPress(Key k){}
|
||||
void GameState::GetAnyKeyRelease(Key k){}
|
@ -68,5 +68,6 @@ public:
|
||||
virtual void OnUserUpdate(AiL*game)=0;
|
||||
virtual void Draw(AiL*game)=0;
|
||||
virtual void GetAnyKeyPress(Key k);
|
||||
virtual void GetAnyKeyRelease(Key k);
|
||||
static void ChangeState(States::State newState,float fadeOutDuration=0);
|
||||
};
|
@ -70,7 +70,9 @@ void Menu::InitializeKeyboardInputWindow(){
|
||||
|
||||
auto inputChangeButton=inputKeyboardWindow->ADD(std::format("Input_{}_{} Input Displayer",row,col),InputDisplayComponent)(geom2d::rect<float>{vf2d{4,36}+vf2d{inputWindowWidth/2.f*col,row*12.f}+vf2d{inputWindowWidth/4.f,-1.f},vf2d{inputWindowWidth/4.f,11.f}},*InputGroup::menuNamesToInputGroups[inputDisplayName],InputType::KEY,[](MenuFuncData data){
|
||||
Menu::menus[NEW_INPUT]->B(A::IS_KEYBOARD)=true;
|
||||
Menu::menus[NEW_INPUT]->S(A::KEYBIND)=data.component.lock()->S(A::KEYBIND);
|
||||
std::string keybindName=data.component.lock()->S(A::KEYBIND);
|
||||
Menu::menus[NEW_INPUT]->S(A::KEYBIND)=keybindName;
|
||||
Component<MenuLabel>(NEW_INPUT,"New Keybind Label")->SetLabel(std::format("Press a new key for '{}'\n\nPress Esc to cancel.",keybindName));
|
||||
Menu::OpenMenu(NEW_INPUT);
|
||||
return true;
|
||||
})END;
|
||||
|
@ -327,7 +327,7 @@ std::map<std::pair<InputType,int>,GenericKey::KeyInfo> GenericKey::keyLiteral={
|
||||
{{KEY, H},{"H"}},
|
||||
{{KEY, I},{"I"}},
|
||||
{{KEY, J},{"J"}},
|
||||
{{KEY, K},{"L"}},
|
||||
{{KEY, K},{"K"}},
|
||||
{{KEY, L},{"L"}},
|
||||
{{KEY, M},{"M"}},
|
||||
{{KEY, N},{"N"}},
|
||||
@ -539,9 +539,16 @@ const InputEngageGroup InputEngageGroup::operator=(const InputEngageGroup&rhs){
|
||||
|
||||
|
||||
void InputGroup::RemovePrimaryKeybind(InputType type){
|
||||
keyOrder.erase(keyOrder.begin());
|
||||
auto primaryInputIt=std::find_if(keyOrder.begin(),keyOrder.end(),[&](Input&input){return input.GetType()==type;});
|
||||
|
||||
if(primaryInputIt!=keyOrder.end()){
|
||||
Input&primaryInput=*primaryInputIt;
|
||||
keys.erase(primaryInput);
|
||||
keyOrder.erase(primaryInputIt);
|
||||
}else ERR(std::format("WARNING! Could not find a valid primary input of type {}! THIS SHOULD NOT BE HAPPENING!",int(type)));
|
||||
}
|
||||
void InputGroup::AddPrimaryKeybind(Input key){
|
||||
keys.insert(key);
|
||||
keyOrder.insert(keyOrder.begin(),{key.GetType(),key.key});
|
||||
}
|
||||
void InputGroup::SetNewPrimaryKeybind(Input key){
|
||||
|
@ -200,8 +200,6 @@ public:
|
||||
void SetSelection(std::variant<std::string,std::weak_ptr<MenuComponent>>button,const bool reset=false); // Use the reset parameter when a window is opening up, as this will cause the window now to scroll to its previous target.
|
||||
const std::weak_ptr<MenuComponent>GetSelection()const;
|
||||
const std::weak_ptr<MenuComponent>GetKeySelection()const;
|
||||
void IncreaseSelectionIndex(const float val);
|
||||
void DecreaseSelectionIndex(const float val);
|
||||
private:
|
||||
Menu(vf2d pos,vf2d size);
|
||||
static MenuType lastMenuTypeCreated;
|
||||
|
@ -253,6 +253,4 @@ void State_OverworldMap::ResetConnectionPoints(){
|
||||
for(ConnectionPoint&cp:connections){
|
||||
cp.visited=false;
|
||||
}
|
||||
}
|
||||
|
||||
void State_OverworldMap::GetAnyKeyPress(Key key){}
|
||||
}
|
@ -59,5 +59,4 @@ public:
|
||||
virtual void Draw(AiL*game)override final;
|
||||
static void StartLevel();
|
||||
static void UpdateCurrentConnectionPoint(const ConnectionPoint&connection);
|
||||
virtual void GetAnyKeyPress(Key key)override final;
|
||||
};
|
@ -30,7 +30,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
Portions of this software are copyright ??© 2024 The FreeType
|
||||
Portions of this software are copyright ???? 2024 The FreeType
|
||||
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
|
||||
All rights reserved.
|
||||
*/
|
||||
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 6836
|
||||
#define VERSION_BUILD 6852
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
@ -995,6 +995,7 @@ namespace olc
|
||||
// Called once on application termination, so you can be one clean coder
|
||||
virtual bool OnUserDestroy();
|
||||
virtual void GetAnyKeyPress(Key key);
|
||||
virtual void GetAnyKeyRelease(Key key);
|
||||
|
||||
// Called when a text entry is confirmed with "enter" key
|
||||
virtual void OnTextEntryComplete(const std::string& sText);
|
||||
@ -4416,6 +4417,8 @@ namespace olc
|
||||
|
||||
void PixelGameEngine::GetAnyKeyPress(Key key)
|
||||
{ }
|
||||
void PixelGameEngine::GetAnyKeyRelease(Key key)
|
||||
{ }
|
||||
|
||||
void PixelGameEngine::OnTextEntryComplete(const std::string& sText) { UNUSED(sText); }
|
||||
bool PixelGameEngine::OnConsoleCommand(const std::string& sCommand) { UNUSED(sCommand); return false; }
|
||||
@ -4643,12 +4646,13 @@ namespace olc
|
||||
{
|
||||
pKeys[i].bPressed = !pKeys[i].bHeld;
|
||||
pKeys[i].bHeld = true;
|
||||
GetAnyKeyPress(Key(i));
|
||||
if(pKeys==pKeyboardState)GetAnyKeyPress(Key(i)); //Only produce an event when it's for the keyboard.
|
||||
}
|
||||
else
|
||||
{
|
||||
pKeys[i].bReleased = true;
|
||||
pKeys[i].bHeld = false;
|
||||
if(pKeys==pKeyboardState)GetAnyKeyRelease(Key(i)); //Only produce an event when it's for the keyboard.
|
||||
}
|
||||
}
|
||||
pStateOld[i] = pStateNew[i];
|
||||
|
Loading…
x
Reference in New Issue
Block a user