Fix textbox
This commit is contained in:
parent
04e4a2346d
commit
35858ef607
@ -32,6 +32,7 @@ SDL_Surface * SDLOpen()
|
||||
fprintf(stderr, "Initializing SDL: %s\n", SDL_GetError());
|
||||
return 0;
|
||||
}
|
||||
SDL_EnableUNICODE(1);
|
||||
#if defined(WIN32) && defined(WINCONSOLE)
|
||||
//On Windows, SDL redirects stdout to stdout.txt, which can be annoying when debugging, here we redirect back to the console
|
||||
if (console)
|
||||
@ -84,7 +85,7 @@ int main(int argc, char * argv[])
|
||||
engine->Exit();
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
engine->onKeyPress(event.key.keysym.sym, false, false, false);
|
||||
engine->onKeyPress(event.key.keysym.unicode, false, false, false);
|
||||
break;
|
||||
case SDL_KEYUP:
|
||||
break;
|
||||
@ -133,7 +134,14 @@ int main(int argc, char * argv[])
|
||||
fps = (((float)currentFrame)/((float)elapsedTime))*1000.0f;
|
||||
currentFrame = 0;
|
||||
lastTime = currentTime;
|
||||
delta = 60.0f/fps;
|
||||
if(ui::Engine::Ref().FpsLimit > 2.0f)
|
||||
{
|
||||
delta = ui::Engine::Ref().FpsLimit/fps;
|
||||
}
|
||||
else
|
||||
{
|
||||
delta = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
|
@ -20,7 +20,7 @@
|
||||
Client::Client()
|
||||
{
|
||||
int i = 0;
|
||||
http_init("wwwcache.lancs.ac.uk:8080");
|
||||
http_init(NULL);
|
||||
for(i = 0; i < THUMB_CACHE_SIZE; i++)
|
||||
{
|
||||
thumbnailCache[i] = NULL;
|
||||
|
@ -28,14 +28,22 @@ GameController::~GameController()
|
||||
{
|
||||
if(search)
|
||||
{
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
if(ui::Engine::Ref().GetWindow() == search->GetView())
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
delete search;
|
||||
}
|
||||
if(renderOptions)
|
||||
{
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
if(ui::Engine::Ref().GetWindow() == renderOptions->GetView())
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
delete renderOptions;
|
||||
}
|
||||
if(loginWindow)
|
||||
{
|
||||
if(ui::Engine::Ref().GetWindow() == loginWindow->GetView())
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
delete loginWindow;
|
||||
}
|
||||
delete gameView;
|
||||
delete gameModel;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ void Engine::Tick(float dt)
|
||||
{
|
||||
state_->Position.Y += windowTargetPosition.Y/20;
|
||||
}*/
|
||||
windowOpenState += 0.05f*dt;
|
||||
windowOpenState += 0.05f;//*dt;
|
||||
}
|
||||
|
||||
/*if(statequeued_ != NULL)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include "Config.h"
|
||||
#include "Global.h"
|
||||
@ -157,6 +158,7 @@ void Textbox::OnKeyPress(int key, bool shift, bool ctrl, bool alt)
|
||||
if(cursor == text.length())
|
||||
{
|
||||
text += key;
|
||||
//std::cout << key << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -22,7 +22,18 @@ void LoginController::Login(string username, string password)
|
||||
loginModel->Login(username, password);
|
||||
}
|
||||
|
||||
LoginController::~LoginController() {
|
||||
// TODO Auto-generated destructor stub
|
||||
void LoginController::Exit()
|
||||
{
|
||||
if(ui::Engine::Ref().GetWindow() == loginView)
|
||||
{
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
loginView = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
LoginController::~LoginController() {
|
||||
if(loginView)
|
||||
delete loginView;
|
||||
delete loginModel;
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ class LoginController {
|
||||
public:
|
||||
LoginController();
|
||||
void Login(string username, string password);
|
||||
void Exit();
|
||||
LoginView * GetView() { return loginView; }
|
||||
|
||||
virtual ~LoginController();
|
||||
|
@ -18,6 +18,17 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class LoginView::CancelAction : public ui::ButtonAction
|
||||
{
|
||||
LoginView * v;
|
||||
public:
|
||||
CancelAction(LoginView * _v) { v = _v; }
|
||||
void ActionCallback(ui::Button * sender)
|
||||
{
|
||||
v->c->Exit();
|
||||
}
|
||||
};
|
||||
|
||||
LoginView::LoginView():
|
||||
ui::Window(ui::Point(-1, -1), ui::Point(200, 100)),
|
||||
loginButton(new ui::Button(ui::Point(200-50, 100-16), ui::Point(50, 16), "Login")),
|
||||
@ -32,6 +43,7 @@ LoginView::LoginView():
|
||||
loginButton->SetActionCallback(new LoginAction(this));
|
||||
AddComponent(cancelButton);
|
||||
cancelButton->SetAlignment(AlignCentre, AlignBottom);
|
||||
cancelButton->SetActionCallback(new CancelAction(this));
|
||||
AddComponent(titleLabel);
|
||||
titleLabel->SetAlignment(AlignLeft, AlignBottom);
|
||||
AddComponent(usernameField);
|
||||
|
@ -27,6 +27,7 @@ class LoginView: public ui::Window {
|
||||
ui::Textbox * passwordField;
|
||||
public:
|
||||
class LoginAction;
|
||||
class CancelAction;
|
||||
LoginView();
|
||||
void AttachController(LoginController * c_) { c = c_; }
|
||||
void NotifyStatusChanged(LoginModel * sender);
|
||||
|
Reference in New Issue
Block a user