mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:44:01 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into lobby
This commit is contained in:
commit
d5a3ea77ff
17 changed files with 206 additions and 22 deletions
47
examples/guidedTour.js
Normal file
47
examples/guidedTour.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
//
|
||||
// TourGuide.js
|
||||
//
|
||||
// This script will follow another person, if their display name is "Tour Guide"
|
||||
//
|
||||
var leaderName = "Tour Guide";
|
||||
|
||||
var guide;
|
||||
var isGuide = false;
|
||||
var lastGuidePosition = { x:0, y:0, z:0 };
|
||||
var MIN_CHANGE = 2.0;
|
||||
var LANDING_DISTANCE = 2.0;
|
||||
var LANDING_RANDOM = 0.2;
|
||||
|
||||
function update(deltaTime) {
|
||||
|
||||
if (Math.random() < deltaTime) {
|
||||
guide = AvatarList.avatarWithDisplayName(leaderName);
|
||||
if (guide && !isGuide) {
|
||||
print("found a guide!");
|
||||
isGuide = true;
|
||||
} else if (!isGuide) {
|
||||
print("Lost My Guide");
|
||||
isguide = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (guide) {
|
||||
// Check whether guide has moved, update if so
|
||||
if (Vec3.length(lastGuidePosition) == 0.0) {
|
||||
lastGuidePosition = guide.position;
|
||||
} else {
|
||||
if (Vec3.length(Vec3.subtract(lastGuidePosition, guide.position)) > MIN_CHANGE) {
|
||||
var meToGuide = Vec3.multiply(Vec3.normalize(Vec3.subtract(guide.position, MyAvatar.position)), LANDING_DISTANCE);
|
||||
var newPosition = Vec3.subtract(guide.position, meToGuide);
|
||||
newPosition = Vec3.sum(newPosition, { x: Math.random() * LANDING_RANDOM - LANDING_RANDOM / 2.0,
|
||||
y: 0,
|
||||
z: Math.random() * LANDING_RANDOM - LANDING_RANDOM / 2.0 });
|
||||
MyAvatar.position = newPosition;
|
||||
|
||||
lastGuidePosition = guide.position;
|
||||
MyAvatar.orientation = guide.orientation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Script.update.connect(update);
|
|
@ -142,7 +142,7 @@ function update(deltaTime) {
|
|||
}
|
||||
|
||||
Controller.keyPressEvent.connect(function(event) {
|
||||
if (event.text == "SPACE" && !movingWithHead) {
|
||||
if (event.text == "SPACE" && !event.isAutoRepeat && !movingWithHead) {
|
||||
keyDownTime = 0.0;
|
||||
movingWithHead = true;
|
||||
headStartPosition = MyAvatar.getTrackedHeadPosition();
|
||||
|
@ -161,7 +161,7 @@ var TIME_FOR_TURN = 0.25;
|
|||
var TURN_AROUND = 180.0;
|
||||
|
||||
Controller.keyReleaseEvent.connect(function(event) {
|
||||
if (event.text == "SPACE") {
|
||||
if (event.text == "SPACE" && !event.isAutoRepeat) {
|
||||
movingWithHead = false;
|
||||
if (keyDownTime < TIME_FOR_TURN_AROUND) {
|
||||
if (keyDownTime < TIME_FOR_TURN) {
|
||||
|
|
|
@ -33,7 +33,7 @@ elseif (WIN32)
|
|||
add_definitions(-D_USE_MATH_DEFINES) # apparently needed to get M_PI and other defines from cmath/math.h
|
||||
add_definitions(-DWINDOWS_LEAN_AND_MEAN) # needed to make sure windows doesn't go to crazy with its defines
|
||||
|
||||
set(GL_HEADERS "#include <windowshacks.h>\n#include <GL/glew.h>\n#include <GL/glut.h>")
|
||||
set(GL_HEADERS "#include <windowshacks.h>\n#include <GL/glew.h>\n#include <GL/glut.h>\n#include <GL/wglew.h>")
|
||||
endif ()
|
||||
|
||||
# set up the external glm library
|
||||
|
|
|
@ -179,8 +179,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
_trayIcon(new QSystemTrayIcon(_window)),
|
||||
_lastNackTime(usecTimestampNow()),
|
||||
_lastSendDownstreamAudioStats(usecTimestampNow()),
|
||||
_renderTargetFramerate(0),
|
||||
_isVSyncOn(true),
|
||||
_renderResolutionScale(1.0f)
|
||||
{
|
||||
|
||||
// read the ApplicationInfo.ini file for Name/Version/Domain information
|
||||
QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
|
||||
|
||||
|
@ -520,8 +523,20 @@ void Application::initializeGL() {
|
|||
qDebug("Error: %s\n", glewGetErrorString(err));
|
||||
}
|
||||
qDebug("Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));
|
||||
|
||||
if (wglewGetExtension("WGL_EXT_swap_control")) {
|
||||
int swapInterval = wglGetSwapIntervalEXT();
|
||||
qDebug("V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
// TODO: Write the correct code for Linux...
|
||||
/* if (wglewGetExtension("WGL_EXT_swap_control")) {
|
||||
int swapInterval = wglGetSwapIntervalEXT();
|
||||
qDebug("V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
|
||||
}*/
|
||||
#endif
|
||||
|
||||
// Before we render anything, let's set up our viewFrustumOffsetCamera with a sufficiently large
|
||||
// field of view and near and far clip to make it interesting.
|
||||
|
@ -1393,9 +1408,14 @@ void Application::idle() {
|
|||
PerformanceWarning warn(showWarnings, "idle()");
|
||||
|
||||
// Only run simulation code if more than IDLE_SIMULATE_MSECS have passed since last time we ran
|
||||
|
||||
double targetFramePeriod = 0.0;
|
||||
if (_renderTargetFramerate > 0) {
|
||||
targetFramePeriod = 1000.0 / _renderTargetFramerate;
|
||||
} else if (_renderTargetFramerate < 0) {
|
||||
targetFramePeriod = IDLE_SIMULATE_MSECS;
|
||||
}
|
||||
double timeSinceLastUpdate = (double)_lastTimeUpdated.nsecsElapsed() / 1000000.0;
|
||||
if (timeSinceLastUpdate > IDLE_SIMULATE_MSECS) {
|
||||
if (timeSinceLastUpdate > targetFramePeriod) {
|
||||
_lastTimeUpdated.start();
|
||||
{
|
||||
PerformanceTimer perfTimer("update");
|
||||
|
@ -3085,7 +3105,6 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) {
|
|||
// if not rendering the billboard, the region is in device independent coordinates; must convert to device
|
||||
QSize size = getTextureCache()->getFrameBufferSize();
|
||||
float ratio = QApplication::desktop()->windowHandle()->devicePixelRatio();
|
||||
ratio = size.height() / (float)_glWidget->getDeviceHeight();
|
||||
int x = region.x() * ratio, y = region.y() * ratio, width = region.width() * ratio, height = region.height() * ratio;
|
||||
glViewport(x, size.height() - y - height, width, height);
|
||||
glScissor(x, size.height() - y - height, width, height);
|
||||
|
@ -4143,6 +4162,53 @@ void Application::takeSnapshot() {
|
|||
_snapshotShareDialog->show();
|
||||
}
|
||||
|
||||
void Application::setRenderTargetFramerate(unsigned int framerate, bool vsyncOn) {
|
||||
if (vsyncOn != _isVSyncOn) {
|
||||
#if defined(Q_OS_WIN)
|
||||
if (wglewGetExtension("WGL_EXT_swap_control")) {
|
||||
wglSwapIntervalEXT(vsyncOn);
|
||||
int swapInterval = wglGetSwapIntervalEXT();
|
||||
_isVSyncOn = swapInterval;
|
||||
qDebug("V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
|
||||
} else {
|
||||
qDebug("V-Sync is FORCED ON on this system\n");
|
||||
}
|
||||
#elif defined(Q_OS_LINUX)
|
||||
// TODO: write the poper code for linux
|
||||
/*
|
||||
if (glQueryExtension.... ("GLX_EXT_swap_control")) {
|
||||
glxSwapIntervalEXT(vsyncOn);
|
||||
int swapInterval = xglGetSwapIntervalEXT();
|
||||
_isVSyncOn = swapInterval;
|
||||
qDebug("V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
|
||||
} else {
|
||||
qDebug("V-Sync is FORCED ON on this system\n");
|
||||
}
|
||||
*/
|
||||
#else
|
||||
qDebug("V-Sync is FORCED ON on this system\n");
|
||||
#endif
|
||||
}
|
||||
_renderTargetFramerate = framerate;
|
||||
}
|
||||
|
||||
bool Application::isVSyncEditable() {
|
||||
#if defined(Q_OS_WIN)
|
||||
if (wglewGetExtension("WGL_EXT_swap_control")) {
|
||||
return true;
|
||||
}
|
||||
#elif defined(Q_OS_LINUX)
|
||||
// TODO: write the poper code for linux
|
||||
/*
|
||||
if (glQueryExtension.... ("GLX_EXT_swap_control")) {
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
#else
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
void Application::setRenderResolutionScale(float scale) {
|
||||
_renderResolutionScale = scale;
|
||||
}
|
||||
|
|
|
@ -361,6 +361,11 @@ public slots:
|
|||
|
||||
void domainSettingsReceived(const QJsonObject& domainSettingsObject);
|
||||
|
||||
void setRenderTargetFramerate(unsigned int framerate, bool vsyncOn = true);
|
||||
bool isVSyncOn() { return _isVSyncOn; }
|
||||
bool isVSyncEditable();
|
||||
unsigned int getRenderTargetFramerate() const { return _renderTargetFramerate; }
|
||||
|
||||
void setRenderResolutionScale(float scale);
|
||||
|
||||
void resetSensors();
|
||||
|
@ -613,6 +618,8 @@ private:
|
|||
quint64 _lastNackTime;
|
||||
quint64 _lastSendDownstreamAudioStats;
|
||||
|
||||
int _renderTargetFramerate;
|
||||
bool _isVSyncOn;
|
||||
float _renderResolutionScale;
|
||||
};
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
const int MSECS_PER_FRAME_WHEN_THROTTLED = 66;
|
||||
|
||||
GLCanvas::GLCanvas() : QGLWidget(QGLFormat(QGL::NoDepthBuffer)),
|
||||
GLCanvas::GLCanvas() : QGLWidget(QGL::NoDepthBuffer | QGL::NoStencilBuffer),
|
||||
_throttleRendering(false),
|
||||
_idleRenderInterval(MSECS_PER_FRAME_WHEN_THROTTLED)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ Hair::Hair(int strands,
|
|||
_acceleration(0.0f),
|
||||
_angularVelocity(0.0f),
|
||||
_angularAcceleration(0.0f),
|
||||
_gravity(0.0f),
|
||||
_gravity(DEFAULT_GRAVITY),
|
||||
_loudness(0.0f)
|
||||
{
|
||||
_hairPosition = new glm::vec3[_strands * _links];
|
||||
|
@ -53,7 +53,7 @@ Hair::Hair(int strands,
|
|||
for (int strand = 0; strand < _strands; strand++) {
|
||||
float strandAngle = randFloat() * PI;
|
||||
float azimuth;
|
||||
float elevation = PI_OVER_TWO - (randFloat() * 0.10f * PI);
|
||||
float elevation = - (randFloat() * PI);
|
||||
azimuth = PI_OVER_TWO;
|
||||
if (randFloat() < 0.5f) {
|
||||
azimuth *= -1.0f;
|
||||
|
@ -127,7 +127,7 @@ void Hair::simulate(float deltaTime) {
|
|||
_hairPosition[vertexIndex] += randVector() * (QUIESCENT_LOUDNESS + loudnessFactor) * ((float)link / (float)_links);
|
||||
|
||||
// Add gravity
|
||||
const float SCALE_GRAVITY = 0.13f;
|
||||
const float SCALE_GRAVITY = 0.001f;
|
||||
_hairPosition[vertexIndex] += _gravity * deltaTime * SCALE_GRAVITY;
|
||||
|
||||
// Add linear acceleration
|
||||
|
|
|
@ -25,9 +25,10 @@ const int HAIR_CONSTRAINTS = 2;
|
|||
|
||||
const int DEFAULT_HAIR_STRANDS = 20;
|
||||
const int DEFAULT_HAIR_LINKS = 10;
|
||||
const float DEFAULT_HAIR_RADIUS = 0.15f;
|
||||
const float DEFAULT_HAIR_RADIUS = 0.075f;
|
||||
const float DEFAULT_HAIR_LINK_LENGTH = 0.06f;
|
||||
const float DEFAULT_HAIR_THICKNESS = 0.025f;
|
||||
const glm::vec3 DEFAULT_GRAVITY(0.0f, -9.8f, 0.0f);
|
||||
|
||||
class Hair {
|
||||
public:
|
||||
|
@ -41,7 +42,6 @@ public:
|
|||
void setAcceleration(const glm::vec3& acceleration) { _acceleration = acceleration; }
|
||||
void setAngularVelocity(const glm::vec3& angularVelocity) { _angularVelocity = angularVelocity; }
|
||||
void setAngularAcceleration(const glm::vec3& angularAcceleration) { _angularAcceleration = angularAcceleration; }
|
||||
void setGravity(const glm::vec3& gravity) { _gravity = gravity; }
|
||||
void setLoudness(const float loudness) { _loudness = loudness; }
|
||||
|
||||
private:
|
||||
|
|
|
@ -373,6 +373,24 @@ Menu::Menu() :
|
|||
shadowGroup->addAction(addCheckableActionToQMenuAndActionHash(shadowMenu, MenuOption::SimpleShadows, 0, false));
|
||||
shadowGroup->addAction(addCheckableActionToQMenuAndActionHash(shadowMenu, MenuOption::CascadedShadows, 0, false));
|
||||
|
||||
{
|
||||
QMenu* framerateMenu = renderOptionsMenu->addMenu(MenuOption::RenderTargetFramerate);
|
||||
QActionGroup* framerateGroup = new QActionGroup(framerateMenu);
|
||||
|
||||
framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerateUnlimited, 0, true));
|
||||
framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerate60, 0, false));
|
||||
framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerate50, 0, false));
|
||||
framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerate40, 0, false));
|
||||
framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerate30, 0, false));
|
||||
connect(framerateMenu, SIGNAL(triggered(QAction*)), this, SLOT(changeRenderTargetFramerate(QAction*)));
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
#else
|
||||
QAction* vsyncAction = addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::RenderTargetFramerateVSyncOn, 0, true, this, SLOT(changeVSync()));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
QMenu* resolutionMenu = renderOptionsMenu->addMenu(MenuOption::RenderResolution);
|
||||
QActionGroup* resolutionGroup = new QActionGroup(resolutionMenu);
|
||||
resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionOne, 0, false));
|
||||
|
@ -1235,6 +1253,33 @@ void Menu::muteEnvironment() {
|
|||
free(packet);
|
||||
}
|
||||
|
||||
void Menu::changeVSync() {
|
||||
Application::getInstance()->setRenderTargetFramerate(
|
||||
Application::getInstance()->getRenderTargetFramerate(),
|
||||
isOptionChecked(MenuOption::RenderTargetFramerateVSyncOn));
|
||||
}
|
||||
void Menu::changeRenderTargetFramerate(QAction* action) {
|
||||
bool vsynOn = Application::getInstance()->isVSyncOn();
|
||||
unsigned int framerate = Application::getInstance()->getRenderTargetFramerate();
|
||||
|
||||
QString text = action->text();
|
||||
if (text == MenuOption::RenderTargetFramerateUnlimited) {
|
||||
Application::getInstance()->setRenderTargetFramerate(0, vsynOn);
|
||||
}
|
||||
else if (text == MenuOption::RenderTargetFramerate60) {
|
||||
Application::getInstance()->setRenderTargetFramerate(60, vsynOn);
|
||||
}
|
||||
else if (text == MenuOption::RenderTargetFramerate50) {
|
||||
Application::getInstance()->setRenderTargetFramerate(50, vsynOn);
|
||||
}
|
||||
else if (text == MenuOption::RenderTargetFramerate40) {
|
||||
Application::getInstance()->setRenderTargetFramerate(40, vsynOn);
|
||||
}
|
||||
else if (text == MenuOption::RenderTargetFramerate30) {
|
||||
Application::getInstance()->setRenderTargetFramerate(30, vsynOn);
|
||||
}
|
||||
}
|
||||
|
||||
void Menu::changeRenderResolution(QAction* action) {
|
||||
QString text = action->text();
|
||||
if (text == MenuOption::RenderResolutionOne) {
|
||||
|
|
|
@ -229,6 +229,8 @@ private slots:
|
|||
void displayAddressOfflineMessage();
|
||||
void displayAddressNotFoundMessage();
|
||||
void muteEnvironment();
|
||||
void changeRenderTargetFramerate(QAction* action);
|
||||
void changeVSync();
|
||||
void changeRenderResolution(QAction* action);
|
||||
|
||||
private:
|
||||
|
@ -452,6 +454,14 @@ namespace MenuOption {
|
|||
const QString RenderHeightfields = "Render Heightfields";
|
||||
const QString RenderLookAtVectors = "Show Look-at Vectors";
|
||||
const QString RenderSkeletonCollisionShapes = "Show Skeleton Collision Shapes";
|
||||
const QString RenderTargetFramerate = "Framerate";
|
||||
const QString RenderTargetFramerateUnlimited = "Unlimited";
|
||||
const QString RenderTargetFramerate60 = "60";
|
||||
const QString RenderTargetFramerate50 = "50";
|
||||
const QString RenderTargetFramerate40 = "40";
|
||||
const QString RenderTargetFramerate30 = "30";
|
||||
const QString RenderTargetFramerateVSyncOn = "V-Sync On";
|
||||
|
||||
const QString RenderResolution = "Scale Resolution";
|
||||
const QString RenderResolutionOne = "1";
|
||||
const QString RenderResolutionTwoThird = "2/3";
|
||||
|
|
|
@ -110,11 +110,9 @@ int SimulateVisitor::visit(MetavoxelInfo& info) {
|
|||
void MetavoxelSystem::simulate(float deltaTime) {
|
||||
// update the lod
|
||||
{
|
||||
// the LOD threshold is temporarily tied to the avatar LOD parameter
|
||||
QWriteLocker locker(&_lodLock);
|
||||
const float BASE_LOD_THRESHOLD = 0.01f;
|
||||
_lod = MetavoxelLOD(Application::getInstance()->getCamera()->getPosition(),
|
||||
BASE_LOD_THRESHOLD * Menu::getInstance()->getAvatarLODDistanceMultiplier());
|
||||
const float DEFAULT_LOD_THRESHOLD = 0.01f;
|
||||
_lod = MetavoxelLOD(Application::getInstance()->getCamera()->getPosition(), DEFAULT_LOD_THRESHOLD);
|
||||
}
|
||||
|
||||
SimulateVisitor simulateVisitor(deltaTime, getLOD());
|
||||
|
|
|
@ -191,7 +191,6 @@ void Avatar::simulate(float deltaTime) {
|
|||
_hair.setAcceleration(getAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setAngularVelocity((getAngularVelocity() + getHead()->getAngularVelocity()) * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setAngularAcceleration(getAngularAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setGravity(Application::getInstance()->getEnvironment()->getGravity(getPosition()) * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setLoudness((float) getHeadData()->getAudioLoudness());
|
||||
_hair.simulate(deltaTime);
|
||||
}
|
||||
|
|
|
@ -217,7 +217,6 @@ void MyAvatar::simulate(float deltaTime) {
|
|||
_hair.setAcceleration(getAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setAngularVelocity((getAngularVelocity() + getHead()->getAngularVelocity()) * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setAngularAcceleration(getAngularAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setGravity(Application::getInstance()->getEnvironment()->getGravity(getPosition()) * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setLoudness((float)getHeadData()->getAudioLoudness());
|
||||
_hair.simulate(deltaTime);
|
||||
}
|
||||
|
|
|
@ -45,9 +45,14 @@ void Joystick::closeJoystick() {
|
|||
|
||||
#ifdef HAVE_SDL2
|
||||
void Joystick::handleAxisEvent(const SDL_ControllerAxisEvent& event) {
|
||||
if (_axes.size() <= event.axis) {
|
||||
_axes.resize(event.axis + 1);
|
||||
}
|
||||
|
||||
float oldValue = _axes[event.axis];
|
||||
float newValue = event.value / MAX_AXIS;
|
||||
_axes[event.axis] = newValue;
|
||||
|
||||
emit axisValueChanged(event.axis, newValue, oldValue);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
//#define DO_IT_NOW(call, offset) runLastCommand();
|
||||
#define DO_IT_NOW(call, offset)
|
||||
|
||||
#define CHECK_GL_ERROR() ::gpu::backend::checkGLError()
|
||||
//#define CHECK_GL_ERROR() ::gpu::backend::checkGLError()
|
||||
#define CHECK_GL_ERROR()
|
||||
|
||||
using namespace gpu;
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@ KeyEvent::KeyEvent() :
|
|||
isMeta(false),
|
||||
isAlt(false),
|
||||
isKeypad(false),
|
||||
isValid(false)
|
||||
isValid(false),
|
||||
isAutoRepeat(false)
|
||||
{
|
||||
};
|
||||
|
||||
|
@ -44,6 +45,7 @@ KeyEvent::KeyEvent(const QKeyEvent& event) {
|
|||
isAlt = event.modifiers().testFlag(Qt::AltModifier);
|
||||
isKeypad = event.modifiers().testFlag(Qt::KeypadModifier);
|
||||
isValid = true;
|
||||
isAutoRepeat = event.isAutoRepeat();
|
||||
|
||||
// handle special text for special characters...
|
||||
if (key == Qt::Key_F1) {
|
||||
|
@ -127,7 +129,8 @@ bool KeyEvent::operator==(const KeyEvent& other) const {
|
|||
&& other.isControl == isControl
|
||||
&& other.isMeta == isMeta
|
||||
&& other.isAlt == isAlt
|
||||
&& other.isKeypad == isKeypad;
|
||||
&& other.isKeypad == isKeypad
|
||||
&& other.isAutoRepeat == isAutoRepeat;
|
||||
}
|
||||
|
||||
|
||||
|
@ -163,6 +166,7 @@ QScriptValue keyEventToScriptValue(QScriptEngine* engine, const KeyEvent& event)
|
|||
obj.setProperty("isControl", event.isControl);
|
||||
obj.setProperty("isAlt", event.isAlt);
|
||||
obj.setProperty("isKeypad", event.isKeypad);
|
||||
obj.setProperty("isAutoRepeat", event.isAutoRepeat);
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -173,6 +177,7 @@ void keyEventFromScriptValue(const QScriptValue& object, KeyEvent& event) {
|
|||
event.isControl = object.property("isControl").toVariant().toBool();
|
||||
event.isAlt = object.property("isAlt").toVariant().toBool();
|
||||
event.isKeypad = object.property("isKeypad").toVariant().toBool();
|
||||
event.isAutoRepeat = object.property("isAutoRepeat").toVariant().toBool();
|
||||
|
||||
QScriptValue key = object.property("key");
|
||||
if (key.isValid()) {
|
||||
|
@ -286,7 +291,8 @@ void keyEventFromScriptValue(const QScriptValue& object, KeyEvent& event) {
|
|||
<< " event.isControl=" << event.isControl
|
||||
<< " event.isMeta=" << event.isMeta
|
||||
<< " event.isAlt=" << event.isAlt
|
||||
<< " event.isKeypad=" << event.isKeypad;
|
||||
<< " event.isKeypad=" << event.isKeypad
|
||||
<< " event.isAutoRepeat=" << event.isAutoRepeat;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
bool isAlt;
|
||||
bool isKeypad;
|
||||
bool isValid;
|
||||
bool isAutoRepeat;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue