Browse Source

fixed camera movement bug

testing
Michael Porter 2 years ago
parent
commit
8fba882f71
4 changed files with 7 additions and 5 deletions
  1. 2
    0
      include/inputhandler.h
  2. 1
    1
      res/config.conf
  3. 1
    1
      src/inputhandler.cpp
  4. 3
    3
      src/scenes/testscene.cpp

+ 2
- 0
include/inputhandler.h View File

@@ -44,6 +44,8 @@ protected:
Uint32 mouseButtons;
const Uint8* keys;
SDL_Event event;
Sint32 mMouseXRel;
Sint32 mMouseYRel;
};

}

+ 1
- 1
res/config.conf View File

@@ -11,7 +11,7 @@ graphics {

controls {
mouse {
sensitivity = 8
sensitivity = 2
}
bindings {
movement {

+ 1
- 1
src/inputhandler.cpp View File

@@ -17,7 +17,7 @@
*/

#include "inputhandler.h"
#include <iostream>
namespace vtk {

void InputHandler::update() {

+ 3
- 3
src/scenes/testscene.cpp View File

@@ -133,9 +133,9 @@ void TestScene::init() {
std::cout << std::endl;

int chunkCount = 1;
for (int i = 0; i < 16; i++) {
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
for (int k = 0; k < 16; k++) {
for (int k = 0; k < 8; k++) {
std::cout << "\rGenerating chunks (" << chunkCount << "/" << 8*8*8 << ")" << std::flush;
world.generateChunk(i,j,k);
chunkCount++;
@@ -223,7 +223,7 @@ void TestScene::draw() {
void TestScene::look() {
int x, y; //mouse change
SDL_GetRelativeMouseState(&x, &y);
camera.rotate((float)x * dTime * sensitivity * 0.01f, (float)y * dTime * sensitivity * 0.01f);
camera.rotate((float)x * sensitivity * 0.001f, (float)y * sensitivity * 0.001f);
//camera.rotate((float)x, (float)y);
}


Loading…
Cancel
Save