Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | soulldev |
I’m new to GDNative c++, i have a problem when calling Input::is_action_pressed(“ui_right”) :
void Player::_physics_process(float delta) {
bool right = Input::is_action_pressed("ui_right");
bool jump = Input::is_action_pressed("ui_up");
if (right)
motion.x = SPEED;
else if (left)
motion.x = -SPEED;
else
motion.x = 0;
}
I get this error code :
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
cl /Fosrc\gdlibrary.obj /c src\gdlibrary.cpp /TP /nologo -DWIN32 -D_WIN32 -D_WINDOWS -W3 -GR -D_CRT_SECURE_NO_WARNINGS -EHsc -D_DEBUG -MDd /I. /Igodot-cpp\godot_headers /Igodot-cpp\include /Igodot-cpp\include\core /Igodot-cpp\include\gen /Isrc
gdlibrary.cpp
cl /Fosrc\player.obj /c src\player.cpp /TP /nologo -DWIN32 -D_WIN32 -D_WINDOWS -W3 -GR -D_CRT_SECURE_NO_WARNINGS -EHsc -D_DEBUG -MDd /I. /Igodot-cpp\godot_headers /Igodot-cpp\include /Igodot-cpp\include\core /Igodot-cpp\include\gen /Isrc
player.cpp
src\player.cpp(25): error C2352: 'godot::Input::is_action_pressed': illegal call of non-static member function
c:\gdnative_cpp_example\godot-cpp\include\gen\Input.hpp(69): note: see declaration of 'godot::Input::is_action_pressed'
src\player.cpp(26): error C2352: 'godot::Input::is_action_pressed': illegal call of non-static member function
c:\gdnative_cpp_example\godot-cpp\include\gen\Input.hpp(69): note: see declaration of 'godot::Input::is_action_pressed'
src\player.cpp(27): error C2352: 'godot::Input::is_action_pressed': illegal call of non-static member function
c:\gdnative_cpp_example\godot-cpp\include\gen\Input.hpp(69): note: see declaration of 'godot::Input::is_action_pressed'
scons: *** [src\player.obj] Error 2
scons: building terminated because of errors.