mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-23 16:19:44 +00:00
chat screen & chat button position and hide ui on show chat
This commit is contained in:
parent
6121dce9e1
commit
624d1cd82f
@ -709,7 +709,8 @@ static ConfigSetting networkSettings[] = {
|
||||
ConfigSetting("EnableWlan", &g_Config.bEnableWlan, false, true, true),
|
||||
ConfigSetting("EnableAdhocServer", &g_Config.bEnableAdhocServer, false, true, true),
|
||||
ConfigSetting("EnableNetworkChat", &g_Config.bEnableNetworkChat, false, true, true),
|
||||
|
||||
ConfigSetting("ChatButtonPosition",&g_Config.iChatButtonPosition,BOTTOM_LEFT,true,true),
|
||||
ConfigSetting("ChatScreenPosition",&g_Config.iChatScreenPosition,BOTTOM_LEFT,true,true),
|
||||
ConfigSetting(false),
|
||||
};
|
||||
|
||||
|
@ -77,6 +77,17 @@ enum IOTimingMethods {
|
||||
IOTIMING_REALISTIC = 2,
|
||||
};
|
||||
|
||||
enum ChatPositions {
|
||||
BOTTOM_LEFT = 0,
|
||||
BOTTOM_CENTER = 1,
|
||||
BOTOM_RIGHT = 2,
|
||||
TOP_LEFT = 3,
|
||||
TOP_CENTER = 4,
|
||||
TOP_RIGHT = 5,
|
||||
CENTER_LEFT = 6,
|
||||
CENTER_RIGHT = 7,
|
||||
};
|
||||
|
||||
namespace http {
|
||||
class Download;
|
||||
class Downloader;
|
||||
@ -425,7 +436,10 @@ public:
|
||||
int iWlanAdhocChannel;
|
||||
bool bWlanPowerSave;
|
||||
bool bEnableNetworkChat;
|
||||
|
||||
//for chat position , moveable buttons is better than this
|
||||
int iChatButtonPosition;
|
||||
int iChatScreenPosition;
|
||||
|
||||
int iPSPModel;
|
||||
int iFirmwareVersion;
|
||||
// TODO: Make this work with your platform, too!
|
||||
|
@ -23,17 +23,18 @@ void ChatMenu::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
#if defined(_WIN32) || defined(USING_QT_UI)
|
||||
chatEdit_ = bottom->Add(new TextEdit("", n->T("Chat Here"), new LinearLayoutParams(1.0)));
|
||||
#if defined(USING_WIN_UI)
|
||||
//freeze the ui when using ctrl + C hotkey need workaround
|
||||
if (g_Config.bBypassOSKWithKeyboard && !g_Config.bFullScreen)
|
||||
{
|
||||
std::wstring titleText = ConvertUTF8ToWString(n->T("Chat"));
|
||||
std::wstring defaultText = ConvertUTF8ToWString(n->T("Chat Here"));
|
||||
std::wstring inputChars;
|
||||
if (System_InputBoxGetWString(titleText.c_str(), defaultText, inputChars)) {
|
||||
chatEdit_->SetText(ConvertWStringToUTF8(inputChars));
|
||||
//chatEdit_->SetText(ConvertWStringToUTF8(inputChars));
|
||||
sendChat(ConvertWStringToUTF8(inputChars));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
chatEdit_->OnEnter.Handle(this, &ChatMenu::OnSubmit);
|
||||
bottom->Add(new Button(n->T("Send")))->OnClick.Handle(this, &ChatMenu::OnSubmit);
|
||||
#elif defined(__ANDROID__)
|
||||
@ -56,8 +57,26 @@ void ChatMenu::CreateViews() {
|
||||
|
||||
float yres = screenManager()->getUIContext()->GetBounds().h;
|
||||
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL,
|
||||
new AnchorLayoutParams(PopupWidth(), FillVertical() ? yres - 30 : WRAP_CONTENT, 280, NONE, NONE, 250, true));
|
||||
switch (g_Config.iChatScreenPosition) {
|
||||
case 0:
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(PopupWidth(), FillVertical() ? yres - 30 : WRAP_CONTENT, 280, NONE, NONE, 250, true));
|
||||
break;
|
||||
case 1:
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(PopupWidth(), FillVertical() ? yres - 30 : WRAP_CONTENT, dc.GetBounds().centerX(), NONE, NONE, 250, true));
|
||||
break;
|
||||
case 2:
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(PopupWidth(), FillVertical() ? yres - 30 : WRAP_CONTENT, NONE, NONE, 280, 250, true));
|
||||
break;
|
||||
case 3:
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(PopupWidth(), FillVertical() ? yres - 30 : WRAP_CONTENT, 280, 250, NONE, NONE, true));
|
||||
break;
|
||||
case 4:
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(PopupWidth(), FillVertical() ? yres - 30 : WRAP_CONTENT, dc.GetBounds().centerX(), 250, NONE, NONE, true));
|
||||
break;
|
||||
case 5:
|
||||
box_ = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(PopupWidth(), FillVertical() ? yres - 30 : WRAP_CONTENT, NONE, 250, 280, NONE, true));
|
||||
break;
|
||||
}
|
||||
|
||||
root_->Add(box_);
|
||||
box_->SetBG(UI::Drawable(0x66303030));
|
||||
@ -67,7 +86,14 @@ void ChatMenu::CreateViews() {
|
||||
box_->Add(title);
|
||||
|
||||
CreatePopupContents(box_);
|
||||
#if defined(_WIN32) || defined(USING_QT_UI)
|
||||
//not work yet for tywald requests cant set the focus to chat edit after chat opened
|
||||
root_->SetDefaultFocusView(box_);
|
||||
box_->SubviewFocused(chatEdit_);
|
||||
root_->SetFocus();
|
||||
#else
|
||||
root_->SetDefaultFocusView(box_);
|
||||
#endif
|
||||
UpdateChat();
|
||||
chatScreenVisible = true;
|
||||
newChat = 0;
|
||||
|
@ -84,6 +84,8 @@
|
||||
AVIDump avi;
|
||||
#endif
|
||||
|
||||
UI::ChoiceWithValueDisplay *chatButtons;
|
||||
|
||||
static bool frameStep_;
|
||||
static int lastNumFlips;
|
||||
static bool startDumping;
|
||||
@ -373,6 +375,10 @@ void EmuScreen::sendMessage(const char *message, const char *value) {
|
||||
}
|
||||
} else if (!strcmp(message, "chat screen")) {
|
||||
releaseButtons();
|
||||
//temporary workaround for hotkey its freeze the ui when open using hotkey and native keyboard is enable
|
||||
if (g_Config.bBypassOSKWithKeyboard) osm.Show("Disable windows native keyboard options to use ctrl + c hotkey", 2.0f);
|
||||
else
|
||||
chatButtons->SetVisibility(UI::V_GONE);
|
||||
screenManager()->push(new ChatMenu());
|
||||
}
|
||||
}
|
||||
@ -782,8 +788,36 @@ void EmuScreen::CreateViews() {
|
||||
root_->Add(new Button("DevMenu"))->OnClick.Handle(this, &EmuScreen::OnDevTools);
|
||||
}
|
||||
if (g_Config.bEnableNetworkChat) {
|
||||
//root_->Add(new Button(sc->T("Chat"), new AnchorLayoutParams(50, NONE, NONE, 50, true)))->OnClick.Handle(this, &EmuScreen::OnChat);
|
||||
root_->Add(new ChoiceWithValueDisplay(&newChat, sc->T("Chat"), new AnchorLayoutParams(130,WRAP_CONTENT,80, NONE, NONE, 50, true)))->OnClick.Handle(this, &EmuScreen::OnChat);
|
||||
switch (g_Config.iChatButtonPosition) {
|
||||
case 0:
|
||||
chatButtons = new ChoiceWithValueDisplay(&newChat, sc->T("Chat"), new AnchorLayoutParams(130, WRAP_CONTENT, 80, NONE, NONE, 50, true));
|
||||
break;
|
||||
case 1:
|
||||
chatButtons = new ChoiceWithValueDisplay(&newChat, sc->T("Chat"), new AnchorLayoutParams(130, WRAP_CONTENT, bounds.centerX(), NONE, NONE, 50, true));
|
||||
break;
|
||||
case 2:
|
||||
chatButtons = new ChoiceWithValueDisplay(&newChat, sc->T("Chat"), new AnchorLayoutParams(130, WRAP_CONTENT, NONE, NONE, 80, 50, true));
|
||||
break;
|
||||
case 3:
|
||||
chatButtons = new ChoiceWithValueDisplay(&newChat, sc->T("Chat"), new AnchorLayoutParams(130, WRAP_CONTENT, 80, 50, NONE, NONE, true));
|
||||
case 4:
|
||||
chatButtons = new ChoiceWithValueDisplay(&newChat, sc->T("Chat"), new AnchorLayoutParams(130, WRAP_CONTENT, bounds.centerX(), 50, NONE, NONE, true));
|
||||
break;
|
||||
case 5:
|
||||
chatButtons = new ChoiceWithValueDisplay(&newChat, sc->T("Chat"), new AnchorLayoutParams(130, WRAP_CONTENT, NONE, 50, 80, NONE, true));
|
||||
break;
|
||||
case 6:
|
||||
chatButtons = new ChoiceWithValueDisplay(&newChat, sc->T("Chat"), new AnchorLayoutParams(130, WRAP_CONTENT, 80, bounds.centerY(), NONE, NONE, true));
|
||||
break;
|
||||
case 7:
|
||||
chatButtons = new ChoiceWithValueDisplay(&newChat, sc->T("Chat"), new AnchorLayoutParams(130, WRAP_CONTENT, NONE, bounds.centerY(), 80, NONE, true));
|
||||
break;
|
||||
default:
|
||||
chatButtons = new ChoiceWithValueDisplay(&newChat, sc->T("Chat"), new AnchorLayoutParams(130, WRAP_CONTENT, 80, NONE, NONE, 50, true));
|
||||
break;
|
||||
}
|
||||
|
||||
root_->Add(chatButtons)->OnClick.Handle(this, &EmuScreen::OnChat);
|
||||
}
|
||||
saveStatePreview_ = new AsyncImageFileView("", IS_FIXED, nullptr, new AnchorLayoutParams(bounds.centerX(), 100, NONE, NONE, true));
|
||||
saveStatePreview_->SetFixedSize(160, 90);
|
||||
@ -805,6 +839,7 @@ UI::EventReturn EmuScreen::OnDevTools(UI::EventParams ¶ms) {
|
||||
|
||||
UI::EventReturn EmuScreen::OnChat(UI::EventParams ¶ms) {
|
||||
releaseButtons();
|
||||
if(chatButtons->GetVisibility() == UI::V_VISIBLE) chatButtons->SetVisibility(UI::V_GONE);
|
||||
screenManager()->push(new ChatMenu());
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
@ -898,6 +933,7 @@ void EmuScreen::update() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void EmuScreen::checkPowerDown() {
|
||||
|
@ -620,7 +620,10 @@ void GameSettingsScreen::CreateViews() {
|
||||
networkingSettings->Add(new ChoiceWithValueDisplay(&g_Config.sMACAddress, n->T("Change Mac Address"), nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeMacAddress);
|
||||
networkingSettings->Add(new PopupSliderChoice(&g_Config.iPortOffset, 0, 60000, n->T("Port offset", "Port offset(0 = PSP compatibility)"), 100, screenManager()));
|
||||
networkingSettings->Add(new CheckBox(&g_Config.bEnableNetworkChat, n->T("Enable network chat", "Enable network chat")));
|
||||
|
||||
static const char *chatButtonPositions[] = { "Bottom Left", "Bottom Center","Bottom Right","Top Left","Top Center", "Top Right","Center Left","Center Right" };
|
||||
networkingSettings->Add(new PopupMultiChoice(&g_Config.iChatButtonPosition, n->T("Chat Button Position"), chatButtonPositions, 0, ARRAY_SIZE(chatButtonPositions), "Chat Button Position", screenManager()));
|
||||
static const char *chatScreenPositions[] = { "Bottom Left", "Bottom Center","Bottom Right","Top Left","Top Center", "Top Right" };
|
||||
networkingSettings->Add(new PopupMultiChoice(&g_Config.iChatScreenPosition, n->T("Chat Screen Position"), chatScreenPositions, 0, ARRAY_SIZE(chatScreenPositions), "Chat Screen Position", screenManager()));
|
||||
ViewGroup *toolsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
toolsScroll->SetTag("GameSettingsTools");
|
||||
LinearLayout *tools = new LinearLayout(ORIENT_VERTICAL);
|
||||
|
Loading…
Reference in New Issue
Block a user