summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-04-05 12:48:50 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-04-05 12:48:50 (GMT)
commit8f8de875c6f7a68a3e47252a8653abb72fd398c1 (patch)
treed2079a8422c3b591e3e31e272358825e0a597da3 /src
parentea51cde1f07d2a63f824e78c44adad0993115853 (diff)
downloadpowder-8f8de875c6f7a68a3e47252a8653abb72fd398c1.zip
powder-8f8de875c6f7a68a3e47252a8653abb72fd398c1.tar.gz
Modifier keys for Lua, Air display, correct render mode saving
Diffstat (limited to 'src')
-rw-r--r--src/Renderer.cpp3
-rw-r--r--src/cat/LuaScriptInterface.cpp18
-rw-r--r--src/game/GameModel.cpp4
-rw-r--r--src/game/GameView.cpp1
-rw-r--r--src/render/RenderView.cpp9
5 files changed, 27 insertions, 8 deletions
diff --git a/src/Renderer.cpp b/src/Renderer.cpp
index 95deb69..79b63ec 100644
--- a/src/Renderer.cpp
+++ b/src/Renderer.cpp
@@ -7,6 +7,7 @@
#include <math.h>
#include <iostream>
+#include <vector>
#include "Config.h"
#include "Renderer.h"
#include "Graphics.h"
@@ -1611,6 +1612,8 @@ void Renderer::draw_grav()
void Renderer::draw_air()
{
#ifndef OGLR
+ if(!(display_mode & DISPLAY_AIR))
+ return;
int x, y, i, j;
float (*pv)[XRES/CELL] = sim->air->pv;
float (*hv)[XRES/CELL] = sim->air->hv;
diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp
index 3da7284..bd0f013 100644
--- a/src/cat/LuaScriptInterface.cpp
+++ b/src/cat/LuaScriptInterface.cpp
@@ -242,12 +242,26 @@ bool LuaScriptInterface::OnMouseWheel(int x, int y, int d)
bool LuaScriptInterface::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
{
- return luacon_keyevent(key, /*TODO: sdl_mod*/0, LUACON_KDOWN);
+ int modifiers;
+ if(shift)
+ modifiers |= 0x001;
+ if(ctrl)
+ modifiers |= 0x040;
+ if(alt)
+ modifiers |= 0x100;
+ return luacon_keyevent(key, modifiers, LUACON_KDOWN);
}
bool LuaScriptInterface::OnKeyRelease(int key, Uint16 character, bool shift, bool ctrl, bool alt)
{
- return luacon_keyevent(key, /*TODO: sdl_mod*/0, LUACON_KUP);
+ int modifiers;
+ if(shift)
+ modifiers |= 0x001;
+ if(ctrl)
+ modifiers |= 0x040;
+ if(alt)
+ modifiers |= 0x100;
+ return luacon_keyevent(key, modifiers, LUACON_KUP);
}
void LuaScriptInterface::OnTick()
diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp
index 6a8f3d8..fa18e24 100644
--- a/src/game/GameModel.cpp
+++ b/src/game/GameModel.cpp
@@ -126,14 +126,14 @@ GameModel::~GameModel()
{
Client::Ref().configDocument["Renderer"]["ColourMode"] = json::Number(ren->GetColourMode());
- ((json::Array)Client::Ref().configDocument["Renderer"]["DisplayModes"]).Clear();
+ Client::Ref().configDocument["Renderer"]["DisplayModes"] = json::Array();
std::vector<unsigned int> displayModes = ren->GetDisplayMode();
for (int i = 0; i < displayModes.size(); i++)
{
Client::Ref().configDocument["Renderer"]["DisplayModes"][i] = json::Number(displayModes[i]);
}
- ((json::Array)Client::Ref().configDocument["Renderer"]["RenderModes"]).Clear();
+ Client::Ref().configDocument["Renderer"]["RenderModes"] = json::Array();
std::vector<unsigned int> renderModes = ren->GetRenderMode();
for (int i = 0; i < renderModes.size(); i++)
{
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp
index d8ea4b8..bd4bd7a 100644
--- a/src/game/GameView.cpp
+++ b/src/game/GameView.cpp
@@ -840,6 +840,7 @@ void GameView::OnDraw()
if(ren)
{
Graphics * g = ui::Engine::Ref().g;
+ ren->draw_air();
ren->render_parts();
ren->render_fire();
ren->DrawWalls();
diff --git a/src/render/RenderView.cpp b/src/render/RenderView.cpp
index 1702d63..3c9811d 100644
--- a/src/render/RenderView.cpp
+++ b/src/render/RenderView.cpp
@@ -232,15 +232,16 @@ void RenderView::OnDraw()
{
Graphics * g = ui::Engine::Ref().g;
g->clearrect(0, 0, XRES, YRES+MENUSIZE);
- g->draw_line(0, YRES, XRES-1, YRES, 255, 255, 255, XRES+BARSIZE);
- g->draw_line(180, YRES, 180, YRES+MENUSIZE, 200, 200, 200, XRES+BARSIZE);
- g->draw_line(480, YRES, 480, YRES+MENUSIZE, 200, 200, 200, XRES+BARSIZE);
- g->draw_line(XRES-1, 0, XRES-1, YRES+MENUSIZE, 255, 255, 255, XRES+BARSIZE);
if(ren)
{
+ ren->draw_air();
ren->render_parts();
ren->render_fire();
}
+ g->draw_line(0, YRES, XRES-1, YRES, 255, 255, 255, XRES+BARSIZE);
+ g->draw_line(180, YRES, 180, YRES+MENUSIZE, 200, 200, 200, XRES+BARSIZE);
+ g->draw_line(480, YRES, 480, YRES+MENUSIZE, 200, 200, 200, XRES+BARSIZE);
+ g->draw_line(XRES-1, 0, XRES-1, YRES+MENUSIZE, 255, 255, 255, XRES+BARSIZE);
}
RenderView::~RenderView() {