mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
pointer and scroll fix
This commit is contained in:
parent
20b289c8ea
commit
766373e159
3 changed files with 17 additions and 34 deletions
|
@ -986,10 +986,12 @@ void freeFriendsRecursive(SceNetAdhocctlPeerInfo * node) {
|
|||
free(node);
|
||||
}
|
||||
|
||||
//@params chatmenu pass NULL on Hide , and pass ChatMenu On Create (EmuScreen.cpp)
|
||||
//@params chatmenu pass NULL on destroy, and pass ChatMenu On Create (EmuScreen.cpp)
|
||||
void setChatPointer(ChatMenu * chatmenu) {
|
||||
//set chatscreen instance
|
||||
ch = chatmenu;
|
||||
if (chatmenu != NULL) {
|
||||
delete ch;
|
||||
}
|
||||
ch = chatmenu; //setChatPointer
|
||||
}
|
||||
|
||||
void sendChat(std::string chatString) {
|
||||
|
@ -1012,8 +1014,9 @@ void sendChat(std::string chatString) {
|
|||
ch->UpdateChat();
|
||||
}
|
||||
}
|
||||
}else {
|
||||
chatLog.push_back("You're in Offline Mode, go to lobby or online hall"); // use this or osm better?
|
||||
}
|
||||
else {
|
||||
chatLog.push_back("You're in Offline Mode, go to lobby or online hall"); //need translation
|
||||
if (ch) {
|
||||
ch->UpdateChat();
|
||||
}
|
||||
|
@ -1120,12 +1123,7 @@ int friendFinder(){
|
|||
if (rxpos >= (int)sizeof(SceNetAdhocctlChatPacketS2C)) {
|
||||
// Cast Packet
|
||||
SceNetAdhocctlChatPacketS2C * packet = (SceNetAdhocctlChatPacketS2C *)rx;
|
||||
|
||||
// Fix for Idiots that try to troll the "ME" Nametag
|
||||
if (strcasecmp((char *)packet->name.data, "ME") == 0) strcpy((char *)packet->name.data, "NOT ME");
|
||||
|
||||
// Add Incoming Chat to HUD
|
||||
//printf("Receive chat message %s", packet->base.message);
|
||||
NOTICE_LOG(SCENET, "Received chat message %s", packet->base.message);
|
||||
incoming = "";
|
||||
name = (char *)packet->name.data;
|
||||
|
|
|
@ -55,15 +55,12 @@ void ChatMenu::CreateViews() {
|
|||
|
||||
CreatePopupContents(box_);
|
||||
root_->SetDefaultFocusView(box_);
|
||||
this->UpdateChat();
|
||||
UpdateChat();
|
||||
g_Config.iNewChat = 0;
|
||||
}
|
||||
|
||||
void ChatMenu::dialogFinished(const Screen *dialog, DialogResult result) {
|
||||
UpdateUIState(UISTATE_INGAME);
|
||||
// Close when a subscreen got closed.
|
||||
// TODO: a bug in screenmanager causes this not to work here.
|
||||
// screenManager()->finishDialog(this, DR_OK);
|
||||
}
|
||||
|
||||
UI::EventReturn ChatMenu::OnSubmit(UI::EventParams &e) {
|
||||
|
@ -84,7 +81,7 @@ std::vector<std::string> Split(const std::string& str)
|
|||
int counter = 0;
|
||||
int firstSentenceEnd = 0;
|
||||
int secondSentenceEnd = 0;
|
||||
NOTICE_LOG(HLE, "Splitted %s %i", str.c_str(),str.size());
|
||||
//NOTICE_LOG(HLE, "Splitted %s %i", str.c_str(),str.size());
|
||||
for (auto i = 0; i<str.length(); i++) {
|
||||
if (isspace(str[i])) {
|
||||
if (i < 35) {
|
||||
|
@ -131,7 +128,7 @@ void ChatMenu::UpdateChat() {
|
|||
v->SetTextColor(0xFF000000 | color);
|
||||
}
|
||||
}
|
||||
this->ScrollChat();
|
||||
toBottom_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,29 +139,20 @@ bool ChatMenu::touch(const TouchInput &touch) {
|
|||
|
||||
if (!box_->GetBounds().Contains(touch.x, touch.y)){
|
||||
screenManager()->finishDialog(this, DR_BACK);
|
||||
setChatPointer(NULL); //fix the random crash
|
||||
}
|
||||
|
||||
return UIDialogScreen::touch(touch);
|
||||
}
|
||||
|
||||
void ChatMenu::update(InputState &input) {
|
||||
PopupScreen::update(input);
|
||||
this->ScrollChat();
|
||||
}
|
||||
|
||||
void ChatMenu::sendMessage(const char *message, const char *value) {
|
||||
// Always call the base class method first to handle the most common messages.
|
||||
PopupScreen::sendMessage(message, value);
|
||||
this->ScrollChat();
|
||||
}
|
||||
|
||||
void ChatMenu::ScrollChat() {
|
||||
if (scroll_) {
|
||||
void ChatMenu::postRender() {
|
||||
if (scroll_ && toBottom_) {
|
||||
scroll_->ScrollToBottom();
|
||||
toBottom_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
ChatMenu::~ChatMenu() {
|
||||
setChatPointer(NULL);
|
||||
scroll_ = NULL;
|
||||
chatVert_ = NULL;
|
||||
}
|
||||
|
|
|
@ -10,11 +10,8 @@ public:
|
|||
void CreateViews() override;
|
||||
void dialogFinished(const Screen *dialog, DialogResult result) override;
|
||||
bool touch(const TouchInput &touch) override;
|
||||
void update(InputState &input) override;
|
||||
void postRender() override;
|
||||
void UpdateChat();
|
||||
void ScrollChat();
|
||||
protected:
|
||||
virtual void sendMessage(const char *message, const char *value);
|
||||
private:
|
||||
UI::EventReturn OnSubmit(UI::EventParams &e);
|
||||
UI::TextEdit *chatEdit_;
|
||||
|
|
Loading…
Add table
Reference in a new issue