Commit 6d5a4bb1 authored by Benjamin 'Albsi' Albsmeier's avatar Benjamin 'Albsi' Albsmeier
Browse files

Merge branch 'develop' into feature/input

Conflicts:
	src/audio/AudioEventHandler.cpp
parents cce433b2 a8b96e16
......@@ -6,7 +6,7 @@ linux:
stage: build
script:
- ./build_deps.sh linux
- premake5 --cc=clang gmake
- premake5 --cc=gcc gmake
- make clean
- make -j 7
tags:
......@@ -19,7 +19,7 @@ release:
stage: deploy
script:
- ./build_deps.sh linux
- premake5 --cc=clang gmake
- premake5 --cc=gcc gmake
- make clean
- make -j 7
- tar -caf linux.tar.xz assets build
......
......@@ -22,7 +22,7 @@ namespace gdw {
virtual std::shared_ptr<const asset> load_asset(const std::string& name) const = 0;
virtual std::string native_name(const std::string& name) const {
virtual std::string native_name(const std::string&) const {
return std::string();
}
};
......
......@@ -7,7 +7,7 @@
#include <audio/music.hpp>
#include <audio/music_manager.hpp>
#include <audio/sound.hpp>
#include <audio/sound_file.hpp>
#include <audio/sound_manager.hpp>
namespace gdw {
......
......@@ -4,13 +4,13 @@
#include <SDL_mixer.h>
namespace gdw {
class sound {
class sound_file {
private:
Mix_Chunk* impl_;
public:
sound(const char* mem, int size);
~sound();
sound_file(const char* mem, int size);
~sound_file();
Mix_Chunk* get() const;
};
......
#ifndef __GDW_SOUND_MANAGER_HPP__
#define __GDW_SOUND_MANAGER_HPP__
#include <audio/sound.hpp>
#include <audio/sound_file.hpp>
#include <util/cached_resource_manager.hpp>
namespace gdw{
......@@ -9,13 +9,13 @@ namespace gdw{
}
namespace gdw {
using sound_ptr = std::shared_ptr<const sound>;
using sound_ptr = std::shared_ptr<const sound_file>;
class sound_manager: public cached_resource_manager<const sound, sound_manager> {
class sound_manager: public cached_resource_manager<const sound_file, sound_manager> {
private:
engine& engine_;
friend class cached_resource_manager<const sound, sound_manager>;
friend class cached_resource_manager<const sound_file, sound_manager>;
public:
sound_manager(engine& engine);
......
......@@ -42,7 +42,7 @@ namespace gdw {
}
}
void AudioEventHandler::playStateUpdate(float deltaTime) {
void AudioEventHandler::playStateUpdate(float) {
if ((this->engine.input().isPressed("move_left") || this->engine.input().isPressed("move_right")) && !this->playerMoving) {
this->channels["ship"] = this->engine.audio().queue_sound("engine", -1);
this->engine.audio().sound_volume(40, this->channels["ship"]);
......
......@@ -43,7 +43,7 @@ namespace gdw {
Mix_CloseAudio();
}
void audio::update(float delta) {
void audio::update(float) {
//just in case
}
......
#include <audio/audio_helper.hpp>
#include <audio/sound.hpp>
#include <audio/sound_file.hpp>
namespace gdw {
sound::sound(const char* mem, int size) {
sound_file::sound_file(const char* mem, int size) {
SDL_RWops* raw = SDL_RWFromConstMem((void*)mem, size);
if (raw == nullptr) {
audio_error("could not load music from memory");
......@@ -10,13 +10,13 @@ namespace gdw {
impl_ = Mix_LoadWAV_RW(raw, 1);
}
sound::~sound() {
sound_file::~sound_file() {
if (impl_ != nullptr) {
Mix_FreeChunk(impl_);
}
}
Mix_Chunk* sound::get() const {
Mix_Chunk*sound_file::get() const {
return impl_;
}
}
......@@ -13,6 +13,6 @@ namespace gdw {
return sound_ptr();
}
auto& content = asset->content();
return std::make_shared<const sound>(content.data(), content.size());
return std::make_shared<const sound_file>(content.data(), content.size());
}
}
......@@ -56,7 +56,7 @@ void menu_state::on_enter() {
this->uiManager->render(true);
}
void menu_state::update(float dt) {
void menu_state::update(float) {
/**
* Dont look at this code, it just ugly highlights the menu items
*/
......
......@@ -63,9 +63,6 @@ namespace gdw {
auto ray_dir = world_pos_far - world_pos_near;
auto final_pos = world_pos_near + ray_dir;
auto& entity_manager = engine_.entity_manager();
auto plane_normal = glm::vec3(0,1,0); //Hardcoded ground plane
//HNF
......@@ -74,7 +71,7 @@ namespace gdw {
return camera->position()-glm::vec3((glm::normalize(ray_dir))*d);
}
void game_input_manager::handle_key_input(float dt) {
void game_input_manager::handle_key_input(float) {
auto& level_manager = engine_.game_play_system().level_manager();
auto player = level_manager.player();
......@@ -131,7 +128,7 @@ namespace gdw {
}
}
void game_input_manager::handle_mouse_input(float dt) {
void game_input_manager::handle_mouse_input(float) {
auto &input = engine_.input();
auto &level_manager = engine_.game_play_system().level_manager();
......
......@@ -73,7 +73,7 @@ namespace gdw {
auto &emp_coll = placed_item.emplace_back<collision_component>(new sphere(glm::vec3(0.f), 5.f));
placed_item.emplace_back<object_type_component>("EMP");
emp_coll.set_trigger([this](unsigned long long self_id, unsigned long long coll_id) {
emp_coll.set_trigger([this](unsigned long long, unsigned long long coll_id) {
auto s = coll_id;
auto move = engine_.entity_manager().resolve(s)->component<movement_component>();
auto type_comp = engine_.entity_manager().resolve(s)->component<object_type_component>();
......@@ -97,7 +97,7 @@ namespace gdw {
auto& placed_item = engine_.entity_manager().emplace_back(world_pos, glm::angleAxis(glm::radians(0.f), glm::vec3(1,0,0)));
//placed_item.emplace_back<staticmesh_component>("mesh/cube.msh");
//placed_item.scale(glm::vec3(3.f, .5f, .5f));
auto &placed_item_coll = placed_item.emplace_back<collision_component>(new sphere(glm::vec3(0.f), 5.f));
placed_item.emplace_back<collision_component>(new sphere(glm::vec3(0.f), 5.f));
placed_item.emplace_back<object_type_component>("ACCELERATOR");
auto &left_cube = engine_.entity_manager().emplace_back(world_pos-glm::vec3(2.5f,0,0), glm::angleAxis(glm::radians(0.f), glm::vec3(1,0,0)));
......@@ -121,7 +121,7 @@ namespace gdw {
void player_item_manager::update(float dt) {
std::vector<accelerator_type*> accel_del_queue;
for(int i = 0; i < accelerators_.size(); i++) {
for(auto i = 0u; i < accelerators_.size(); i++) {
auto a = accelerators_[i];
auto ent = engine_.entity_manager().resolve(a->main);
auto &game_input_manager = engine_.game_play_system().game_input_manager();
......@@ -146,7 +146,7 @@ namespace gdw {
// emp management
std::vector<emp_type*> emp_del_queue;
for(int i = 0; i < emps_.size(); i++) {
for(auto i = 0u; i < emps_.size(); i++) {
auto e = emps_[i];
e->alive_timer += dt;
......
......@@ -168,7 +168,7 @@ namespace gdw {
}
std::vector<unsigned long long> del_queue;
for (int i = 0; i < victims_.size(); i++) {
for (auto i = 0u; i < victims_.size(); i++) {
auto victim = engine_.entity_manager().resolve(victims_[i]);
if (!victim) continue;
......@@ -209,7 +209,7 @@ namespace gdw {
unsigned int item_drop_chance = 100; // percent
for (auto &item : items_to_create) {
srand(time(0) * time(0));
if (rand() % 100 <= item_drop_chance) {
if (rand() % 100u <= item_drop_chance) {
srand(time(0) * time(0));
constexpr int max = item_type::type_count;
constexpr int min = 0;
......
......@@ -6,7 +6,7 @@
#include <core/engine.hpp>
#include <util/stacktrace.hpp>
int main(int argc, char* argv[]) {
int main(int, char* argv[]) {
try {
gdw::initStacktrace(argv[0]);
gdw::engine e;
......
......@@ -48,7 +48,7 @@ namespace gdw {
ibo_.data(index_size, data_ptr);
data_ptr += index_size;
for (auto i = 0; i < head.submesh_count; ++i) {
for (auto i = 0u; i < head.submesh_count; ++i) {
submesh s;
s.index_count = *reinterpret_cast<const uint64_t*>(data_ptr);
......
......@@ -378,7 +378,7 @@ namespace gdw {
}
}
void rendering_system::render_gbuffer(float delta_time, camera_component& camera) {
void rendering_system::render_gbuffer(float, camera_component& camera) {
g_buffer_.bind();
glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment