Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small pre-release QOL fixes #5326

Merged
merged 4 commits into from
Jan 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions data/pigui/libs/wrappers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ end
-- false otherwise
--
function ui.isAnyWindowHovered()
return ui.isWindowHovered({"AnyWindow", "RectOnly"})
return ui.isWindowHovered({"AnyWindow", "AllowWhenBlockedByPopup", "AllowWhenBlockedByActiveItem"})
end

--
Expand Down Expand Up @@ -506,10 +506,10 @@ function ui.tabBarFont(id, items, font, ...)

pigui.EndTabItem()
end

pigui.EndTabItem()
end

pigui.EndTabBar()

return active_index
end

Expand Down
7 changes: 4 additions & 3 deletions data/pigui/modules/info-view/01-ship-info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ local Event = require 'Event'
local Game = require 'Game'
local Lang = require 'Lang'
local ShipDef = require 'ShipDef'
local ModelSpinner = require 'PiGui.Modules.ModelSpinner'
local InfoView = require 'pigui.views.info-view'
local Vector2 = Vector2

Expand All @@ -16,7 +15,6 @@ local l = Lang.GetResource("ui-core")
local fonts = ui.fonts
local textTable = require 'pigui.libs.text-table'


local equipmentWidget = require 'pigui.libs.ship-equipment'.New("ShipInfo")

local function shipStats()
Expand Down Expand Up @@ -117,5 +115,8 @@ InfoView:registerView({
})

Event.Register("onShipTypeChanged", function(ship)
if ship == Game.player then equipmentWidget:refresh() end
if ship == Game.player then
equipmentWidget.ship = Game.player
equipmentWidget:refresh()
end
end)
3 changes: 2 additions & 1 deletion src/GameConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

#include "GameConfig.h"
#include "FileSystem.h"
#include "core/OS.h"

GameConfig::GameConfig(const map_string &override_)
{
// set defaults
std::map<std::string, std::string> &map = m_map[""];
map["Lang"] = "en";
map["Lang"] = OS::GetUserLangCode();
map["AMD_MESA_HACKS"] = "0";
map["DisableSound"] = "0";
map["StartFullscreen"] = "0";
Expand Down
6 changes: 6 additions & 0 deletions src/SystemView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ void SystemView::ResetViewpoint()
m_transTo *= 0.0;
m_animateTransition = MAX_TRANSITION_FRAMES;

if (!m_renderer) return;

float height = tan(DEG2RAD(CAMERA_FOV)) * 30.0f;
m_atlasViewW = height * m_renderer->GetDisplayAspect();
m_atlasViewH = height;
Expand Down Expand Up @@ -687,6 +689,10 @@ void SystemView::DrawAtlasView()
m_renderer->SetTransform(cameraTrans * gridTransform);
DrawGrid(64.0);

// Don't draw bodies in unexplored systems
if (m_unexplored)
return;

// Draw the system atlas layout, offsetting the position to ensure it's roughly centered on the grid
RenderAtlasBody(m_atlasLayout, vector3f{ -m_atlasPosDefault.x, m_atlasPosDefault.y, 0.0f }, cameraTrans);
}
Expand Down
2 changes: 1 addition & 1 deletion src/SystemView.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct Projectable {
} ref;
vector3d screenpos; // x,y - screen coordinate, z - in NDC
vector3d worldpos;
float screensize; // approximate size in screen pixels
float screensize = 0.f; // approximate size in screen pixels

Projectable(const types t, const bases b, const Body *obj) :
type(t), base(b)
Expand Down
3 changes: 2 additions & 1 deletion src/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#include "View.h"
#include "Pi.h"

View::View()
View::View() :
m_renderer(nullptr)
{
}

Expand Down
4 changes: 4 additions & 0 deletions src/core/OS.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ namespace OS {
// return a string describing the operating system that the game is running on, useful!
const std::string GetOSInfoString();

// return a two-character language code detected from the OS environment
// If the OS environment language cannot be detected, returns "en"
const std::string GetUserLangCode();

// Enable Google breakpad for crash minidumps
void EnableBreakpad();

Expand Down
7 changes: 7 additions & 0 deletions src/posix/OSPosix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ namespace OS {
return std::string(infoString);
}

const std::string GetUserLangCode()
{
// assume $LANG is in the format en_US.utf8
const char *env_lang = getenv("LANG");
return std::string(env_lang ? env_lang : "en").substr(0, 2);
}

void EnableBreakpad()
{
// Support for Mac and Linux should be added
Expand Down
6 changes: 6 additions & 0 deletions src/win32/OSWin32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ namespace OS {
return hwInfo + name;
}

const std::string GetUserLangCode()
{
// TODO: implement me
return "en";
}

#ifdef WITH_BREAKPAD
/////////////////////////////////////////////////////// Google Breakpad
bool FilterCallback(void *context, EXCEPTION_POINTERS *exinfo,
Expand Down