This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "shortcut.h" | |
#include <QKeyEvent> | |
#include <QCoreApplication> | |
#include <QDebug> | |
Shortcut::Shortcut(QObject *parent) | |
: QObject(parent) | |
, m_keySequence() | |
, m_keypressAlreadySend(false) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Entity::SetRotation(const glm::quat& rotation) | |
{ | |
m_Rotation = rotation; | |
// The const values are the world forward & world up respectively (in this case, a left-handed coordinate system). | |
m_Forward = glm::rotate(m_Rotation, glm::vec3(0.0f, 0.0f, 1.0f)); | |
m_Up = glm::rotate(m_Rotation, glm::vec3(0.0f, 1.0f, 0.0f); | |
} | |
void Entity::SetEuler(const glm::vec3& rotation) | |
{ | |
m_Rotation = glm::quat(rotation); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Overwrite the rotation value entirely w/ a new one. | |
SetRotation(quaternion rot); | |
SetRotationEuler(vec3 rot); | |
SetRotationAxis(float angle, vec3 axis); | |
// Apply an additional rotation to the currently existing one. | |
Rotate(quaternion rot); | |
RotateEuler(vec3 rot); | |
RotateAxis(float angle, vec3 axis); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vec3 object1(15.2f, 0.0f, -12.0f); | |
vec3 object2(0.0f, 0.0f, 0.0f); | |
// Set the forward vector to align with the vector between these two positions. | |
// Effectively having the second object "look at" the first. | |
object2.SetForward(object1 - object2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// windowHandle is a pointer to an SDL_Window object, acquired and stored from your original call to SDL_CreateWindow | |
SDL_DestroyWindow(windowHandle); | |
// You'll probably want to keep the window title and window position unchanged | |
// by caching those values before you destroy the previous window. | |
windowHandle = SDL_CreateWindow("Window Title", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, newWidth, newHeight, SDL_WINDOW_OPENGL); | |
// windowContext is an SDL_GLContext object, acquired and stored from your initial SDL_GL_CreateContext call. | |
SDL_GL_MakeCurrent(windowHandle, windowContext); | |
// Again, keeping in mind that resolution and window size are separate things -- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// windowHandle is a pointer to an SDL_Window object, acquired and stored from your original call to SDL_CreateWindow | |
SDL_DestroyWindow(windowHandle); | |
// You'll probably want to keep the window title and window position unchanged | |
// by caching those values before you destroy the previous window. | |
windowHandle = SDL_CreateWindow("Window Title", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, newWidth, newHeight, SDL_WINDOW_OPENGL); | |
// windowContext is an SDL_GLContext object, acquired and stored from your initial SDL_GL_CreateContext call. | |
SDL_GL_MakeCurrent(windowHandle, windowContext); | |
// Still needs to be called to update the rendered area. | |
glViewport(newWidth, newHeight); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SDL_DestroyWindow(windowHandle); | |
windowHandle = SDL_CreateWindow("Window Title", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, newWidth, newHeight, SDL_WINDOW_OPENGL); | |
SDL_GL_MakeCurrent(windowHandle, windowContext); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SDL.h> | |
#include <Windows.h> | |
#include <gl/glew.h> | |
#include <gl/GL.h> | |
#include <stdexcept> | |
#undef main | |
struct Vector3 { | |
float x, y, z; | |
Vector3(float _x, float _y, float _z) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SDL.h> | |
#include <Windows.h> | |
#include <gl/glew.h> | |
#include <gl/GL.h> | |
#include <stdexcept> | |
#undef main | |
struct Vector3 { | |
float x, y, z; | |
Vector3(float _x, float _y, float _z) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SDL.h> | |
#include <Windows.h> | |
#include <gl/glew.h> | |
#include <gl/GL.h> | |
#include <stdexcept> | |
#undef main | |
struct Vector3 { | |
float x, y, z; | |
Vector3(float _x, float _y, float _z) { |