|
@@ -251,11 +251,43 @@ void HandleUpdate(StringHash eventType, VariantMap& eventData)
|
|
|
cameraNode.TranslateRelative(Vector3(-10, 0, 0) * timeStep * speedMultiplier);
|
|
cameraNode.TranslateRelative(Vector3(-10, 0, 0) * timeStep * speedMultiplier);
|
|
|
if (input.keyDown['D'])
|
|
if (input.keyDown['D'])
|
|
|
cameraNode.TranslateRelative(Vector3(10, 0, 0) * timeStep * speedMultiplier);
|
|
cameraNode.TranslateRelative(Vector3(10, 0, 0) * timeStep * speedMultiplier);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Update package download status
|
|
|
|
|
+ if (network.serverConnection !is null)
|
|
|
|
|
+ {
|
|
|
|
|
+ Connection@ connection = network.serverConnection;
|
|
|
|
|
+ if (connection.numDownloads > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ downloadsText.text = "Downloads: " + connection.numDownloads + " Current download: " +
|
|
|
|
|
+ connection.downloadName + " (" + int(connection.downloadProgress * 100.0) + "%)";
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (!downloadsText.text.empty)
|
|
|
|
|
+ downloadsText.text = "";
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void HandleKeyDown(StringHash eventType, VariantMap& eventData)
|
|
|
|
|
+{
|
|
|
|
|
+ int key = eventData["Key"].GetInt();
|
|
|
|
|
+
|
|
|
|
|
+ if (key == KEY_ESC)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (ui.focusElement is null)
|
|
|
|
|
+ engine.Exit();
|
|
|
|
|
+ else
|
|
|
|
|
+ console.visible = false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (key == KEY_F1)
|
|
|
|
|
+ console.Toggle();
|
|
|
|
|
|
|
|
- if (input.keyPress['1'])
|
|
|
|
|
|
|
+ if (ui.focusElement is null)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (key == '1')
|
|
|
renderer.renderMode = RenderMode((renderer.renderMode + 1) % 3);
|
|
renderer.renderMode = RenderMode((renderer.renderMode + 1) % 3);
|
|
|
|
|
|
|
|
- if (input.keyPress['2'])
|
|
|
|
|
|
|
+ if (key == '2')
|
|
|
{
|
|
{
|
|
|
int quality = renderer.textureQuality;
|
|
int quality = renderer.textureQuality;
|
|
|
++quality;
|
|
++quality;
|
|
@@ -264,7 +296,7 @@ void HandleUpdate(StringHash eventType, VariantMap& eventData)
|
|
|
renderer.textureQuality = quality;
|
|
renderer.textureQuality = quality;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (input.keyPress['3'])
|
|
|
|
|
|
|
+ if (key == '3')
|
|
|
{
|
|
{
|
|
|
int quality = renderer.materialQuality;
|
|
int quality = renderer.materialQuality;
|
|
|
++quality;
|
|
++quality;
|
|
@@ -273,13 +305,13 @@ void HandleUpdate(StringHash eventType, VariantMap& eventData)
|
|
|
renderer.materialQuality = quality;
|
|
renderer.materialQuality = quality;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (input.keyPress['4'])
|
|
|
|
|
|
|
+ if (key == '4')
|
|
|
renderer.specularLighting = !renderer.specularLighting;
|
|
renderer.specularLighting = !renderer.specularLighting;
|
|
|
|
|
|
|
|
- if (input.keyPress['5'])
|
|
|
|
|
|
|
+ if (key == '5')
|
|
|
renderer.drawShadows = !renderer.drawShadows;
|
|
renderer.drawShadows = !renderer.drawShadows;
|
|
|
|
|
|
|
|
- if (input.keyPress['6'])
|
|
|
|
|
|
|
+ if (key == '6')
|
|
|
{
|
|
{
|
|
|
int size = renderer.shadowMapSize;
|
|
int size = renderer.shadowMapSize;
|
|
|
size *= 2;
|
|
size *= 2;
|
|
@@ -288,79 +320,51 @@ void HandleUpdate(StringHash eventType, VariantMap& eventData)
|
|
|
renderer.shadowMapSize = size;
|
|
renderer.shadowMapSize = size;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (input.keyPress['7'])
|
|
|
|
|
|
|
+ if (key == '7')
|
|
|
renderer.shadowQuality = renderer.shadowQuality + 1;
|
|
renderer.shadowQuality = renderer.shadowQuality + 1;
|
|
|
|
|
|
|
|
- if (input.keyPress['8'])
|
|
|
|
|
|
|
+ if (key == '8')
|
|
|
{
|
|
{
|
|
|
bool occlusion = renderer.maxOccluderTriangles > 0;
|
|
bool occlusion = renderer.maxOccluderTriangles > 0;
|
|
|
occlusion = !occlusion;
|
|
occlusion = !occlusion;
|
|
|
renderer.maxOccluderTriangles = occlusion ? 5000 : 0;
|
|
renderer.maxOccluderTriangles = occlusion ? 5000 : 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (input.keyPress['9'])
|
|
|
|
|
|
|
+ if (key == '9')
|
|
|
renderer.dynamicInstancing = !renderer.dynamicInstancing;
|
|
renderer.dynamicInstancing = !renderer.dynamicInstancing;
|
|
|
|
|
|
|
|
- if (input.keyPress[' '])
|
|
|
|
|
|
|
+ if (key == ' ')
|
|
|
{
|
|
{
|
|
|
drawDebug++;
|
|
drawDebug++;
|
|
|
if (drawDebug > 2)
|
|
if (drawDebug > 2)
|
|
|
drawDebug = 0;
|
|
drawDebug = 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (input.keyPress['C'])
|
|
|
|
|
|
|
+ if (key == 'C')
|
|
|
camera.orthographic = !camera.orthographic;
|
|
camera.orthographic = !camera.orthographic;
|
|
|
|
|
|
|
|
- if (input.keyPress['B'])
|
|
|
|
|
|
|
+ if (key == 'B')
|
|
|
bloom.active = !bloom.active;
|
|
bloom.active = !bloom.active;
|
|
|
|
|
|
|
|
- if (input.keyPress['F'])
|
|
|
|
|
|
|
+ if (key == 'F')
|
|
|
edgeFilter.active = !edgeFilter.active;
|
|
edgeFilter.active = !edgeFilter.active;
|
|
|
|
|
|
|
|
- if (input.keyPress['T'])
|
|
|
|
|
|
|
+ if (key == 'T')
|
|
|
debugHud.Toggle(DEBUGHUD_SHOW_PROFILER);
|
|
debugHud.Toggle(DEBUGHUD_SHOW_PROFILER);
|
|
|
|
|
|
|
|
- if (input.keyPress[KEY_F5])
|
|
|
|
|
|
|
+ if (key == KEY_F5)
|
|
|
{
|
|
{
|
|
|
File@ xmlFile = File(fileSystem.programDir + "Data/Scenes/Scene.xml", FILE_WRITE);
|
|
File@ xmlFile = File(fileSystem.programDir + "Data/Scenes/Scene.xml", FILE_WRITE);
|
|
|
testScene.SaveXML(xmlFile);
|
|
testScene.SaveXML(xmlFile);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (input.keyPress[KEY_F7])
|
|
|
|
|
|
|
+ if (key == KEY_F7)
|
|
|
{
|
|
{
|
|
|
File@ xmlFile = File(fileSystem.programDir + "Data/Scenes/Scene.xml", FILE_READ);
|
|
File@ xmlFile = File(fileSystem.programDir + "Data/Scenes/Scene.xml", FILE_READ);
|
|
|
if (xmlFile.open)
|
|
if (xmlFile.open)
|
|
|
testScene.LoadXML(xmlFile);
|
|
testScene.LoadXML(xmlFile);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- if (input.keyPress[KEY_ESC])
|
|
|
|
|
- {
|
|
|
|
|
- if (ui.focusElement is null)
|
|
|
|
|
- engine.Exit();
|
|
|
|
|
- else
|
|
|
|
|
- console.visible = false;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // Update package download status
|
|
|
|
|
- if (network.serverConnection !is null)
|
|
|
|
|
- {
|
|
|
|
|
- Connection@ connection = network.serverConnection;
|
|
|
|
|
- if (connection.numDownloads > 0)
|
|
|
|
|
- {
|
|
|
|
|
- downloadsText.text = "Downloads: " + connection.numDownloads + " Current download: " +
|
|
|
|
|
- connection.downloadName + " (" + int(connection.downloadProgress * 100.0) + "%)";
|
|
|
|
|
- }
|
|
|
|
|
- else if (!downloadsText.text.empty)
|
|
|
|
|
- downloadsText.text = "";
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-void HandleKeyDown(StringHash eventType, VariantMap& eventData)
|
|
|
|
|
-{
|
|
|
|
|
- // Check for toggling the console
|
|
|
|
|
- if (eventData["Key"].GetInt() == KEY_F1)
|
|
|
|
|
- console.Toggle();
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void HandleMouseMove(StringHash eventType, VariantMap& eventData)
|
|
void HandleMouseMove(StringHash eventType, VariantMap& eventData)
|