Skip to content

Commit

Permalink
Added setKeyboardElement
Browse files Browse the repository at this point in the history
  • Loading branch information
gogoprog committed Jan 9, 2018
1 parent fb85561 commit 231c9a8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/application/application_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <Urho3D/Urho2D/PhysicsEvents2D.h>
#include <Urho3D/Urho2D/RigidBody2D.h>
#include <Urho3D/Urho2D/StaticSprite2D.h>
#include <SDL/SDL.h>

#define STRING(src) \
#src
Expand Down Expand Up @@ -179,6 +180,11 @@ Node & App::createNode()
return * scene->CreateChild();
}

void App::setKeyboardElement(const Urho3D::String & str)
{
SDL_SetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT, str.CString());
}

void App::update(StringHash eventType, VariantMap& eventData)
{
ss.str("");
Expand Down
2 changes: 2 additions & 0 deletions src/application/application_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class App : public Urho3D::Application
void setStartupString(const Urho3D::String & str);
const Urho3D::String & getStartupString() { return startupString; }

void setKeyboardElement(const Urho3D::String & str);

void update(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData);
void onPhysicsBeginContact2D(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData);

Expand Down
1 change: 1 addition & 0 deletions src/bindings/bindings_application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ EMBINDCEFV8_BINDINGS(application)
.method("takeScreenshot", &App::takeScreenshot)
.method("setGuiFilename", &App::setGuiFilename)
.method("setWindowSize", &App::setWindowSize)
.method("setKeyboardElement", &App::setKeyboardElement)
;
}
2 changes: 2 additions & 0 deletions src/haxe/gengine/Gengine.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ extern class Gengine
static public function setWindowSize(size:IntVector2):Void;
static public function setWindowTitle(title:String):Void;

static public function setKeyboardElement(element:String):Void;

static public function takeScreenshot(filename:String):Void;
static public function setGuiFilename(filename:String):Void;

Expand Down

0 comments on commit 231c9a8

Please sign in to comment.