fix: compiler warnings
This commit is contained in:
@@ -16,7 +16,7 @@ Connexion::Connexion() : protocol::PacketHandler(nullptr){
|
||||
|
||||
}
|
||||
|
||||
Connexion::Connexion(Connexion&& move) : m_Socket(std::move(move.m_Socket)), protocol::PacketHandler(&m_Dispatcher){
|
||||
Connexion::Connexion(Connexion&& move) : protocol::PacketHandler(&m_Dispatcher), m_Socket(std::move(move.m_Socket)){
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ Connexion::Connexion(protocol::PacketDispatcher* dispatcher) : protocol::PacketH
|
||||
|
||||
}
|
||||
|
||||
Connexion::Connexion(protocol::PacketDispatcher* dispatcher, network::TCPSocket& socket) : protocol::PacketHandler(dispatcher), m_Socket(std::move(socket)){
|
||||
Connexion::Connexion(protocol::PacketDispatcher* dispatcher, network::TCPSocket& socket) : protocol::PacketHandler(dispatcher), m_Socket(std::move(socket)) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -316,8 +316,7 @@ bool World::saveMap(const std::string& fileName) const{
|
||||
|
||||
DataBuffer buffer = mapHeaderCompressed << mapDataCompressed;
|
||||
std::cout << "Total Size : " << buffer.GetSize() << std::endl;
|
||||
buffer.WriteFile(fileName);
|
||||
std::cout << "----- Map Saved ! -----\n";
|
||||
return buffer.WriteFile(fileName);
|
||||
}
|
||||
|
||||
void World::tick(std::uint64_t delta){
|
||||
@@ -336,8 +335,6 @@ void World::moveMobs(std::uint64_t delta){
|
||||
for(MobPtr mob : m_Mobs){
|
||||
TilePtr tile = getTile(mob->getX(), mob->getY());
|
||||
|
||||
Direction tileDir;
|
||||
|
||||
if(tile != nullptr && tile->getType() == TileType::Walk){
|
||||
WalkableTile* walkTile = dynamic_cast<WalkableTile*>(tile.get());
|
||||
mob->setDirection(walkTile->direction);
|
||||
@@ -368,22 +365,25 @@ void World::moveMobs(std::uint64_t delta){
|
||||
}
|
||||
}
|
||||
|
||||
const Color& World::getTileColor(TilePtr tile) const{
|
||||
const Color* World::getTileColor(TilePtr tile) const{
|
||||
switch(tile->getType()){
|
||||
case TileType::Tower:{
|
||||
TowerTile* towerTile = (TowerTile*) tile.get();
|
||||
return m_TowerPlacePalette[towerTile->color_palette_ref];
|
||||
return &m_TowerPlacePalette[towerTile->color_palette_ref];
|
||||
}
|
||||
case TileType::Walk:{
|
||||
return m_WalkablePalette;
|
||||
return &m_WalkablePalette;
|
||||
}
|
||||
case TileType::Decoration:{
|
||||
DecorationTile* towerTile = (DecorationTile*) tile.get();
|
||||
return m_DecorationPalette[towerTile->color_palette_ref];
|
||||
return &m_DecorationPalette[towerTile->color_palette_ref];
|
||||
break;
|
||||
}
|
||||
case TileType::None:{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return m_DecorationPalette[0];
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Team& World::getRedTeam(){
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
namespace td{
|
||||
namespace client{
|
||||
|
||||
WorldClient::WorldClient(ClientGame* game) : m_Game(game), game::World(game), protocol::PacketHandler(game->GetDispatcher()){
|
||||
WorldClient::WorldClient(ClientGame* game) : game::World(game), protocol::PacketHandler(game->GetDispatcher()), m_Game(game){
|
||||
GetDispatcher()->RegisterHandler(protocol::PacketType::WorldBeginData, this);
|
||||
GetDispatcher()->RegisterHandler(protocol::PacketType::WorldData, this);
|
||||
GetDispatcher()->RegisterHandler(protocol::PacketType::SpawnMob, this);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
namespace td {
|
||||
namespace server {
|
||||
|
||||
ServerGame::ServerGame(server::Server* server) : m_Server(server), m_ServerWorld(server, this), game::Game(&m_ServerWorld){
|
||||
ServerGame::ServerGame(server::Server* server) : game::Game(&m_ServerWorld), m_Server(server), m_ServerWorld(server, this){
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
namespace td {
|
||||
namespace server {
|
||||
|
||||
ServerWorld::ServerWorld(Server* server, ServerGame* game) : m_Server(server), game::World(game){
|
||||
ServerWorld::ServerWorld(Server* server, ServerGame* game) : game::World(game), m_CurrentMobID(0), m_Server(server){
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -16,15 +16,14 @@ namespace network {
|
||||
|
||||
/* Create an invalid address */
|
||||
IPAddress::IPAddress() noexcept
|
||||
: m_Valid(false), m_Address(0)
|
||||
{
|
||||
|
||||
}
|
||||
: m_Address(0), m_Valid(false){
|
||||
|
||||
}
|
||||
|
||||
/* Initialize by string IP */
|
||||
IPAddress::IPAddress(const std::string& ip)
|
||||
: m_Valid(false), m_Address(0)
|
||||
{
|
||||
: m_Address(0), m_Valid(false){
|
||||
|
||||
std::sregex_iterator begin(ip.begin(), ip.end(), IPRegex);
|
||||
std::sregex_iterator end;
|
||||
|
||||
@@ -42,8 +41,8 @@ IPAddress::IPAddress(const std::string& ip)
|
||||
}
|
||||
|
||||
IPAddress::IPAddress(const std::wstring& ip)
|
||||
: m_Address(0), m_Valid(false)
|
||||
{
|
||||
: m_Address(0), m_Valid(false){
|
||||
|
||||
std::wsregex_iterator begin(ip.begin(), ip.end(), IPRegexW);
|
||||
std::wsregex_iterator end;
|
||||
|
||||
@@ -62,8 +61,7 @@ IPAddress::IPAddress(const std::wstring& ip)
|
||||
|
||||
/* Initialize by octets */
|
||||
IPAddress::IPAddress(uint8_t octet1, uint8_t octet2, uint8_t octet3, uint8_t octet4) noexcept
|
||||
: m_Valid(true)
|
||||
{
|
||||
: m_Valid(true){
|
||||
m_Address = (octet1 << 24) | (octet2 << 16) | (octet3 << 8) | octet4;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ namespace td {
|
||||
namespace network {
|
||||
|
||||
Socket::Socket(Type type)
|
||||
: m_Handle(INVALID_SOCKET),
|
||||
: m_Blocking(false),
|
||||
m_Type(type),
|
||||
m_Blocking(false),
|
||||
m_Status(Disconnected)
|
||||
m_Status(Disconnected),
|
||||
m_Handle(INVALID_SOCKET)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -33,6 +33,8 @@ bool Socket::SetBlocking(bool block) {
|
||||
}
|
||||
|
||||
m_Blocking = block;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Socket::IsBlocking() const noexcept {
|
||||
|
||||
@@ -19,20 +19,22 @@ DataBuffer& operator<<(DataBuffer& buffer, game::TilePtr tile){
|
||||
buffer << tile->getType();
|
||||
switch (tile->getType()){
|
||||
case game::TileType::Tower:{
|
||||
const std::shared_ptr<game::TowerTile>& towerTile = (const std::shared_ptr<game::TowerTile>&) tile;
|
||||
const game::TowerTile* towerTile = (const game::TowerTile*) tile.get();
|
||||
buffer << towerTile->color_palette_ref << towerTile->team_owner;
|
||||
break;
|
||||
}
|
||||
case game::TileType::Walk:{
|
||||
const std::shared_ptr<game::WalkableTile>& walkTile = (const std::shared_ptr<game::WalkableTile>&) tile;
|
||||
const game::WalkableTile* walkTile = (const game::WalkableTile*) tile.get();
|
||||
buffer << walkTile->direction;
|
||||
break;
|
||||
}
|
||||
case game::TileType::Decoration:{
|
||||
const std::shared_ptr<game::DecorationTile>& decoTile = (const std::shared_ptr<game::DecorationTile>&) tile;
|
||||
const game::DecorationTile* decoTile = (const game::DecorationTile*) tile.get();
|
||||
buffer << decoTile->color_palette_ref;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
@@ -59,6 +61,8 @@ DataBuffer& operator>>(DataBuffer& buffer, game::TilePtr& tile){
|
||||
tile = tilePtr;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
@@ -85,7 +89,7 @@ DataBuffer WorldBeginDataPacket::Serialize() const{
|
||||
std::size_t bufferSize = data.GetSize();
|
||||
data.Resize(bufferSize + decoTilePalette.size() * sizeof(game::Color));
|
||||
|
||||
memcpy((void*)data.data() + bufferSize, decoTilePalette.data(), decoTilePalette.size() * sizeof(game::Color));
|
||||
memcpy((std::uint8_t*)data.data() + bufferSize, decoTilePalette.data(), decoTilePalette.size() * sizeof(game::Color));
|
||||
|
||||
const game::Spawn& redSpawn = m_World->getRedTeam().getSpawn(), blueSpawn = m_World->getBlueTeam().getSpawn();
|
||||
const game::TeamCastle& redCastle = m_World->getRedTeam().getCastle(), blueCastle = m_World->getBlueTeam().getCastle();
|
||||
@@ -127,7 +131,7 @@ void WorldBeginDataPacket::Deserialize(DataBuffer& data){
|
||||
|
||||
m_TilePalette.reserve(tilePaletteSize);
|
||||
|
||||
for (int i = 0; i < tilePaletteSize; i++){
|
||||
for (std::uint64_t tileNumber = 0; tileNumber < tilePaletteSize; tileNumber++){
|
||||
game::TilePtr tile;
|
||||
data >> tile;
|
||||
m_TilePalette.push_back(tile);
|
||||
@@ -149,7 +153,7 @@ DataBuffer WorldDataPacket::Serialize() const{
|
||||
|
||||
std::size_t bufferSize = data.GetSize();
|
||||
data.Resize(data.GetSize() + chunk->palette.size() * sizeof(game::ChunkPalette::value_type));
|
||||
memcpy((void*)data.data() + bufferSize, chunk->palette.data(), chunk->palette.size() * sizeof(game::ChunkPalette::value_type));
|
||||
memcpy((std::uint8_t*)data.data() + bufferSize, chunk->palette.data(), chunk->palette.size() * sizeof(game::ChunkPalette::value_type));
|
||||
|
||||
std::uint8_t bitsPerTile = countBits(chunk->palette.size());
|
||||
|
||||
@@ -176,7 +180,7 @@ DataBuffer WorldDataPacket::Serialize() const{
|
||||
|
||||
bufferSize = data.GetSize();
|
||||
data.Resize(data.GetSize() + chunkData.size() * sizeof(ChunkPackedData::value_type));
|
||||
memcpy((void*)data.data() + bufferSize, chunkData.data(), chunkData.size() * sizeof(ChunkPackedData::value_type));
|
||||
memcpy((std::uint8_t*)data.data() + bufferSize, chunkData.data(), chunkData.size() * sizeof(ChunkPackedData::value_type));
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@@ -185,7 +189,7 @@ void WorldDataPacket::Deserialize(DataBuffer& data){
|
||||
std::uint64_t chunkCount;
|
||||
data >> chunkCount;
|
||||
|
||||
for (int chunkNumber = 0; chunkNumber < chunkCount; chunkNumber++){
|
||||
for (std::uint64_t chunkNumber = 0; chunkNumber < chunkCount; chunkNumber++){
|
||||
game::ChunkPtr chunk = std::make_shared<game::Chunk>();
|
||||
|
||||
game::ChunkCoord::first_type chunkX, chunkY;
|
||||
|
||||
@@ -161,12 +161,13 @@ void renderMainMenu(){
|
||||
ImVec4 getImGuiTeamColor(td::game::TeamColor color){
|
||||
switch (color){
|
||||
case td::game::TeamColor::None:
|
||||
return ImVec4(1, 1, 1, 1);
|
||||
break;
|
||||
case td::game::TeamColor::Red:
|
||||
return ImVec4(1, 0, 0, 1);
|
||||
case td::game::TeamColor::Blue:
|
||||
return ImVec4(0, 0, 1, 1);
|
||||
}
|
||||
return ImVec4(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
void showPlayers(){
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace imgui_addons
|
||||
ImGui::BeginChild("##NavigationWindow", nw_size, true, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoScrollbar);
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.882f, 0.745f, 0.078f,1.0f));
|
||||
for(int i = 0; i < current_dirlist.size(); i++)
|
||||
for(std::size_t i = 0; i < current_dirlist.size(); i++)
|
||||
{
|
||||
if( ImGui::Button(current_dirlist[i].c_str()) )
|
||||
{
|
||||
@@ -259,7 +259,7 @@ namespace imgui_addons
|
||||
if(ImGui::ListBoxHeader("##NavBarDropBox", ImVec2(0, list_item_height* 5)))
|
||||
{
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.882f, 0.745f, 0.078f,1.0f));
|
||||
for(int j = i+1; j < current_dirlist.size(); j++)
|
||||
for(std::size_t j = i+1; j < current_dirlist.size(); j++)
|
||||
{
|
||||
if(ImGui::Selectable(current_dirlist[j].c_str(), false) && j != current_dirlist.size() - 1)
|
||||
{
|
||||
@@ -345,12 +345,12 @@ namespace imgui_addons
|
||||
//Output directories in yellow
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.882f, 0.745f, 0.078f,1.0f));
|
||||
int items = 0;
|
||||
for (int i = 0; i < filtered_dirs.size(); i++)
|
||||
for (std::size_t i = 0; i < filtered_dirs.size(); i++)
|
||||
{
|
||||
if(!filtered_dirs[i]->is_hidden || show_hidden)
|
||||
{
|
||||
items++;
|
||||
if(ImGui::Selectable(filtered_dirs[i]->name.c_str(), selected_idx == i && is_dir, ImGuiSelectableFlags_AllowDoubleClick))
|
||||
if(ImGui::Selectable(filtered_dirs[i]->name.c_str(), selected_idx == (int) i && is_dir, ImGuiSelectableFlags_AllowDoubleClick))
|
||||
{
|
||||
selected_idx = i;
|
||||
is_dir = true;
|
||||
@@ -372,14 +372,13 @@ namespace imgui_addons
|
||||
ImGui::PopStyleColor(1);
|
||||
|
||||
//Output files
|
||||
for (int i = 0; i < filtered_files.size(); i++)
|
||||
for (std::size_t i = 0; i < filtered_files.size(); i++)
|
||||
{
|
||||
if(!filtered_files[i]->is_hidden || show_hidden)
|
||||
{
|
||||
items++;
|
||||
if(ImGui::Selectable(filtered_files[i]->name.c_str(), selected_idx == i && !is_dir, ImGuiSelectableFlags_AllowDoubleClick))
|
||||
if(ImGui::Selectable(filtered_files[i]->name.c_str(), selected_idx == (int) i && !is_dir, ImGuiSelectableFlags_AllowDoubleClick))
|
||||
{
|
||||
int len = filtered_files[i]->name.length();
|
||||
selected_idx = i;
|
||||
is_dir = false;
|
||||
|
||||
@@ -406,7 +405,6 @@ namespace imgui_addons
|
||||
{
|
||||
std::string label = (dialog_mode == DialogMode::SAVE) ? "Save As:" : "Open:";
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
ImVec2 pw_pos = ImGui::GetWindowPos();
|
||||
ImVec2 pw_content_sz = ImGui::GetWindowSize() - style.WindowPadding * 2.0;
|
||||
@@ -452,7 +450,7 @@ namespace imgui_addons
|
||||
if(dialog_mode == DialogMode::OPEN || dialog_mode == DialogMode::SAVE)
|
||||
{
|
||||
inputcb_filter_files.clear();
|
||||
for(int i = 0; i < subfiles.size(); i++)
|
||||
for(std::size_t i = 0; i < subfiles.size(); i++)
|
||||
{
|
||||
if(ImStristr(subfiles[i].name.c_str(), nullptr, input_fn, nullptr) != nullptr)
|
||||
inputcb_filter_files.push_back(std::ref(subfiles[i].name));
|
||||
@@ -463,7 +461,7 @@ namespace imgui_addons
|
||||
else if(dialog_mode == DialogMode::SELECT)
|
||||
{
|
||||
inputcb_filter_files.clear();
|
||||
for(int i = 0; i < subdirs.size(); i++)
|
||||
for(std::size_t i = 0; i < subdirs.size(); i++)
|
||||
{
|
||||
if(ImStristr(subdirs[i].name.c_str(), nullptr, input_fn, nullptr) != nullptr)
|
||||
inputcb_filter_files.push_back(std::ref(subdirs[i].name));
|
||||
@@ -642,7 +640,7 @@ namespace imgui_addons
|
||||
ImGui::PushItemWidth(ext_box_width);
|
||||
if(ImGui::BeginCombo("##FileTypes", valid_exts[selected_ext_idx].c_str()))
|
||||
{
|
||||
for(int i = 0; i < valid_exts.size(); i++)
|
||||
for(std::size_t i = 0; i < valid_exts.size(); i++)
|
||||
{
|
||||
if(ImGui::Selectable(valid_exts[i].c_str(), selected_ext_idx == i))
|
||||
{
|
||||
@@ -653,7 +651,7 @@ namespace imgui_addons
|
||||
size_t idx = name.find_last_of(".");
|
||||
if(idx == std::string::npos)
|
||||
idx = strlen(input_fn);
|
||||
for(int j = 0; j < valid_exts[selected_ext_idx].size(); j++)
|
||||
for(std::size_t j = 0; j < valid_exts[selected_ext_idx].size(); j++)
|
||||
input_fn[idx++] = valid_exts[selected_ext_idx][j];
|
||||
input_fn[idx++] = '\0';
|
||||
}
|
||||
@@ -910,8 +908,6 @@ namespace imgui_addons
|
||||
bool ret_val = false;
|
||||
if (ImGui::BeginPopupModal(repfile_modal_id.c_str(), nullptr, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoResize))
|
||||
{
|
||||
float frame_height = ImGui::GetFrameHeightWithSpacing();
|
||||
|
||||
std::string text = "A file with the following filename already exists. Are you sure you want to replace the existing file?";
|
||||
ImGui::TextWrapped("%s", text.c_str());
|
||||
|
||||
@@ -942,9 +938,7 @@ namespace imgui_addons
|
||||
|
||||
void ImGuiFileBrowser::showInvalidFileModal()
|
||||
{
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
std::string text = "Selected file either doesn't exist or is not supported. Please select a file with the following extensions...";
|
||||
ImVec2 text_size = ImGui::CalcTextSize(text.c_str(), nullptr, true, 350 - style.WindowPadding.x * 2.0);
|
||||
ImVec2 button_size = getButtonSize("OK");
|
||||
|
||||
float frame_height = ImGui::GetFrameHeightWithSpacing();
|
||||
@@ -958,7 +952,7 @@ namespace imgui_addons
|
||||
|
||||
ImGui::TextWrapped("%s", text.c_str());
|
||||
ImGui::BeginChild("##SupportedExts", ImVec2(0, cw_height), true);
|
||||
for(int i = 0; i < valid_exts.size(); i++)
|
||||
for(std::size_t i = 0; i < valid_exts.size(); i++)
|
||||
ImGui::BulletText("%s", valid_exts[i].c_str());
|
||||
ImGui::EndChild();
|
||||
|
||||
@@ -1010,7 +1004,7 @@ namespace imgui_addons
|
||||
{
|
||||
if(dialog_mode == DialogMode::SELECT)
|
||||
{
|
||||
for(int i = 0; i < subdirs.size(); i++)
|
||||
for(std::size_t i = 0; i < subdirs.size(); i++)
|
||||
{
|
||||
if(subdirs[i].name == selected_fn)
|
||||
{
|
||||
@@ -1022,7 +1016,7 @@ namespace imgui_addons
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i = 0; i < subfiles.size(); i++)
|
||||
for(std::size_t i = 0; i < subfiles.size(); i++)
|
||||
{
|
||||
if(subfiles[i].name == selected_fn)
|
||||
{
|
||||
@@ -1051,7 +1045,7 @@ namespace imgui_addons
|
||||
if(ext == "*.*")
|
||||
return true;
|
||||
}
|
||||
int idx = selected_fn.find_last_of('.');
|
||||
auto idx = selected_fn.find_last_of('.');
|
||||
std::string file_ext = idx == std::string::npos ? "" : selected_fn.substr(idx, selected_fn.length() - idx);
|
||||
return (std::find(valid_exts.begin(), valid_exts.end(), file_ext) != valid_exts.end());
|
||||
}
|
||||
|
||||
@@ -99,7 +99,8 @@ namespace imgui_addons
|
||||
|
||||
ImVec2 min_size, max_size, input_combobox_pos, input_combobox_sz;
|
||||
DialogMode dialog_mode;
|
||||
int filter_mode, col_items_limit, selected_idx, selected_ext_idx;
|
||||
std::size_t filter_mode, col_items_limit, selected_ext_idx;
|
||||
int selected_idx;
|
||||
float col_width, ext_box_width;
|
||||
bool show_hidden, show_inputbar_combobox, is_dir, is_appearing, filter_dirty, validate_file;
|
||||
char input_fn[256];
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace GL{
|
||||
void VBO::bindVertexAttribs() const{
|
||||
for(const VertexAttribPointer& pointer : m_VertexAttribs){
|
||||
glEnableVertexAttribArray(pointer.m_Index);
|
||||
glVertexAttribPointer(pointer.m_Index, pointer.m_Size, GL_FLOAT, false, m_DataStride * sizeof(float), (void*) pointer.m_Offset);
|
||||
glVertexAttribPointer(pointer.m_Index, pointer.m_Size, GL_FLOAT, false, m_DataStride * sizeof(float), (void*)(intptr_t) pointer.m_Offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,13 +98,13 @@ GL::VAO loadWorldModel(const td::game::World* world){
|
||||
positions.push_back(chunkX + tileX + 1);
|
||||
positions.push_back(chunkY + tileY + 1);*/
|
||||
|
||||
const td::game::Color& tileColor = world->getTileColor(tile);
|
||||
const td::game::Color* tileColor = world->getTileColor(tile);
|
||||
|
||||
for (int i = 0; i < 6; i++){
|
||||
int color = 255;
|
||||
color |= tileColor.r << 24;
|
||||
color |= tileColor.g << 16;
|
||||
color |= tileColor.b << 8;
|
||||
color |= tileColor->r << 24;
|
||||
color |= tileColor->g << 16;
|
||||
color |= tileColor->b << 8;
|
||||
|
||||
int newColorIndex = colors.size();
|
||||
colors.push_back(0);
|
||||
|
||||
@@ -35,14 +35,6 @@ int ShaderProgram::getUniformLocation(const std::string& uniformName) const{
|
||||
const int location = glGetUniformLocation(programID, uniformName.c_str());
|
||||
if (location == -1){
|
||||
std::cout << "Warning ! Uniform variable " << uniformName << " not found !\n";
|
||||
const GLenum error = glGetError();
|
||||
switch (error){
|
||||
case GL_INVALID_VALUE:
|
||||
break;
|
||||
|
||||
case GL_INVALID_OPERATION:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return location;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
namespace Display {
|
||||
|
||||
static GLFWwindow* window;
|
||||
static bool closeRequested = false;
|
||||
|
||||
static int lastWidth = 0, lastHeight = 0;
|
||||
static float aspectRatio;
|
||||
@@ -83,7 +82,7 @@ bool isCloseRequested() {
|
||||
return glfwWindowShouldClose(window);
|
||||
}
|
||||
|
||||
const bool isMouseDown(int button) {
|
||||
bool isMouseDown(int button) {
|
||||
return glfwGetMouseButton(window, button);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user