I wrote simple app based on web sample and realized it doesnt detect keyboard input (I didn’t tested mouse and touch yet). Simplest code I made:
class Sim3D : public Application
{
Scene *scene_;
Node *cameraNode_;
public:
Sim3D(Context *c) : Application(c) {}
void Setup() override
{
engineParameters_["Fullscreen"] = false;
engineParameters_["WindowWidth"] = 1024;
engineParameters_["WindowWidth"] = 720;
engineParameters_["WindowResizable"] = true;
}
void OnKeyDownDebug(StringHash evType, VariantMap &evData)
{
int key = evData[KeyDown::P_KEY].GetInt();
String name = GetSubsystem<Input>()->GetKeyName(key);
URHO3D_LOGINFO(name);
}
void Start() override
{
SubscribeToEvent(E_KEYDOWN, URHO3D_HANDLER(Sim3D, OnKeyDownDebug));
}
};
URHO3D_DEFINE_APPLICATION_MAIN(Sim3D)
Above is a test code I wrote after realizing GetKeyDown, called inside E_UPDATE handler, always return false. Handler itself was called properly.
No matter what I press, there is no output into console, except standard startup infos.
My CMakeLists.txt:
cmake_minimum_required(VERSION 3.0)
if (COMMAND cmake_policy)
# Libraries linked via full path no longer produce linker search paths
cmake_policy (SET CMP0003 NEW)
# INTERFACE_LINK_LIBRARIES defines the link interface
cmake_policy (SET CMP0022 NEW)
# MACOSX_RPATH is enabled by default
cmake_policy (SET CMP0042 NEW)
cmake_policy (SET CMP0063 NEW)
endif ()
project(Sim3D)
set (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
include (UrhoCommon)
# Define target name
set (TARGET_NAME Sim3D)
# Define source files
define_source_files (main.cpp)
# Setup target with resource copying
setup_main_executable ()