Commit Graph

18853 Commits (master)

Author SHA1 Message Date
Webster Sheets 6092733940
Update Changelog.txt 2020-04-06 15:53:03 -04:00
Webster Sheets 08386499a9
Merge pull request #4849 from Web-eWorks/modelviewer-refactor
Refactor the ModelViewer to use PiGui
2020-04-06 15:51:48 -04:00
Webster Sheets 8e54a3be06 Fix some minor blunders.
Fixes #4853 (faulty initialization) and fixes #4681 (unsupported GLSL version).
2020-04-06 15:00:14 -04:00
Webster Sheets 9d719273fe
Update Changelog.txt 2020-04-04 15:53:54 -04:00
Webster Sheets 8e31d169ee
Merge pull request #4821 from Gliese852/ecraven-systemview-squashed
Move the System Map to PiGUI (#4821)
2020-04-04 15:53:12 -04:00
Andrew Copland 2310827da0 Added a few missing files to the VS build 2020-04-04 20:33:39 +01:00
Andrew Copland f6ebcbe966 Need this include as the array header doesn't appear to be included always 2020-04-04 20:33:18 +01:00
Gliese852 ac7e98248e Additional fixes related (almost) to System Map
- Now only those orbits whose radius is less than 1% of the screen width are not shown.
- Add smooth transition when click object.
- Improve system bodies orbits.
- Fix that ..apsis and lagrange points were displayed in the wrong place.

- After rescanning enums, an error was found in the pigui/Face.h, fixed. fixes #4801
- Some indentations to pass clang
- Added static_cast to Space.cpp, because it caused a warning at compilation.
2020-04-04 16:27:44 +03:00
Gliese852 af5d52cfd9 Move the System Map to PiGUI
The main idea of the interaction of lua side and C++ side is the same as
in the worldview - the C++ View Class builds three-dimensional objects,
some projected points are passed to the lua script, the lua script only
works with screen coordinates.

The difference between the system view and the world view is that not
all objects can have a physical body. If we examine a non-current star
system, we see only system bodies that do not have physical bodies.
Therefore, if for a world view you can simply create an array of
physical bodies, this will not work in a system view.

To solve this problem, struct "Projectable" was created, into which you
can write any point object, system body, ship, Lagrange point,
apocenter, pericenter, etc. Now all these objects can be processed in a
single array.

The names of the types of these objects are recorded in an enum, which
is exported to a enum_table.cpp and read by the script as integers at
the start. I thought it was better to avoid passing strings in such a
hot place in the code. (runs for every object in every frame) Therefore,
type names are written and transmitted as integers.

All colors are now imported from lua: color index names are listed in
the enum, which is exported to the enum_table.cpp. At event
"onGameStart" the lua script reads these names and sends color values to
the class. Now you can change colors at runtime.

* Improvements/fixes: *

- Fix zooming speeds.
- Fix ship's orbits in nonroot frame.
- Remove unused old gui objects.
- Landed ship are now spinning with the planet when rewinding time in a
    planner.
- Now you can center the view on any object, including the player’s ship.
- Add right-click context menu to center or set object as target.
    Therefore, to rotate the view, set the middle button.
- Add indicators for navigation target and combat target.

* Changes in the files explained *

    SystemView.cpp, SystemView.h, system-view-ui.lua, lang/core/en.json

The whole thing, lots of changes. Now the system view draws only the
orbits and the grid. In those places where the icons were drawn, instead
of drawing, they are stored in an array, which is then requested from
the lua.

    LuaEngine.cpp

Add a general function that returns the value of an any enum by name
from an enum_table.cpp (for calling from a lua)

    Space.cpp

Added a notification for the systemview when the ship is removed from
space, because it can be centered at this time, and an segmentation
fault will occur.

    LuaSystemBody.cpp

Added attributes to determine the shape of the icon and set the
navigation target.

    enum_table.cpp, enum_table.h

Rescanned enums to pass color settings and object types between Lua and
C++.

    LuaGame.cpp

The float does not have enough accuracy to display time up to seconds,
change to double.

    icons.svg, themes/default.lua

Add rotate view icon
2020-04-04 11:56:10 +03:00
Webster Sheets b754aeed2a Rewrite ModelViewer to use GuiApplication and PiGui
"Snap to Direction" keybinds don't work, due to Input not dispatching their event handlers.
Will be resolved in a later sprint on the Input system.
2020-04-01 17:04:52 -04:00
Webster Sheets 2ea32811f7 Always clean up the active lifecycle 2020-04-01 17:02:51 -04:00
Webster Sheets ca3fde811f Decouple Input from Pi, add key state tracking
Added IsKeyPressed / Released methods to track per-frame key state
Added GetMouseWheel so users don't have to track mouse wheel events themselves
Input keeps a pointer to a config instance, completely decoupling it from Pi
2020-04-01 17:02:12 -04:00
Webster Sheets 053ff32ef1 Decouple PiGui from Pi::renderer
Explicitly inject the renderer dependency, instead of relying on Pi::renderer existing
Made it Pi.cpp's responsibility to hide the mouse cursor.
2020-03-31 02:50:11 -04:00
Webster Sheets 7b3a69a385 Rename PiGui -> PiGui::Instance
Make PiGui a namespace for easier method scoping, allows us to be more flexible

PiGui::Instance only has the bare minimum of methods needed to run ImGui

Move PiGui RegisterClass call to pigui/PiGuiLua - we'll further unify LuaPiGui
and PiGuiLua later.
2020-03-31 02:08:54 -04:00
Webster Sheets e584780ce9 Move Input and PiGui handling to GuiApplication
At the moment, the lifecycle is responsible for calling HandleEvents and rendering PiGui.
This can change once legacy code no longer depends on HandleEvents running after View::Draw3D().

Added virtual HandleEvent() call to dispatch to legacy UI code.
This is suboptimal; we need a better way that doesn't involve virtual function calls.
Use std::function or a better, lower-overhead delegate library
2020-03-31 00:59:44 -04:00
Webster Sheets a1745867ff Move all Lua initialization out of PiGui.cpp
- Now LuaPiGui handles it, decoupling the PiGui implementation from lua
- Made all externally-facing symbols in LuaPiGui part of the PiGUI namespace
This will be renamed to PiGui and the class of the same name will become part of the namespace.
2020-03-30 23:32:52 -04:00
Webster Sheets 2e44d9302e
Update Changelog.txt 2020-03-29 10:40:25 -04:00
Webster Sheets 8fc4abe4a3
Merge pull request #4845 from Web-eWorks/main-loop-refactor
Refactor Main Loop Paradigm
2020-03-29 10:40:20 -04:00
Webster Sheets 84eb3e051c
Merge pull request #4846 from fluffyfreak/gpu-switch-flags-linux
Cleaned up GPU flags for AMD and comments
2020-03-29 10:38:50 -04:00
Andrew Copland 4d22fd3edb Cleaned up the comments and AMD PowerXpress flag according to AMDs docs 2020-03-29 15:10:01 +01:00
Webster Sheets 7d70c7f75f Don't depend on C++17 features to clear the queue 2020-03-28 13:58:34 -04:00
Webster Sheets fee469c6fd Fix a clobbering noinline declaration 2020-03-28 13:54:03 -04:00
Andrew Copland bdbdf23070 MSVC compilation fixes 2020-03-27 23:12:56 +00:00
Webster Sheets 97828a9ed6 New Main Loop Paradigm
- Fixed an initialization bug in Input.h
- Refactored Intro.h to use delta time updates
- Split our static MainLoop() and Start() functions into Lifecycle objects
- Cleaned up initialization, laid the groundwork for async startup loading
- Added Pi::StartGame() to centralize control over game setup
Previously we were setting Pi::game from a lua callback handler, which was no bueno.
2020-03-27 17:10:40 -04:00
Webster Sheets 027d485e51 Add Application / GuiApplication abstraction
A better way of handling initialization and updates

Still need to incorporate pigui handling into GuiApplication so we don't have to duplicate all of the pigui code
2020-03-27 17:04:07 -04:00
Webster Sheets 0c67f400c9 Clean up header dependencies
A lot of source files were depending on utils.h being included by other headers
Cleaned up code that was depending on Input.h being included in Pi.h
2020-03-27 16:45:17 -04:00
Webster Sheets 2376b050eb Add Profiler::Clock::seconds 2020-03-27 16:42:24 -04:00
Webster Sheets 526207bd21
Update Changelog.txt 2020-03-26 16:47:35 -04:00
Webster Sheets c7638df9ed
Merge pull request #4844 from vakhoir/bugfix/market_msg_lag
Fix Commodity Market Message Lag
2020-03-26 16:47:16 -04:00
Webster Sheets 04059e32a0 Cleanup OS class
Remove unused HFTimer stuff (we have std::chrono instead)
GetNumCores() returns uint32, and can be trusted more reliably
2020-03-26 00:36:47 -04:00
Webster Sheets 64e768e9c5 Change Pi::input to a pointer
Pi.cpp is not included because it's currently being gutted
Decoupled Input::Init() from Pi::config to better support headless mode
2020-03-26 00:34:04 -04:00
vakhoir a9c8422015 Move selection of item in the commodity market to the beginning of the event handler, so everything that follows is executed with the new selection
Remove reset of selected item from CommodityMarket:Refresh
Move reset of selected item to the Commodity Market Tab's refresh handler
2020-03-25 20:18:58 +01:00
Webster Sheets 95dd7d5fbc
Update Changelog.txt 2020-03-25 13:55:48 -04:00
Webster Sheets 0ced0cf264
Merge pull request #4843 from vakhoir/register_modal_module
Cleanup Modal Window manager registration
2020-03-25 13:54:43 -04:00
vakhoir b42a7c62e6 Remove registration of the Modal Window manager from the game and mainMenu modules. Leaving it in the 'modal' module is enough. 2020-03-25 18:11:21 +01:00
Webster Sheets b3e884c9f0
Update Changelog.txt 2020-03-24 15:43:12 -04:00
Webster Sheets a34b23623b
Merge pull request #4842 from Web-eWorks/input-capture-mode
Improve Mouse Capture Handling
2020-03-24 15:42:32 -04:00
Webster Sheets d7e1c897da Remove GITHUB_WORKSPACE in clang-format.sh 2020-03-24 13:13:30 -04:00
Webster Sheets 124f40fd45 Capture mouse only in specific modes
Among other reasons, this makes the cursor visible when interacting with radial menus
Lays more groundwork for better mouse handling
2020-03-24 13:03:23 -04:00
Webster Sheets 03e297dd61 Hide the cursor only when capturing the mouse
Clean up mouse cursor code to use ImGuiMouseCursor_None
Ignore Pi::DrawGUI as it doesn't make sense for cursors
2020-03-24 13:03:23 -04:00
Webster Sheets 8990fbeb96 Add Input::SetCapturingMouse()
Moved mouse capture functionality from the renderer to Input
Temporarily patched ModelViewer, pending a major refactor to make it compatible with the input class.
2020-03-24 13:03:23 -04:00
Webster Sheets 05930f9307 Fix hidden options window in screenshot mode
Opening the options window with Escape while in screenshot mode would
not draw the window, but would steal focus and deadlock the game's input

This is resolved by simply adding a path to draw modals even if
the UI is in "screenshot only" mode, as the escape menu should be
irrespective of that mode.
2020-03-24 13:03:23 -04:00
Webster Sheets 3d6021be23
Fix incorrect clang-format path 2020-03-24 13:00:06 -04:00
Webster Sheets 7dc5c50fe9
Update clang-format.yml
Fix github workflow issues
2020-03-24 00:01:03 -04:00
Webster Sheets bdf76fdca3
Update clang-format.yml
Fix a YAML indentation issue
2020-03-23 23:59:41 -04:00
Webster Sheets 8058b06784
Update Changelog.txt 2020-03-23 23:51:30 -04:00
Webster Sheets 24adc6476f
Merge pull request #4841 from Web-eWorks/clang-format-action
Move clang-format to Github Actions
2020-03-23 23:50:57 -04:00
Webster Sheets b7cfc56b59 Move clang-format to Github Actions
Refactor clang-format, add Github Action
Remove clang-format step from travis
2020-03-23 23:28:39 -04:00
Webster Sheets faf3ffb16c
Update Changelog.txt 2020-03-23 19:13:26 -04:00
Webster Sheets 624e775a6e
Merge pull request #4840 from fluffyfreak/fix4839
Get std::string explicitly from json
2020-03-23 19:12:36 -04:00