From 3571bdcd614c4fc04c11851bab93b6c66395166c Mon Sep 17 00:00:00 2001 From: MitchellHansen Date: Mon, 6 Feb 2017 03:47:43 -0800 Subject: [PATCH] Fixed all the compiler warnings, fixed depreciated screenshot function --- CMakeLists.txt | 9 +++++---- include/LightController.h | 5 +++-- include/LightHandle.h | 2 +- src/Camera.cpp | 3 +-- src/Hardware_Caster.cpp | 4 ++-- src/LightController.cpp | 1 - src/LightHandle.cpp | 2 +- src/Old_Map.cpp | 3 +-- src/Pub_Sub.cpp | 1 - src/Ray.cpp | 2 -- src/main.cpp | 7 +++++-- 11 files changed, 19 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 446c90f..1c67b98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,9 @@ # Check versions message(STATUS "CMake version: ${CMAKE_VERSION}") cmake_minimum_required(VERSION 3.1) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) + # Set the project name set(PNAME Game) project(${PNAME}) @@ -61,13 +63,12 @@ target_link_libraries (${PNAME} ${SFML_LIBRARIES} ${SFML_DEPENDENCIES}) target_link_libraries (${PNAME} ${OpenCL_LIBRARY}) target_link_libraries (${PNAME} ${OPENGL_LIBRARIES}) target_link_libraries (${PNAME} ${GLEW_LIBRARIES}) +#target_link_libraries (${PNAME} ${Vulkan_LIBRARIES}) if (NOT WIN32) target_link_libraries (${PNAME} -lpthread) endif() -#target_link_libraries (${PNAME} ${Vulkan_LIBRARIES}) - -# Setup to use C++11 -set_property(TARGET ${PNAME} PROPERTY CXX_STANDARD 14) # Use C++11 +# Setup to use C++14 +set_property(TARGET ${PNAME} PROPERTY CXX_STANDARD 14) diff --git a/include/LightController.h b/include/LightController.h index c45372f..12bd413 100644 --- a/include/LightController.h +++ b/include/LightController.h @@ -6,6 +6,7 @@ #include "RayCaster.h" #include "LightHandle.h" + class LightController : public VrEventSubscriber { public: @@ -46,10 +47,10 @@ private: //// Need to allow N byte light class to be packed into 10 byte packets //int packed_size = sizeof(PackedData); - //std::vector packed_data_array; + std::vector packed_data_array; // // - //std::unordered_map light_map; + std::unordered_map light_map; // //std::shared_ptr raycaster; diff --git a/include/LightHandle.h b/include/LightHandle.h index a11f155..72a461c 100644 --- a/include/LightHandle.h +++ b/include/LightHandle.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include "LightController.h" +#include // We need to be able to : // - Allow lights to exist outside the context of a LightController diff --git a/src/Camera.cpp b/src/Camera.cpp index ae8cc22..0e1ec42 100644 --- a/src/Camera.cpp +++ b/src/Camera.cpp @@ -1,4 +1,3 @@ -#pragma once #include "Camera.h" #include "Pub_Sub.h" @@ -201,4 +200,4 @@ sf::Vector3f Camera::get_position() { sf::Vector2f Camera::get_direction() { return direction; -} \ No newline at end of file +} diff --git a/src/Hardware_Caster.cpp b/src/Hardware_Caster.cpp index 6a4bd2c..1ee91dd 100644 --- a/src/Hardware_Caster.cpp +++ b/src/Hardware_Caster.cpp @@ -36,7 +36,7 @@ int Hardware_Caster::init() { return error; } - srand(NULL); + srand(time(NULL)); int *seed_memory = new int[1920*1080]; @@ -893,4 +893,4 @@ bool Hardware_Caster::assert(int error_code, std::string function_name) { std::cout << err_msg << " =at= " << function_name << std::endl; return true; -} \ No newline at end of file +} diff --git a/src/LightController.cpp b/src/LightController.cpp index b4240e1..881b9d6 100644 --- a/src/LightController.cpp +++ b/src/LightController.cpp @@ -1,4 +1,3 @@ -#pragma once #include "LightController.h" //LightController::LightController(std::shared_ptr raycaster) { diff --git a/src/LightHandle.cpp b/src/LightHandle.cpp index cf58253..8b8e0f6 100644 --- a/src/LightHandle.cpp +++ b/src/LightHandle.cpp @@ -1,5 +1,5 @@ #include "LightHandle.h" - +#include "LightController.h" LightHandle::LightHandle() { diff --git a/src/Old_Map.cpp b/src/Old_Map.cpp index d79836d..f2201d3 100644 --- a/src/Old_Map.cpp +++ b/src/Old_Map.cpp @@ -1,4 +1,3 @@ -#pragma once #include #include #include @@ -369,4 +368,4 @@ void Old_Map::diamond_square(int stepsize, double scale) { } } -} \ No newline at end of file +} diff --git a/src/Pub_Sub.cpp b/src/Pub_Sub.cpp index 4b0f356..a44c05c 100644 --- a/src/Pub_Sub.cpp +++ b/src/Pub_Sub.cpp @@ -1,4 +1,3 @@ -#pragma once #include #include "Event.hpp" #include "Pub_Sub.h" diff --git a/src/Ray.cpp b/src/Ray.cpp index a168bc4..1709da7 100644 --- a/src/Ray.cpp +++ b/src/Ray.cpp @@ -1,5 +1,3 @@ -#pragma once - #include #include #include "Map.h" diff --git a/src/main.cpp b/src/main.cpp index 9210b1d..44f9200 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,7 +22,6 @@ #include #endif -#pragma once #include #include #include @@ -233,7 +232,11 @@ int main() { std::getline(std::cin, filename); filename += ".png"; - sf::Image image = window.capture(); + sf::Texture window_texture; + window_texture.create(window.getSize().x, window.getSize().y); + window_texture.update(window); + + sf::Image image = window_texture.copyToImage(); image.saveToFile(path + filename); }