Compare commits

...

1449 Commits
0.0.4 ... cubed

Author SHA1 Message Date
Acruid
0d356eb8f7 Removed wrong assert, rebase damage? 2021-03-13 00:29:37 -08:00
Adam Coggeshall
457705ae9c Improve 3D render bounds + draw order. 2021-03-13 00:15:46 -08:00
Adam Coggeshall
a9d8fed436 Fix 3D grid culling. 2021-03-13 00:15:45 -08:00
Adam Coggeshall
72bcc4a35e Increase accuracy of angle -> direction conversons for sprites. 2021-03-13 00:15:45 -08:00
Adam Coggeshall
0f0d47c629 Make 3D sprites rotate based on camera rotation. 2021-03-13 00:15:45 -08:00
Adam Coggeshall
027e36f125 Enable depth buffer and 3D wall rendering 2021-03-13 00:15:44 -08:00
Adam Coggeshall
298efa3a91 Add 3D sprite rendering modes + very dumb mode inference system. 2021-03-13 00:15:44 -08:00
Adam Coggeshall
8c335fc5d0 Add 3D sprites. 2021-03-13 00:15:44 -08:00
Adam Coggeshall
2a2c97e5ba 3D sprites work but are untextured. 2021-03-13 00:15:43 -08:00
Adam Coggeshall
117f4a94c2 Very basic 3D maybe almost works? 2021-03-13 00:15:43 -08:00
Adam Coggeshall
a692dc7817 Progress on 3D rendering (DOES NOT BUILD) 2021-03-13 00:15:42 -08:00
Adam Coggeshall
c8b2394dfb Add toggle-able 3D rendering mode. 2021-03-13 00:15:42 -08:00
Adam Coggeshall
4417f685ac Add support for 3D view/proj matrices. 2021-03-13 00:15:42 -08:00
Pieter-Jan Briers
fc9f7827d5 Remove package dir override. 2020-01-28 16:06:06 +01:00
DamianX
8e19f7f14c Workaround for the discord rich presence library spamming the logs (#942) 2020-01-27 07:29:42 +01:00
Pieter-Jan Briers
ada2c3f39c Fix handling of disconnects in the integration test netmanager.
Clients would treat any message coming in as being from the server they're connected to, instead of ignoring them if they're not correct.

This made the client crash inside integration tests because messages came in while disconnected.

This fixes that.
2020-01-26 23:51:57 +01:00
Pieter-Jan Briers
11f4f3820c Skip entity drawing if we are in nullspace. 2020-01-26 18:34:40 +01:00
Pieter-Jan Briers
d3997b51e8 Add assert that function in InputSystem.HandleInputCommand is correct. 2020-01-26 03:32:12 +01:00
Pieter-Jan Briers
2a3624c89c Add debugging to ModLoader.cs 2020-01-25 23:16:16 +01:00
Pieter-Jan Briers
62b31d36a4 Uhhh try to figure out why the public server is brokn. 2020-01-25 22:41:10 +01:00
Acruid
f33f9a7b52 Move raycasting into the broadphase algorithm.
Raycasts now require a MapID so that the ray is restricted to a single map.
2020-01-25 12:14:09 -08:00
Pieter-Jan Briers
467dd0dc28 Fix threaded lazy loading of content assembly dependencies.
This is necessary because content now loads the preferences database from the thread pool. This causes the assembly loads for that (they're lazy by the runtime) to run in that thread, which means that the resolver callback we set up in ModLoader did not work (it has to do an IoC resolve).

This change creates a new AssemblyLoadContext for every ModLoader and as such we can tie the loading in said context to a specific ModLoader, thus cutting out the need for a static IoC resolve.

This also paves the way to assembly unloadability a bit.
2020-01-25 20:39:07 +01:00
Pieter-Jan Briers
768121bc57 Fix popups going off-screen with a new PopupContainer. 2020-01-25 17:26:37 +01:00
Pieter-Jan Briers
3d11cf2f87 No running AssemblyTypeChecker unless necessary, use less dumb byte copies. 2020-01-25 16:27:30 +01:00
Acruid
4eb29a9e80 Removed GridCoordinates.ConvertToGrid because it is completely pointless.
Removed GridCoordinates.ToWorld in preparation for removing Map Default Grids.
2020-01-25 01:37:37 -08:00
Acruid
42932b3ff6 Adds IMapGrid.CollidesWithGrid() which tests if a point is actually inside a non-empty tile. 2020-01-24 17:10:05 -08:00
Acruid
9f956cef95 Renamed SpawnEntityAt to SpawnEntity.
SpawnEntity now throws an exception if an invalid GridID is passed in the coordinates.
2020-01-24 15:44:08 -08:00
Acruid
bd7b316f1d Pulled all entity spatial queries up from client/server EntityManagers to shared EntityManager. 2020-01-24 14:53:12 -08:00
Acruid
df9be436c4 Removed the StateType property from every component. This field was completely unused except for a debug assertion. 2020-01-24 14:07:46 -08:00
Pieter-Jan Briers
6870cef9e6 Fix YamlException handling in PrototypeManager.LoadDirectory 2020-01-24 16:38:43 +01:00
Pieter-Jan Briers
5fd0718f6a Add error log to SpriteSpecifierExt.Frame0. 2020-01-24 16:31:46 +01:00
Pieter-Jan Briers
343667442b Make MarshalHelper.cs use .NET Core 3 Marshal functions. 2020-01-24 13:18:39 +01:00
Pieter-Jan Briers
9fd675a8b9 Handle SIGTERM on Linux again. 2020-01-24 01:33:31 +01:00
Pieter-Jan Briers
e10707982c Add assertions to Control.cs 2020-01-24 00:49:10 +01:00
Pieter-Jan Briers
4b5cf26153 Try to fix Windows builds... (#939)
* Try to fix Windows builds...

* AppVeyor stop being drunk.

* Attempt 3
2020-01-23 00:42:00 +01:00
Pieter-Jan Briers
9b8c122f03 Enable nullability for Robust.Shared.Maths 2020-01-22 23:56:13 +01:00
Pieter-Jan Briers
766e2c81e2 Fixes debug coords panel throwing in main menu.
Fixes #938
2020-01-22 23:55:41 +01:00
Pieter-Jan Briers
a4bf3161fc Clyde windowing improvements:
Pauses rendering if the window is minimized.
Fixes #931

I apologize in advanced for the non-atomic commit.
2020-01-22 23:45:12 +01:00
Pieter-Jan Briers
4a3aacedea I am a very big idiot. 2020-01-22 20:24:48 +01:00
Pieter-Jan Briers
f360978973 Fix spaces in filenames of build directory. 2020-01-22 20:23:32 +01:00
Pieter-Jan Briers
d945247f31 Add necessary infrastructure to allow content to launch game from itself.
This allows us to make Content.Client and Content.Server Exe projects so that they can be executed directly via your IDE. This'll help wtih not forgetting to do a full rebuild and such.
2020-01-22 20:16:29 +01:00
Pieter-Jan Briers
997f1c031f Use shutil.copy2 instead of shutil.copyfile for git_helper.py 2020-01-22 17:09:17 +01:00
Tad Hardesty
613368edde Fix Sonar warnings in MidiRenderer (#937) 2020-01-22 08:23:57 +01:00
L.E.D
33a62127a9 Assert for normalized direction vector (#936) 2020-01-21 23:28:37 +01:00
Pieter-Jan Briers
28fe0313d1 Added stencil testing support to shader instances. 2020-01-21 18:10:44 +01:00
moneyl
8f16b188dd Add delete key behavior to LineEdit (#934)
* Add delete key behavior to LineEdit

Pressing delete will now delete the character in front of your cursor like usual.

* Update Robust.Client/UserInterface/Controls/LineEdit.cs

Co-Authored-By: Pieter-Jan Briers <pieterjan.briers@gmail.com>

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
2020-01-21 18:10:26 +01:00
DamianX
ae1e9c3a71 Entity spawn window's search bar grabs keyboard focus (#928) 2020-01-21 18:10:04 +01:00
moneyl
d1dc84c632 Fix crash when minimizing game window (#933)
Returns early if the window or framebuffer width or height = 0 to avoid dividing by zero. Checked the vector components individually instead of using `Vector2i.Equals()` because you can end up in a situation where width is non-zero and height is zero if you manually resize the window instead of using the minimize button.
2020-01-21 03:18:11 +01:00
Pieter-Jan Briers
861e19da76 Clarify terminology in debug memory panel. 2020-01-21 02:11:09 +01:00
Pieter-Jan Briers
3ab02acf46 Try to avoid server integration tests causing weird output on Travis. 2020-01-20 22:36:31 +01:00
Pieter-Jan Briers
103fca8bc7 Add MapCoordinates.Nullspace. 2020-01-20 22:26:04 +01:00
Pieter-Jan Briers
dd98f3cbad Adds IntegrationInstance.Assert to aid using assertions. 2020-01-20 22:09:15 +01:00
Pieter-Jan Briers
e7ccef53de Update NuGet dependencies. 2020-01-20 20:41:01 +01:00
Pieter-Jan Briers
4e3f5508e9 Custom command line args & CVar override on Client. 2020-01-20 20:33:11 +01:00
Pieter-Jan Briers
a2ea21c3c5 Gave custom command line parser an "unknown argument" error condition. 2020-01-20 20:32:53 +01:00
Pieter-Jan Briers
e2bbffd509 Fix CVar overriding not running ValueChanged correctly. 2020-01-20 20:32:36 +01:00
Pieter-Jan Briers
0e721feea3 Add --cvar command line option.
Also rewrote the command line parser to be manual. Removes a dependency, speeds it up, and actually makes --cvar capable of using a sane syntax.
2020-01-20 19:49:07 +01:00
Pieter-Jan Briers
ab465d2af8 Fix unit tests. 2020-01-20 18:47:44 +01:00
Pieter-Jan Briers
9b77ba4605 Fix building on release. 2020-01-20 18:40:53 +01:00
Pieter-Jan Briers
132f15b32d Rendering optimizations. 2020-01-20 17:45:33 +01:00
Acruid
6249ae8d0d Fixes issue where map entity was not being deleted from Nullspace on restart. 2020-01-20 00:04:13 -08:00
Pieter-Jan Briers
0cda9ecbee Fix sprites not cloning the serialization cache correctly. 2020-01-20 08:17:29 +01:00
Pieter-Jan Briers
ae85645e23 IRobustRandom.Shuffle<T>(IList<T>) 2020-01-19 19:07:12 +01:00
Pieter-Jan Briers
237c6e433c dumpentities command is now sorted. 2020-01-19 12:41:41 +01:00
Pieter-Jan Briers
dfc1e99092 Fix OptionButton throwing an exception when the first item added doesn't have ID 0. 2020-01-19 03:17:08 +01:00
Pieter-Jan Briers
1f0ec7fa68 Pulling down debug console no longer captures all mouse input. 2020-01-18 03:18:33 +01:00
DamianX
18f90bd125 HOME and END keys work in LineEdit (#929) 2020-01-16 13:19:47 +01:00
Pieter-Jan Briers
22cf53fd1c Optimizations:
Use PLINQ for prototype loading. Most of the time is spent reading YAML so this should help a lot.
Don't regenerate collision for every tile placed by the map loader.
2020-01-15 16:13:22 +01:00
Pieter-Jan Briers
0739367013 Fix a bunch of compiler warnings. 2020-01-15 14:50:46 +01:00
Pieter-Jan Briers
d14348dfa5 Ignore framework version warnings. 2020-01-15 14:39:21 +01:00
Pieter-Jan Briers
0348919104 Implement Slider UI control. 2020-01-15 14:10:05 +01:00
Pieter-Jan Briers
414a264ea9 Adds Range.SetAsRatio. 2020-01-15 14:10:05 +01:00
Pieter-Jan Briers
c09fc5f021 TabContainer no longer crashes on controls without name. 2020-01-15 14:10:05 +01:00
Pieter-Jan Briers
b458dd96a3 Fix Clyde erroneously culling on chunk rendering.
Fixes #912
2020-01-15 14:10:05 +01:00
Acruid
ed134da488 MapManager_Tests now work on both client and server sides. 2020-01-15 03:07:37 -08:00
Acruid
32db0f82f1 Grid chunks now use the GridChunkPartition method for generating a set of collision rectangles and their bounds.
Grid collision rectangles are now drawn as a blue overlay in the CollisionOverlay debug view.
GridChunkPartition now also returns the bounding rectangle, which is a union of all the collision rectangles.
Each IPhysShape now handles it's own debug drawing with a new method, DebugDraw.
2020-01-13 13:40:09 -08:00
Acruid
6817969c8b Adds a helper class that can partition a map grid chunk into a set of rectangles. 2020-01-13 11:23:35 -08:00
Pieter-Jan Briers
5c77c1a8b8 Color.[Try]FromHex now takes ROS<char> and no longer allocates.
Also added a test to ensure it works.
2020-01-12 01:56:27 +01:00
Acruid
30db86fae8 Collidable Components are now added to grids when they are created. 2020-01-11 15:13:15 -08:00
Acruid
78a33076f9 Merged client and server CollidableComponent into a shared version. Now shared code can add collidable components to entities. 2020-01-11 14:10:25 -08:00
Acruid
7a77fa59e2 Switched physics collision broadphase from spatial partition to Naive.
Grid->Grid collision works.
2020-01-10 15:39:34 -08:00
Acruid
22bf1516cf Adds the new PhysShapeGrid.
Grids now have their own collision group.
2020-01-09 18:26:54 -08:00
Pieter-Jan Briers
14116cdbdf Fix LayoutContainer on HiDPI. 2020-01-09 03:12:35 +01:00
Pieter-Jan Briers
74a940ca9e Apparently that's not how window scaling works in GLFW.
Fixes mouse input issues on certain non-macOS platforms.
2020-01-09 03:09:16 +01:00
Pieter-Jan Briers
7339be51fe Fix unit test. 2020-01-09 00:42:54 +01:00
Pieter-Jan Briers
dadaa3fb8f Very basic GUI animations. 2020-01-09 00:13:37 +01:00
Acruid
150c899f6f Removed generic constraints from TryGetComponent<T> to match all the other functions. 2020-01-08 15:12:24 -08:00
moneyl
928a5e3521 Fix the entity spawn panel clear button (#926)
Previously the entity spawn panel clear button caused nothing to show up. This fixes that so it rebuilds the entity list with a empty search.
2020-01-08 17:37:13 +01:00
ShadowCommander
5037ace00b Fix mouse input on HiDPI monitors (#927) 2020-01-08 11:50:25 +01:00
Pieter-Jan Briers
3faa52ee01 Call MinimumSizeChanged on AddChild and RemoveChild. 2020-01-05 15:47:27 +01:00
Pieter-Jan Briers
7d8992e0ca Some doc comments for type abbreviations. 2020-01-05 15:42:20 +01:00
Pieter-Jan Briers
131a1ee3bd Type Abbreviation utility.
Just to neaten up VV a little.
2020-01-05 01:51:25 +01:00
Acruid
ba390ba466 Hopefully fixes the client freezing when a GameState is lost in transit (or is never sent). 2020-01-04 16:19:19 -08:00
Pieter-Jan Briers
a69738a7a4 Terrible fix for physics crashes. 2020-01-05 00:48:45 +01:00
Acruid
8d30bcb041 Added a ShowContents flag to containers so that the contents can be rendered.
Added `bool TryGetContainer(IEntity, out IContainer)` to containers.
Changed the API of ContainerHelpers.
2020-01-03 15:16:07 -08:00
Pieter-Jan Briers
da579d6b57 Replace a glBufferSubData call with a glBufferData call.
No real reason to subdata this.
2020-01-02 11:16:18 +01:00
Pieter-Jan Briers
4e6906fa7f Remove unused code in Clyde.Windowing.cs 2020-01-02 02:04:08 +01:00
Pieter-Jan Briers
45c77e10a1 Console command to add component to entity. 2020-01-02 02:04:08 +01:00
Acruid
4a900cbd7f Removed IoCManager.Resolve calls from IMapGrid. 2019-12-29 23:20:36 -08:00
Acruid
9b5b8205b9 Renamed GridCoordinates.Nullspace to GridCoordinates.InvalidGrid, because it has nothing to do with Nullspace anymore. 2019-12-29 18:12:29 -08:00
Acruid
37aee07596 Rename GridId.Nullspace to GridId.Invalid, because it has nothing to do with Nullspace anymore. 2019-12-29 18:02:02 -08:00
Acruid
58d0a771e8 TransformComponent.GridID now returns GridID.Nullspace instead of throwing when the entity in question is not on a grid.
Added MapManager.Restart().
Added MapManager.CreateNewMapEntity() and MapManager.SetMapEntity() for manipulating the map root entity.
You can now spawn entities directly into Nullspace, after setting up the Nullspace map entity.
2019-12-29 16:08:46 -08:00
Pieter-Jan Briers
aa3e126249 Fix dump entities command blowing up due to grid entities. 2019-12-29 01:20:43 +01:00
Pieter-Jan Briers
1c39a36297 Fix SpriteComponent not respecting SetAutoAnimated anymore. 2019-12-29 01:20:31 +01:00
Pieter-Jan Briers
259f6c8ea4 Fix bullets crashing the server.
This is not a proper fix. A proper fix would be a better physics engine.

But as it stands I really wanna get a progress report out and having to refactor physics to do it would just suck.
2019-12-29 01:06:57 +01:00
Pieter-Jan Briers
6d8bfcc7bb Avoid breaking batching on every shader change.
This fixes batching not working for sprite layers. They'd set & reset the active shader constantly which broke batching.

Active shader is now part of batch meta data and broken like other data like textures.
2019-12-28 13:25:28 +01:00
Pieter-Jan Briers
900910e4de Fix crime of using static for stock Textures. 2019-12-28 12:52:19 +01:00
Pieter-Jan Briers
3f979ef7f2 Fix crash on server shutdown.
This also fixes integration tests.
2019-12-28 12:45:29 +01:00
Acruid
1a4196697f Refactors HandleEntityState off of Entity.
Refactors GetEntityState off of Entity.
IComponentManager.GetNetComponents(EntityUid) now returns deleted entities.
2019-12-27 21:41:12 -08:00
Pieter-Jan Briers
a76191c138 Use R11FG11FB10F for lighting framebuffer.
This halves the memory necessary for the lighting framebuffer, so probably helps with bandwidth usage (especially on integrated GPUs) too.

I couldn't notice a decline in visual quality on my (admittedly) bad laptop screen.
2019-12-28 03:28:41 +01:00
Pieter-Jan Briers
cb563c75fd Update map loader to work with grid entities. 2019-12-28 03:22:09 +01:00
Pieter-Jan Briers
472bd67ace Fix edge sliding.
The "too close" threshold on Transform WorldPosition set was way too high, so the low movement speed when edge sliding was seen as not moving at all.
2019-12-24 15:26:23 +01:00
Pieter-Jan Briers
2f94beb4b5 Fix ContainerManagerComponent.ContainsEntity not returning correct results for multiple containers. 2019-12-24 15:16:14 +01:00
Pieter-Jan Briers
47d4a8f628 Improve ModLoader to fix loading issues for Dapper.dll 2019-12-24 02:52:38 +01:00
Pieter-Jan Briers
3c08f56619 Sprite orientation improvements (#917)
* Fold animation delays into a single set for all directions.

* Update systems to use new RSI animations API.

* Fetching layer directions now done in sprite render.

* Allow overriding direction in SpriteView.
2019-12-24 01:15:44 +01:00
Pieter-Jan Briers
761b06d68a Add threading assertions to IoCManager. 2019-12-22 21:47:00 +01:00
Pieter-Jan Briers
2b037c3bf2 Synchronize containers to the client. 2019-12-22 21:43:03 +01:00
Pieter-Jan Briers
f2c8b343bb Fix initialize not getting called for components added during initialize. 2019-12-22 21:42:30 +01:00
Pieter-Jan Briers
531cfeb9e6 KVPair<K, V> now shows in VV. Client only. 2019-12-22 21:38:21 +01:00
Pieter-Jan Briers
21b29e26e2 Fix a bunch of warnings. 2019-12-22 13:50:29 +01:00
Pieter-Jan Briers
2b8645b60f Fix some Robust.Server namespaces in Robust.Shared. 2019-12-22 13:40:43 +01:00
Acruid
f5c0dba194 Map & Grid Entities (#916)
* Adds Map components to the ECS system.

* Grid entities are now created along with map grids.
Grid components are now properly reused from map deserialization when a grid is created through the MapManager.

* Make MapGridComponent shared.
Don't send Nullspace default grid to client, they have their own.
Properly link the new grid with the entity sent from the server.

* Fixes nullRefException when ToString() is called on an Entity with no Prototype.

* Adds logging debug info about binding a map/grid to an entity.
Nightly Commit.

* Client map networking now properly pivots a grid from the client entity to the shared entity.
Added IMapGridComponent.ClearGridId() to properly dissociate the component from a grid before deleting it.
WorldPosition of a default grid is always 0,0 regardless of the entity transform (if any).
Nullspace map and default grid are not bound to an entity.
Nullspace map and default grid cannot be deleted.

* Map Entities are now created along with new maps.

* Client & Server load with new scene hierarchy.

* Fix rebase damage.

* Added ContainerHelpers helper class.

* Fix Container checks.

* Fixed clothes.

* Fixing unit tests.

* Removed disabled code.

* Actually initialize and startup the Map and Grid entities.
2019-12-21 22:11:17 +01:00
Acruid
2c7630f4f1 Adds assertions in various places to make sure entities are being initialized properly before the game state is built. 2019-12-19 11:16:43 -08:00
Pieter-Jan Briers
610bfea95c Clyde improvements.
Reduced the amount of buffer data calls to the OpenGL driver significantly, cleaned some code up to make it easier to extend Clyde.
2019-12-18 12:21:52 +01:00
Pieter-Jan Briers
6c0c395dc7 Remove lite stuff from Clyde. 2019-12-17 19:25:05 +01:00
Pieter-Jan Briers
99f96aee27 Remove Robust.Lite 2019-12-17 16:09:55 +01:00
Pieter-Jan Briers
d075c82041 Switch to C# 8 2019-12-17 16:06:46 +01:00
DamianX
f71d72d88c Added Sqlite dependency (#915) 2019-12-17 15:58:21 +01:00
Acruid
df34ce025a Entities now require a location when being spawned. 2019-12-16 21:43:24 -08:00
DamianX
5ff164e762 Expose IWritableDirProvider.RootDir (#913)
* Expose IWritableDirProvider.UserDir

* Update WritableDirProvider.cs
2019-12-16 09:56:37 +01:00
Pieter-Jan Briers
9f7a1e066b Try to fix crash loop on game server 2019-12-16 01:03:55 +01:00
Pieter-Jan Briers
58dcea5bda Try to fix AppVeyor. 2019-12-15 22:31:29 +01:00
Pieter-Jan Briers
3f0032911a Try to fix travis.. 2019-12-15 22:28:33 +01:00
Pieter-Jan Briers
c8c17da176 Remove reference to System.Net.Http. 2019-12-15 22:26:48 +01:00
Pieter-Jan Briers
08ba611fe6 Forgot to commit the travis script. 2019-12-15 22:24:33 +01:00
Pieter-Jan Briers
7442f52297 Try to fix CI. 2019-12-15 22:22:24 +01:00
Pieter-Jan Briers
ba80ba5cc1 Try to fix CI. 2019-12-15 22:17:18 +01:00
Pieter-Jan Briers
1db0694541 Try to fix CI. 2019-12-15 22:13:54 +01:00
Pieter-Jan Briers
f6b894f274 .NET Core time. 2019-12-15 16:01:08 +01:00
Pieter-Jan Briers
52e5afd277 Switch to GLFW for windowing (#914)
* Use GLFW instead of OpenTK windows

* Seems to work pretty well now.

* Fix stackalloc issue on Framework.

* Add GLFW project to sln.

* Fix package downgrade.

* Fix SLN more.

* Please work.

* Fix C# version error.
2019-12-15 15:53:30 +01:00
Pieter-Jan Briers
1899544500 Server optimizations.
1. NetManager.IsConnected no longer uses LINQ.
2. creating net messages for sending/receiving now uses cached DynamicMethods to improve speed (bypasses Activator.CreateInstance and params allocations)
3. Entity.GetComponentStates uses GetNetComponents now.
4. PhysicsManager allocates significantly less now.
2019-12-11 17:08:46 +01:00
Pieter-Jan Briers
f893d308ad Cut cruft from DebugCoordsPanel. 2019-12-11 07:50:19 +01:00
Pieter-Jan Briers
2fc8e6af46 Remove dependency on ConcurrentDataStructures by pulling in their PriorityQueue<T> implementation. 2019-12-11 07:16:52 +01:00
Pieter-Jan Briers
3095952dcb Use our own SpaceWizards.SharpFont for better .NET Core support. 2019-12-11 06:46:26 +01:00
Acruid
ea8e5e9fe7 EventBus Refactor (#909)
* Extracts the ECS event system out of EntityManager, and into a new class called EventBus.
XML Docs and full test coverage for EventBus.
2019-12-08 19:36:52 -08:00
Pieter-Jan Briers
026f6cb118 Use new icon 2019-12-06 17:38:08 +01:00
Pieter-Jan Briers
12787db8de Avoid crash in Clyde if the GLSL compiler optimizes out uniforms. 2019-12-06 02:29:58 +01:00
Pieter-Jan Briers
31fb926127 Remove selection outline code from ClickableComponent 2019-12-06 01:18:37 +01:00
Pieter-Jan Briers
66ea13684b Remove GameScreen from engine. 2019-12-06 00:40:37 +01:00
Pieter-Jan Briers
69ff3638ba Make framegraph not catch clicks. 2019-12-06 00:10:14 +01:00
Pieter-Jan Briers
6cfe6caae2 guidump lists attached properties. 2019-12-05 15:37:11 +01:00
Pieter-Jan Briers
ab1f4fb0e7 UI layout v2. (#908)
* UI layout v2.

All controls now act like containers.
Moved anchor/margin layout model to LayoutContainer

Implement basic WPF-like attached properties for the above LayoutContainer.

* Fix VV.
2019-12-05 13:37:58 +01:00
Pieter-Jan Briers
9b15070126 Remove allocations from PhysicsSystem HandleMovement.
LINQ is bad alright.
This removes approx 20% of allocations on the server.
2019-12-04 13:48:45 +01:00
Pieter-Jan Briers
4eb100076d Entity spawn window no longer lags when opening. 2019-12-04 13:26:37 +01:00
Pieter-Jan Briers
6156a9eae8 Fix crash on detaching from deleted entity. 2019-12-04 02:16:20 +01:00
Pieter-Jan Briers
2e762fbaf4 Give RSISchema.json a logical name in the csproj.
This *should* fix random occurrences of the compiler putting it somewhere else and the schema failing to load.
2019-12-01 15:15:57 +01:00
Pieter-Jan Briers
dec9ea744d Static localization manager class for convenience. 2019-12-01 15:13:00 +01:00
Pieter-Jan Briers
89094458cd Add documentation to ILocalizationManager 2019-12-01 15:12:35 +01:00
Pieter-Jan Briers
31adf9e4fc Mention thread locality in IoCManager documentation. 2019-12-01 15:12:06 +01:00
Pieter-Jan Briers
563cc262cb Add !Deleted assertion to Entity.GetComponent() 2019-12-01 15:08:53 +01:00
Pieter-Jan Briers
13ef4e8423 Various optimizations focused on the entity spawn panel:
Give BoxContainer a preset capacity to reduce allocations in layout.

Removed Control.GetChild(string) and similar. This was no longer used (and was a pretty bad idea in general), and the implementation had a lot of wasted book keeping to do.

Use UpdateLayout() instead of DoUpdateLayout() in Control minsize changed to avoid doing redundant layout, and by extension style & minsize, updates.

Used RemoveAllChildren instead of DisposeAllChildren in EntitySpawnWindow because it's faster (way less stuff to clear, just let the GC handle it).

Optimized ResourcePath with a better GetHashCode(), better Equals, replacement for List<T>.ToArray()

Fixed enumerator allocations in stylesheet SelectorElement matching to speed up style updates.

ResourceCache now caches fallbacks to avoid constructing Resource instance when fetching fallback explicitly.

ResourceCache now has nested dictionaries for Type -> ResourcePath -> BaseResource storage of resources.

Use calculated property instead of auto property for TextureResource.Fallback
2019-11-28 14:19:02 +01:00
Pieter-Jan Briers
f3669e6646 Sound system improvements.
This just makes the sound system more flexible so content can do more stuff.
2019-11-27 00:33:54 +01:00
Acruid
d9a411b260 Shared IMap/Map class removal (#904)
* Moved IMap from Shared/Interfaces/Map to Shared/Map namespace.

* Extracted Map class out of the MapManager class.

* Removed the Map class and interface.

* Fully removed the Map and IMap class.
2019-11-26 20:47:04 +01:00
Acruid
9de0c9b299 Adds the RemoveMap concommand rmmap to the engine.
Adds the RemoveGrid concommand `rmgrid` to the engine.
2019-11-25 23:13:07 -08:00
Acruid
73e89f9e27 Fixes a bug where the using the TP player command with a destination on top of a grid resulted in the player teleporting to the wrong location. 2019-11-24 15:45:01 -08:00
Peter Wedder
063c30e2bf Scrollbar minimum size (#903) 2019-11-24 11:35:52 +01:00
ShadowCommander
1263e10f5e Add exception to catch rendering deleted entities in UI (#902) 2019-11-24 10:44:42 +01:00
Pieter-Jan Briers
36822462ba Improve ray debug drawing.
Fixes unit tests.
Made ray color change if successful hit.
Made ray length based on actual ray results.
2019-11-24 00:44:47 +01:00
Ephememory
519c28cad2 Add a DebugDrawingManager for drawing server side events like Ra… (#892)
* add basis for debug drawing raycasts

* rays

* this was too much work

* i assumed you could do string object stuff. you cant.

* fixed a crash

* Greatly improved DebugDrawingManager code with a struct and list as opposed to dictionary

* change default ray debug color from green to magenta

* reviewed changes

* reviewed changes and adds network message to physicsmanager so it works without much user config
2019-11-23 13:09:48 +01:00
Acruid
e82f969589 Adds missing using statement, Master compiles again. 2019-11-22 15:04:29 -08:00
DamianX
c67a1475f9 Added Color.TryFromHex (#900) 2019-11-22 19:50:58 +01:00
Pieter-Jan Briers
1353dde41d Implement shader instances and uniforms. 2019-11-22 17:55:39 +01:00
Pieter-Jan Briers
a9ce50a6a5 Invert icon cutout.
This fixes the ugly border around the exported png.
2019-11-22 12:53:09 +01:00
ShadowCommander
134141feaf Implement SpawnRepeating (#898)
* Implement SpawnRepeating

Allows repeating timer events to be used.

* Update doc comments
2019-11-21 23:21:14 +01:00
DamianX
844e9776f3 Public YamlMappingFix (#897) 2019-11-21 20:27:19 +01:00
Ephememory
cbe2fe698a Fix window width/height being equal to 0 equal game crash (#896)
* Fix window width/height being equal to 0 equal game crash

* suggested changes
2019-11-18 19:11:55 -08:00
Pieter-Jan Briers
da440bbf28 Use new logo 2019-11-18 00:51:07 +01:00
Pieter-Jan Briers
5025178203 Very shitty allocation rate tracker. 2019-11-17 22:31:21 +01:00
ShadowCommander
1493f67c94 Add to OptionButton and SpinBox (#893)
* Add prefix to OptionButton

* Add validation to SpinBox
2019-11-17 18:38:56 +01:00
Pieter-Jan Briers
07b0548532 Input monitor. 2019-11-17 17:28:20 +01:00
bgare89
d3e7e12adf Code smell for loop braces (#884)
* Use curly braces or indentation to denote the code conditionally executed by this 'for'

* 7 less code smells.
2019-11-13 22:42:27 +01:00
Pieter-Jan Briers
89f6a0917a I'm bad at coding 2019-11-12 19:36:59 +01:00
Pieter-Jan Briers
a3879b7bbd Remove outline shaders from engine 2019-11-12 18:47:39 +01:00
Pieter-Jan Briers
64112c556e Work to make the client launchable by launcher. 2019-11-11 08:36:13 +01:00
bgare89
a7abfcdf0f CodeSmell: The variable 'e' is declared but never used (#883) 2019-11-10 16:39:14 +01:00
Pieter-Jan Briers
344325c9a4 Enable status always, add connection redirect address to status under /info. 2019-11-09 13:21:23 +01:00
Víctor Aguilera Puerto
ffe506ef94 Adds Midi playback, Midi input, etc. (#873)
* raw PCM audio for clyde

* Remove soundfont.cs

* Midi stuff

* Some more work

* This actually works now!

* update

* Add nfluidsynth submodule.

* fuck

* Midi audio works!

* Lots of stuff, and cool interfaces for items

* Update

* Note limit

* Moving out of range of UI raises OnClosed now as well

* It just works

* Update nfluidsynth submodule

* Remove managed-midi, remove unused methods I added to clyde

* Remove remnants of older NFluidsynth

* Update nfluidsynth submodule.

* Fix some of MidiManager

* Add changes PJB made to soundfont loading

* Delete OpenAL source/buffers when disposed

* Remove remnants of "Rendering"

* Use ReadOnlySpan, make interface/implementation arguments consistent

* Improve EmptyBuffers performance

* Make renderers use an enum for their status

* MidiRenderer events are now invoked on the main thread

* MidiManager now has a method to dispose renderers

* Lock player

* Fun stuff

* Update nfluidsynth submodule.

* Fix midi audio rendering

* Address a few reviews

* Revert changes made to Clyde

* Create sfloader per midi renderer

* Midi file size check

* Now OpenMidi/OpenInput and their respective close methods return bools.

* Update nfluidsynth submodule.

* Move number to constant.

* Use BufferedAudioSource

* Remove unused using statements

* Use new API

* Lock player and synth correctly

* Use midi sawmill

* Adds "Disposed" property to MidiRenderer

* Remove DisposeRenderer, let midi render thread handle it instead

* Renderer position is updated from main loop

* Use nfluidsynth from nuget

* Fix appveyor, lazy fluidsynth init

* Only join MidiThread if it actually exists...
2019-10-30 16:45:11 +01:00
moneyl
b105ef3e7b Add way to check permissions client-side (#880)
Added IClientConGroupController and implemented it as ClientConGroupController. Lets client-side code check what commands the client can use based on their console group. Serves the same purpose as the server-side IConGroupController except it doesn't load a list of permissions from groups.yml. Instead,  the server ConGroupController sends updated permissions to clients whenever they change.
2019-10-25 12:00:32 +02:00
Pieter-Jan Briers
a7d7fdd12b Fix crash apparently. 2019-10-22 18:55:12 +02:00
Pieter-Jan Briers
86be98005c Some engine optimizations. 2019-10-22 18:05:08 +02:00
DamianX
6e621f6398 Scrollbars properly handle clicks (#881) 2019-10-20 01:45:31 +02:00
Pieter-Jan Briers
5c550888f6 Fix DefaultSeparation in BoxContainer being hardcoded. 2019-10-20 01:36:04 +02:00
Pieter-Jan Briers
bc6a0f4578 Server no longer logs a warning if config file is missing.
server_config.toml should eventually be removed from the repo since defaults should be in-code.
2019-10-20 01:27:33 +02:00
Pieter-Jan Briers
e2fcf919c5 Fix changing minsize not updating controls outside containers. 2019-10-20 01:16:56 +02:00
Pieter-Jan Briers
3f1c33fc96 Implement radio buttons. 2019-10-20 00:50:35 +02:00
Pieter-Jan Briers
0494d59a5a Fix GridContainer minimum size calculation. 2019-10-19 02:13:58 +02:00
Pieter-Jan Briers
5b35e1b016 Make vv command able to vv hovered GUI control. 2019-10-19 02:13:13 +02:00
Pieter-Jan Briers
d092a63b28 Adds debug panel to show Clyde info & stats. 2019-10-18 14:28:54 +02:00
Acruid
182c4fb5dc Fix integration tests. 2019-10-17 20:55:52 -07:00
Pieter-Jan Briers
631ff903b4 Implement tiling textures in StyleBoxTexture. 2019-10-18 01:05:36 +02:00
Pieter-Jan Briers
e3d28423c5 Add some helpers for working with style sheets. 2019-10-18 01:05:36 +02:00
Pieter-Jan Briers
64b33439e5 Fix disposed controls getting deferred updates ran. 2019-10-18 01:05:36 +02:00
Pieter-Jan Briers
bf7c49041f Fix UriOpener on .NET Core. 2019-10-18 01:05:35 +02:00
Pieter-Jan Briers
68db826e8e Add + (float, float, float, float) operators to UIBox2.
Extremely convenient to work with.
2019-10-18 01:05:35 +02:00
Pieter-Jan Briers
e519b6b53d Delete some dead code. (#876)
Mostly utility classes and ancient legacy.
2019-10-17 01:52:58 +02:00
Víctor Aguilera Puerto
0a976b5438 Add BufferedAudioSource to Clyde.Audio (#877)
* Add BufferedAudioSource

* Address reviews

* Address reviews 2: Span boogaloo

* Update EmptyBuffers to use new API.

* Only map needed handles

* Delete buffers on dispose.
2019-10-17 01:52:23 +02:00
Pieter-Jan Briers
cd7a4f0b15 Clean up styleboxes and add support for padding. 2019-10-15 13:11:33 +02:00
Pieter-Jan Briers
30fff3fba5 Fix config file loading on server. 2019-10-15 13:10:51 +02:00
Pieter-Jan Briers
9d4dec2ea7 Fix SnapGridComponent not correctly cleaning up when moved between grids. 2019-10-14 17:09:28 +02:00
Pieter-Jan Briers
6e2458f708 Sort ListCommand output. 2019-10-14 14:50:05 +02:00
Pieter-Jan Briers
5c64190733 Don't use ReadOnlySpan<char> yet. 2019-10-13 23:40:41 +02:00
Pieter-Jan Briers
44ada991f2 Fix plural bugs in LocalizationManager. 2019-10-13 22:48:13 +02:00
Pieter-Jan Briers
5e37c7a746 Add BBCode-like markup parser for FormattedMessage. 2019-10-13 22:47:51 +02:00
Pieter-Jan Briers
08c4ef1ccf Fixes entity prototypes not inheriting description. 2019-10-13 17:08:27 +02:00
Pieter-Jan Briers
baf85f6ab2 Uninitialized maps are treated as paused. 2019-10-13 16:25:51 +02:00
Pieter-Jan Briers
72402f3983 Cull entity, light & chunk rendering. 2019-10-13 15:23:20 +02:00
Pieter-Jan Briers
5252b1e99b Add some extra helpers to Box2. 2019-10-13 15:22:47 +02:00
Pieter-Jan Briers
896b664590 Make ItemList ScrollFollowing default to false. 2019-10-13 01:27:14 +02:00
Pieter-Jan Briers
381efbd857 Any focusing input drops current mouse focus. 2019-10-13 01:27:04 +02:00
Pieter-Jan Briers
be2904ca17 Fix Scrollbar and ItemList while placement is active. 2019-10-12 23:27:28 +02:00
Pieter-Jan Briers
414177973d Fix SS14Window handling with UI Scaling applied. 2019-10-10 17:23:36 +02:00
Pieter-Jan Briers
8aaacce195 Fix TextureRect and TextureButton UI scaling.
Thanks to nirnael for helping me investigate this and getting me to do it.
2019-10-10 17:14:00 +02:00
Pieter-Jan Briers
6ecd86b9af Fancy animation for debug console opening. 2019-10-10 16:18:57 +02:00
Pieter-Jan Briers
324770630d Reduce speed of scrollbar animation.
Makes it way easier to track for me.
2019-10-10 16:17:27 +02:00
Pieter-Jan Briers
78ebf99296 Fix a compiler warning. 2019-10-10 15:48:00 +02:00
Pieter-Jan Briers
ac254c3eac Add TypeHelpers.GetAllNestedTypes 2019-10-10 12:14:58 +02:00
moneyl
9d8d712aea Make IConGroupController and ConGroupIndex public so they can be used in content (#875)
By making these public they can now be used by content to check if players are in the right group (admin, mod, etc) before doing certain things. Required for PR 380 on content (https://github.com/space-wizards/space-station-14/pull/380)
2019-10-09 23:39:11 +02:00
Pieter-Jan Briers
dc2c139692 Actually run MarshalHelper_Test. 2019-10-08 00:50:51 +02:00
Pieter-Jan Briers
6fdb09aa06 Show collections count in memory debug. 2019-10-08 00:50:20 +02:00
Pieter-Jan Briers
ce44aa0060 Make ResourceManager thread safe. 2019-10-06 23:14:28 +02:00
Pieter-Jan Briers
5baf2678c3 Update NetSerializer to latest version. 2019-10-05 15:37:48 +02:00
Pieter-Jan Briers
650b93ce37 Fix PlayerStatusChanged old value being the new value. 2019-10-02 10:44:31 +02:00
Pieter-Jan Briers
9f20366c43 Adds IEntity.EnsureComponent extension methods. 2019-09-25 00:25:59 +02:00
Pieter-Jan Briers
333801b1c9 TypeEntityQuery improvements.
Added TypeEntityQuery<T> which requires T : IComponent
Added an assert to TypeEntityQuery so the type must inherit IComponent.
2019-09-25 00:25:23 +02:00
Pieter-Jan Briers
7067c120ed Mark PrototypeAttribute as MeansImplicitUse. 2019-09-24 23:07:14 +02:00
Pieter-Jan Briers
9868f186f3 Remove some unecessary NuGet dependencies. (#871)
Also made the window icon work again.
2019-09-24 12:42:59 +02:00
moneyl
56f566af7b Add support for OnMouseEntered and OnMouseExited actions to Cont… (#870)
Allows adding custom hover & mouse enter/exit behavior to a control without creating a derived class for control or modifying an existing one.
2019-09-22 18:04:27 +02:00
DamianX
437fd04e87 AnimationTrackSpriteFlick ignores missing RSI states (#869)
* AnimationTrackSpriteFlick ignores missing RSI states

* changed the thing
2019-09-21 23:19:56 +02:00
Acruid
72f7310890 Entities without a prototype were causing an exception in the MetaDataComponent networking. 2019-09-20 13:15:59 -07:00
DamianX
7dde058319 Removed debug message from ItemList (#868) 2019-09-19 16:53:20 -07:00
Acruid
55a50ff7ba Setting the Component.Running property now calls the Startup/Shutdown methods automatically. Startup/Shutdown are now protected. This makes the system more foolproof, previously if the component did not call the base method inside Startup/Shutdown, everything would break. This also allows a component to be started/stopped from the VV system by simply setting the property. 2019-09-18 11:24:15 -07:00
Acruid
1da37d24ae Removes the old obsolete input system where the state system directly handles input. Everything is using the InputManager/InputSystem now. 2019-09-17 16:24:10 -07:00
Acruid
81641f49dc Command handlers now return a boolean signaling if the command was "handled" or not. This allows clientside handlers to intercept input commands and optionally handle them before they are sent to the server. Previously, registering a clientside handler would completely block the input command from being sent to the server. 2019-09-17 16:04:26 -07:00
Pieter-Jan Briers
5d5b897a9b Property animations track (#867)
* WiP property animations system

* Use better lerp for Angle property animations.

* Fix handling of offset in sprite component.

* Allow animating some sprite layer properties.

* Allow animating some Transform properties.

Obviously not advisable for server entities, but great for client side entities!

* Improve animation property interpolation handling.

Added a "previous" mode.
Made values that cannot be sanely interpolated fall back to this mode.

* Improve some animation docs.
2019-09-17 22:57:12 +02:00
Pieter-Jan Briers
65a8d33d0c Optimize YamlHelpers to avoid allocations by using a thread local. 2019-09-17 15:38:03 +02:00
Pieter-Jan Briers
b397a43845 Implement light masks. 2019-09-17 15:24:14 +02:00
Pieter-Jan Briers
2651a3db56 Texture loading improvements.
Can load non-sRGB Gray8 images.
Allow disabling sRGB on textures.
2019-09-17 15:24:13 +02:00
Acruid
2fc636b7b9 The YamlSerializer now properly checks that the type is an enum. Previously it checked if the typed equaled Enum, which isn't the same thing and is always false. 2019-09-16 16:26:33 -07:00
Acruid
fd47179d79 The intention was to delete the key, not set it to null. Previously if ContainerManagerComponent.ForceRemove was called multiple times with a Deleted container, it would throw a NullRefException. 2019-09-16 16:24:47 -07:00
Acruid
6ed7684954 Reverts 00f982cb89.
Reverts b40413dfd6.
Decorates EntityPrototype.Name with CanBeNull.
The entity spawn window now properly handles prototypes with null names. Previously, a null name would throw a NullException. Entities with null names will never show up in the spawn window search results.
2019-09-16 13:08:59 -07:00
Acruid
b40413dfd6 Fixes issue with prototype parent's name not being deserialized properly. This fixes the failing unit test. 2019-09-16 12:17:26 -07:00
Pieter-Jan Briers
3d2228e64e Add a command to spawn entities client side. 2019-09-16 20:57:00 +02:00
Acruid
60fa8080c4 Properly implements the Concrete Type Tag system for serialization. 2019-09-16 11:13:09 -07:00
Acruid
11046f8068 Apply a work-around fix to a bug in the current version of YamlDotNet, where it would not serialize Tags on a mapping. 2019-09-16 11:08:37 -07:00
Acruid
8a61259c11 Renames the yaml key name for the BodyType on CollidableComponent so that it does not collide with the component type field. This previously caused deserialization to fail. 2019-09-16 11:06:33 -07:00
Acruid
7239e70294 When an item is inserted into a container, it's LocalPosition is set to (0,0). This causes the position of the contained entity to == the container's position. Entities are now spatially inside their containers. Previously, the local position was not set, so contained entities could be tens of meters away from their containers, preventing things like FindInSphere from working intuitively. 2019-09-15 14:47:09 -07:00
Pieter-Jan Briers
00f982cb89 Entity prototypes default to empty name instead of null 2019-09-15 20:15:07 +02:00
ShadowCommander
d08823322a Implemented SpinBox and added a filter to LineEdit (#866)
* Implemented SpinBox and added a filter to LineEdit

* Update SpinBox.cs

* Added requested changes and summaries
2019-09-15 20:07:28 +02:00
Víctor Aguilera Puerto
7fc99ee528 Improved ItemLists (#863)
* Improve ItemList

* Address reviews

* Items can only be at one ItemList at a time

* Nested Item class
2019-09-13 15:23:04 +02:00
DamianX
dc57178258 Added FirstOrDefault extension method (#865) 2019-09-11 23:11:12 +02:00
Pieter-Jan Briers
b87adb2294 Actually use SpriteComponent.Offset for rendering. 2019-09-11 20:02:54 +02:00
Acruid
e2c60871e9 ContainerManagerComponent now checks if the container is deleted before trying to remove an entity from it. Previously it would blindly call ForceRemove on a deleted container, causing a NullRefException.
Added some debug assertions to Container. These should help verify that a deleted container is not being accessed.
2019-09-09 12:22:32 -07:00
Acruid
c8ff91bf72 Entity Containers now raise a ContainerContentsModifiedMessage Component Message when their set of entities is modified.
Code cleanup in Container.cs
2019-09-09 10:37:10 -07:00
Pieter-Jan Briers
1108fd94ce Add Vector3 & 4 support to YamlObjectSerializer. 2019-09-09 16:20:33 +02:00
Pieter-Jan Briers
73a34fc53a Use DynamicMethod for dependency injection. (#864)
* Use DynamicMethod for dependency injection.

Should be way faster to initialize types and also have no allocation overhead

* Cleanup, don't make injectors for types without dependencies

* Fix Framework, maybe?

* Test the new system explicitly.
2019-09-09 01:43:22 +02:00
Pieter-Jan Briers
64ff64ea77 Add command to dump memory usage on server. 2019-09-08 21:06:41 +02:00
Pieter-Jan Briers
566ed9cbdc Fix EffectSystem timing.
The bug with effects dying in transit has since been fixed,
so proper timing can be re-added.
2019-09-06 22:42:14 +02:00
DamianX
782f36ee63 Create BoundUserInterfaces with DynamicTypeFactory (#862) 2019-09-06 15:05:37 +02:00
DamianX
f05f3eec3e Added PopupRoot to draw popup messages above UI windows (#861) 2019-09-06 10:04:17 +02:00
Acruid
240c9a2df0 Removes EyeComponent's reliance on TransformComponent.OnMove. Now is uses an EntitySystem that is ran every frame. (#860)
Refactored some functions off of Eye, removed the IEyeManager dependence from it.
2019-09-06 08:09:49 +02:00
Acruid
ea18d6983e If the current map an eye is on does not exist, fallback to the default eye's map. Previously Clyde would throw an exception, crashing the process. 2019-09-05 16:08:57 -07:00
Acruid
ebc7c1ab3f Removed the LocalPlayer.EntityMoved event. This was unused and has known issues. 2019-09-05 16:04:33 -07:00
Acruid
4d30d5af78 TransformComponent now properly rebuilds its matrices on startup. This resolves https://github.com/space-wizards/space-station-14/issues/224.
Fixed bug with ParentChangedMessage using the wrong entity in its OldEntity argument.
2019-09-05 16:00:41 -07:00
Acruid
dba0815585 When an entity is deleted, its children are now implicitly deleted as well. Previously, the children were orphaned onto the map. This resolves space-wizards/RobustToolbox/#855. 2019-09-04 11:44:27 -07:00
Acruid
5b3aaea5ec A null event handler delegate cannot be subscribed to an event type.
Resolved https://github.com/space-wizards/RobustToolbox/issues/575.
2019-09-03 13:36:52 -07:00
Acruid
58aac5ea2b Refactored the entity event handling spaghetti.
Renamed some of the code regions to better reflect what the functions were a part of.
2019-09-03 13:32:11 -07:00
Acruid
f2eb035ed8 Physics Shapes (#847)
* Adds a new IPhysicsShape object where you can define what collisions shape a PhysBody has.
AABB is now accessed through the PhysicsShape, so the BoundingBoxComponent is not required.

* Default PhysShape now copies the AABB of the BoundingBoxComponent.

* Fixed issue with serialization of PhysShapeAabbComp.

* Spatial queries now use ICollidableComponent instead of BoundingBoxComponent.
showbb now draws entities using the obsolete BoundingBoxComponent in Aqua.

* Renamed PhysShapeAabbComp to PhysShapeAabb.
Removed BoundingBoxComponent.

* Default CollidableComponent does not collide with anything now.

* Renamed ICollidable to IPhysBody.
Moved ICollidable to the Robust.Shared/Physics namespace.

* PhysShapes are now a collection of primitive shapes that contribute to the whole PhysBody.
ObjectSerializer.DataField can now deal with abstract types using YAML tags.

* Added LocalBounds property to ClickableComponent.
Added state to ClickableComponent.

* Added a Rectangle physics shape.

* ClickableComponent now actually checks that a click is inside its bounds.

* Reverted the addition of a try/catch around map loading. Any errors can propagate to the code trying to load the map again.
2019-09-03 22:06:50 +02:00
Pieter-Jan Briers
dccdbe743c Fix hitting ctrl-C crashing on Core. 2019-09-03 21:57:28 +02:00
Pieter-Jan Briers
5fee08e68b Fix NuGet mess again hopefully 2019-09-01 09:53:41 +02:00
Acruid
0477b58861 Removed IEntityNetworkManager.SendDirectedComponentNetworkMessage. The directed functionality was added to implementations of IEntityNetworkManager.SendComponentNetworkMessage (it already existed on server anyways). This resolves https://github.com/space-wizards/RobustToolbox/issues/717. 2019-08-31 20:25:13 -07:00
Acruid
c5c9f2dbd3 Move ClientChangedHandMsg to Content assembly. This Resolves https://github.com/space-wizards/RobustToolbox/issues/703. 2019-08-31 17:46:52 -07:00
Pieter-Jan Briers
1c059e2437 Fix client build for some people 2019-08-31 19:13:22 +02:00
Pieter-Jan Briers
94e1f90c97 Add console commands to force run the GC 2019-08-31 18:39:31 +02:00
Pieter-Jan Briers
daf0d1dd6c Fix memory leak with entity spawn window 2019-08-31 18:39:19 +02:00
Pieter-Jan Briers
f2ac151917 Scrolling so smooth it puts half the apps I use daily to shame. 2019-08-31 17:32:48 +02:00
Pieter-Jan Briers
5c445229d4 Fix build related to old OpenTK package. 2019-08-31 14:24:07 +02:00
Acruid
8765c67872 All entities are now allocated with a TransformComponent.
Prototypes will now use existing components, like transform, when loading an entity. Previously they blindly created new ones on the entity.
AddComponent now cannot overwrite a protected component, ie TransformComponent and MetaDataComponent. Entity caches these components, they cannot be changed.
Regular RemoveComponent functions are now not able to remove protected components.
2019-08-30 00:49:20 -07:00
Pieter-Jan Briers
c0b19dcca1 Hide property overrides in VV.
Fixes #857.
2019-08-30 09:38:02 +02:00
Pieter-Jan Briers
3d00d491c4 BoxContainer ignores invisible children for minsize calculations.
This is inline with what Godot does and it makes VV a hell of a lot compacter.
2019-08-30 08:53:13 +02:00
Víctor Aguilera Puerto
b421143463 Clear server VVTraitEnumerable cache on refresh (#856) 2019-08-30 05:59:49 +02:00
Pieter-Jan Briers
25f14ff1b6 Great that PrivateAssets stuff breaks .NET Core publishes. 2019-08-29 23:50:30 +02:00
Pieter-Jan Briers
0a5f9d4b0b Fix parallax gen being broken on Windows. 2019-08-29 23:08:33 +02:00
Pieter-Jan Briers
4cc30823a6 Fix build on .NET Framework. 2019-08-29 20:29:36 +02:00
Pieter-Jan Briers
e790e97a50 Fix some compiler warnings. 2019-08-29 16:59:52 +02:00
Pieter-Jan Briers
62f25669c7 Make it possible to VV containers. 2019-08-29 14:36:07 +02:00
Pieter-Jan Briers
814b686cb7 Explicitly dispose ImageSharp images. 2019-08-28 12:08:05 +02:00
Pieter-Jan Briers
d0ec77e804 Blit fonts manually to reduce created garbage. 2019-08-27 23:13:06 +02:00
Pieter-Jan Briers
eff7fa8408 Remove PrivateAssets rules from shared. 2019-08-27 23:11:01 +02:00
Pieter-Jan Briers
51989a8ccc Mark a bunch of packages as private assets.
This will prevent them being referenced in content, so stuff like OpenTK isn't "accessible" from Content.Client.
2019-08-27 22:51:31 +02:00
Pieter-Jan Briers
c16ef6ce77 Update all the NuGet packages. 2019-08-27 22:38:49 +02:00
Pieter-Jan Briers
2a08389235 Remove dependency on Smocks.ExtensionPackage.
It didn't support .NET Standard and it wasn't used anyways.
2019-08-27 22:34:32 +02:00
Pieter-Jan Briers
dd7159eec0 Update CommandLineParser. Refactor some code to make it work. 2019-08-27 21:47:15 +02:00
ShadowCommander
366d0ab2d5 Fixed LineEdit triggering when hovered but not selected (#854)
* Revert "Don't fire regular keybinds for controls under the mouse."

This reverts commit bb322e30ee.

* Fixed LineEdit triggering when hovered
2019-08-26 00:23:09 +02:00
DamianX
7dc32af73f DefaultColorsInverted ignores duplicates (#853) 2019-08-25 23:45:33 +02:00
DamianX
943b000950 Things for wires (#852)
* Things for wires

* Fixed things
2019-08-25 23:18:03 +02:00
Pieter-Jan Briers
bb322e30ee Don't fire regular keybinds for controls under the mouse. 2019-08-25 22:53:49 +02:00
ShadowCommander
117cf14e5c Add a check in OnContextChanged to fix some crashes and refactored BaseButton (#851)
* Add a check in OnContextChanged to fix some crashes

Fixes crashes due to double input like the Quit button in the Esc menu

* Changed BaseButton to only trigger on KeyBindDown and KeyBindUp on the same control
2019-08-25 13:13:07 +02:00
Pieter-Jan Briers
081ced42df Make fetching minimum size force style update if necessary. 2019-08-25 12:55:16 +02:00
Pieter-Jan Briers
3a9ccfe470 Fix more bad logging categories. 2019-08-25 12:55:16 +02:00
Acruid
19d7cd4455 ViewVariables can now edit Enums. The input field will accept either an enumeration label or a numerical value. 2019-08-22 13:43:00 -07:00
Pieter-Jan Briers
97d8f7d936 Remove code from EntityPrototype to change Entity container type. 2019-08-22 21:54:18 +02:00
Pieter-Jan Briers
6833ffd19f Fix build. 2019-08-22 20:16:47 +02:00
Pieter-Jan Briers
509497b784 Check that file paths are valid on all file systems.
Fix #525
2019-08-22 15:46:14 +02:00
Pieter-Jan Briers
d3b8a07350 Try to fix weird integration tests issues. 2019-08-22 10:21:36 +02:00
Pieter-Jan Briers
8291294aa1 Fix tests on .NET Core. 2019-08-21 23:39:52 +02:00
ShadowCommander
a8d6c294ab Input System Refactor (#840)
* Fixes right click menu stopping input

Removed a flag change when the modal stack was showing, which preventing the click from getting passed to the next function.

* Added parsing for mod2 and mod3 from Keybind YAML

* Fixes a crash on context change when a keybind is not defined in keybinds.yml

* Implemented ShowDebugConsole Hotkey

* Refactored input system

Refactored input system to run Key and Mouse input through the InputManager before doing stuff.

* Upgraded LineEdit and classes that use it. Fixed input while KeyboardFocused.

Upgraded LineEdit to use Keybinds.
Upgraded DebugConsole to use Keybinds.
Replaced all references to MouseDown, MouseUp, KeyDown, and KeyUp with KeyBindUp and KeyBindDown.
Moved UserInterfaceManager call from GameController.Input to InputManager event.
Stopped input going to simulation while a control has focus in UserInterfaceManager.

* Some fixes for input system

Fixed keybinds getting stuck when selecting a LineEdit.
Changed MenuBar to not error.
Fixed a few cases where LineEdit would eat input if you hovered over it and where mouse input got eaten when clicking in the world while a LineEdit was selected.

* Removed extra dependencies

* Added GUIBoundKeyEventArgs to ButtonEventArgs

* Fixes for input with LineEdit selected

Fixed multiple keybinds mapped to the same key not triggering.
Fixed keybind input not getting to LineEdit when hovering over a control.

* Implemented Key Repeat for LineEdit

* Fix for input on Robust.Lite Launcher

* Renames NonFocusKeybinds to EnableAllKeybinds

Renamed NonFocusKeybinds to EnableAllKeybinds and added comment to clarify usage

* Adds repeating keybinds

Used for TextBackspace, TextCursorLeft, and TextCursorRight
Reverts a change to LineEdit that implemented repeating keys
Adds some documentation comments
2019-08-21 17:13:48 +02:00
CatTheSystem
fc67c5069c Allowed multiple Pseudo Classes per element. (#846)
* Quick fix to flashlight radius

* SomethingAbout CSS Class

* Shitty update

* fuck

* Creativ!

* Last But not least

* Quick Change

* Fixed version

* Tiny fix

* Next Fix

* Another fix
2019-08-20 21:22:14 +02:00
DamianX
7f9f593989 Implemented RobustRandom (#845)
* Implemented RobustRandom

* Fixed RandomString
2019-08-16 21:43:59 +02:00
CatTheSystem
ff5334f446 Quick fix to flashlight radius (#844) 2019-08-15 09:52:54 +02:00
Pieter-Jan Briers
cb5f2ffae1 Refactor UI system. (#843)
* Refactor UI system.

Deferred updating is used for styling & layout. This fixes the awful time complexity of containers.
Removed SetDefaults and Initialize. They were a bad idea alright.

* Fix build on .NET Framework.
2019-08-14 22:03:51 +02:00
Pieter-Jan Briers
cdac0d5757 Correctly delete disposed audio sources on the main thread. 2019-08-14 10:48:54 +02:00
Pieter-Jan Briers
c727dbd07e Gets rid of some [SRV] loggings. 2019-08-14 10:32:23 +02:00
Pieter-Jan Briers
95f9126d12 Detect exception-loop softlocks and shut down server if it happens. 2019-08-13 23:51:54 +02:00
Pieter-Jan Briers
265a9abeb6 Metadata component can send component state with null prototype ID. 2019-08-13 23:21:42 +02:00
Pieter-Jan Briers
6e32588be7 Adds new placement alignment mode to place lights correctly. 2019-08-13 12:05:08 +02:00
Pieter-Jan Briers
71fd6d427c Fix prototype manager not compiling on .NET Framework. 2019-08-13 10:30:31 +02:00
Pieter-Jan Briers
aff2631f23 Make VV command not crash as easily. 2019-08-13 01:02:42 +02:00
Pieter-Jan Briers
3f01fb0879 More VV attributes for Control. 2019-08-13 00:55:56 +02:00
Pieter-Jan Briers
02ca521cc5 Adds useless version label to main menu. 2019-08-12 18:53:41 +02:00
Pieter-Jan Briers
468fbda539 Ensure stable sort in the entity rendering sort. 2019-08-12 18:46:34 +02:00
Pieter-Jan Briers
175085f32e Make prototype loader ignore unix hidden files. 2019-08-11 23:13:25 +02:00
Pieter-Jan Briers
96543421f2 Update help for monitor command. 2019-08-11 22:50:01 +02:00
Pieter-Jan Briers
10261a15b2 Fix flick animations. 2019-08-11 16:45:59 +02:00
Pieter-Jan Briers
11ac144ae1 Make component state type check an assert. 2019-08-11 01:38:25 +02:00
Pieter-Jan Briers
db6d9160e4 Remove LINQ usage from Entity.cs 2019-08-11 01:33:09 +02:00
Pieter-Jan Briers
896758e176 Make IEntity.GetAllComponents no longer return duplicates.
Remove the Instances method that did that instead.
2019-08-11 01:22:59 +02:00
Pieter-Jan Briers
768fed2421 Optimize Matrix3 Vector2 transforms. 2019-08-11 01:01:40 +02:00
Pieter-Jan Briers
98c1e43fe6 Optimize that color lerp more because I wanted to mess with SIMD. 2019-08-11 00:21:05 +02:00
Pieter-Jan Briers
7fce46ec44 Fix some issues Sonar caught. 2019-08-10 14:17:13 +02:00
Pieter-Jan Briers
b1b6e2dd5c Fix cache rules in .appveyor.yml. 2019-08-10 13:54:38 +02:00
Pieter-Jan Briers
9ea9f452ec Maybe fix AppVeyor? 2019-08-10 13:49:38 +02:00
Pieter-Jan Briers
d9968e2e62 Fix failing test harder. 2019-08-10 01:22:12 +02:00
Pieter-Jan Briers
5e2a1d889d Fix failing test. 2019-08-10 01:18:55 +02:00
Pieter-Jan Briers
72c4d56639 Remove a bunch of oldcode from FloatMath.
Did we need to store 256 KiB worth of inaccurate sin/cos lookup? Nah.
2019-08-08 00:41:03 +02:00
Pieter-Jan Briers
e7bf2d0ac9 Use MathF for sqrt in vector types. 2019-08-07 23:16:05 +02:00
Pieter-Jan Briers
daa13de9ed Did you know that working on two things at once can
cause you to forget to commit files?
2019-08-07 20:56:37 +02:00
Pieter-Jan Briers
8d0012223e Optimize sRGB conversions on .NET Core. 2019-08-07 15:47:49 +02:00
Pieter-Jan Briers
78416ad157 Refactor Color.InterpolateBetween to be faster and make more sense. 2019-08-07 14:52:14 +02:00
Pieter-Jan Briers
fc4e3be40a Replace SS14 noise dependency with FastNoise. 2019-08-07 14:51:23 +02:00
Pieter-Jan Briers
57fb38c04d Improve Random.NextFloat() to be faster. 2019-08-07 14:50:48 +02:00
Pieter-Jan Briers
5fd7f9a6d8 Re-add tile build overlay. 2019-08-06 13:50:23 +02:00
Acruid
096b7f6bca Removed TransformComponent.VisibleWhileParented.
Removed `TransformComponent.ParentChangedEventArgs`, this was dead code from the removed `TransformComponent.OnParentChanged` event.
2019-08-05 13:21:55 -07:00
Pieter-Jan Briers
6a331cfdf6 Re-organize OpenGL init so debug callback gets initialized earlier. 2019-08-05 15:58:58 +02:00
Pieter-Jan Briers
b6bc2e591b Very rough menu bar control. 2019-08-05 14:45:38 +02:00
DamianX
89726ebeec Fix missing semicolon (#839)
* Fix missing semicolon

* Fixed CopyToArray
2019-08-04 11:42:40 +02:00
Pieter-Jan Briers
0a41ef3c9a Unified those messy FrameEventArgs. 2019-08-04 01:08:44 +02:00
Pieter-Jan Briers
0e65843f39 Memory debug panel to show memory usage info. 2019-08-03 23:59:54 +02:00
Acruid
066f6b9443 Adds a Setup function to the AILogicProcessor that is called once when the processor is initialized. 2019-08-03 12:43:38 -07:00
Pieter-Jan Briers
be0c520455 Fix examine crash. 2019-08-03 15:20:45 +02:00
Pieter-Jan Briers
e62021cb92 Try to work around space-wizards/space-station-14#284 2019-08-03 15:07:43 +02:00
Pieter-Jan Briers
c0eca4f6c2 .NET Core support. 2019-08-02 02:07:03 +02:00
Pieter-Jan Briers
bcf60c404d More optimized ImageSharp blit. 2019-08-01 19:43:00 +02:00
Pieter-Jan Briers
6f201ccddc Renderer optimizations.
Nothing major, but it should be a bit faster now.
2019-08-01 02:14:03 +02:00
Pieter-Jan Briers
85a4375905 Various performance optimizations. 2019-08-01 00:10:20 +02:00
Pieter-Jan Briers
fa10e1c330 Automatic component registration attributes. 2019-07-31 15:00:33 +02:00
Pieter-Jan Briers
170b8717c1 Fix some compiler warnings. 2019-07-31 13:47:34 +02:00
Pieter-Jan Briers
effb731340 GameScreen: don't wipe StateRoot. 2019-07-31 13:43:10 +02:00
Pieter-Jan Briers
7e08c5d743 Only load prototypes from .yml files.
I had some .directory files that were being loaded. This fixes that.
2019-07-31 13:16:35 +02:00
Pieter-Jan Briers
0e31193e7f Improve rich text system.
Improved word wrapping to reduce edge cases.
Allowed setting a "maximum" size for rich text label.
2019-07-30 23:10:03 +02:00
Pieter-Jan Briers
97c8297ce1 Noise generator improvements:
Added method to generate 1D noise.
Made all the methods take in doubles.
  They already converted to it anyways.
2019-07-30 18:49:56 +02:00
Pieter-Jan Briers
120cab811f Implement tuple -> vector conversions for double vectors. 2019-07-30 18:48:05 +02:00
Pieter-Jan Briers
d7e5c12a3d Make FpsCounter internal so it gets out of my face. 2019-07-30 13:55:58 +02:00
Pieter-Jan Briers
4eb4e47975 Remove unused SpeechBubble.cs 2019-07-30 13:50:27 +02:00
Pieter-Jan Briers
3d0d999f25 Remove ControlWrapAttribute. 2019-07-30 13:46:33 +02:00
Pieter-Jan Briers
7e13447455 Remove Godot scene instantiation. 2019-07-30 13:39:56 +02:00
Pieter-Jan Briers
fdfbf92223 Remove a ton of lighting system cruft.
Basically just kills the light manager.
Clyde was already using the ECS anyways.
2019-07-30 13:31:05 +02:00
Pieter-Jan Briers
9290ab445a Fix Stylesheet tests. 2019-07-30 13:02:40 +02:00
Acruid
51bbc7e565 Removed obsolete TransformComponent.OnParentChanged event. Use the component or entity system message for this event. 2019-07-29 16:16:55 -07:00
Pieter-Jan Briers
be379b2e20 Remove a bunch of cruft from the engine.
Unused textures & fonts, really.
2019-07-30 00:56:51 +02:00
Pieter-Jan Briers
6d377ee1e3 Robust Lite, also known as "Qt was too hard to distribute". 2019-07-29 23:08:50 +02:00
Pieter-Jan Briers
a1d899ee31 Updating control size flags now notifies parent container. 2019-07-29 23:08:49 +02:00
Pieter-Jan Briers
39a2c9db86 Fix parenting a control not correctly setting its layout. 2019-07-29 23:08:49 +02:00
Pieter-Jan Briers
66999a4a5d Extract user data dir locating to a helper class. 2019-07-29 23:08:49 +02:00
Pieter-Jan Briers
2d30eb0321 Adds way to open URIs in the user's browser. 2019-07-29 23:08:49 +02:00
Acruid
b26a370504 You can now call IoCManager.Clear() regardless of the container being instantiated for your thread. Previously you would get a null exception. Now the function does nothing (as expected) if the container does not exist. 2019-07-29 11:39:42 -07:00
Acruid
30cafea218 Adds a debug net graph to the game state system. 2019-07-29 11:25:20 -07:00
Pieter-Jan Briers
d9297fa1c9 Add [ViewVariables] to PlayerData. 2019-07-26 23:37:26 +02:00
Pieter-Jan Briers
9355938f6a Don't try to send unserializable value types over the wire with VV. 2019-07-26 23:36:24 +02:00
Pieter-Jan Briers
c5ef7fd134 Fix VV crash when viewing empty enumerable. 2019-07-26 22:56:37 +02:00
Pieter-Jan Briers
112b694099 Better error feedback on VV command. 2019-07-26 18:39:00 +02:00
Pieter-Jan Briers
e0512a1052 Use RemoveAllChildren() in GameScreen switch. 2019-07-26 17:55:30 +02:00
Pieter-Jan Briers
ed56c39e1b Add more parent/child helpers to Control. 2019-07-26 17:55:06 +02:00
Pieter-Jan Briers
117fcf2aa2 Make entity spawn window text more in line with the tile spawn window. 2019-07-26 17:54:10 +02:00
Pieter-Jan Briers
4fd24e8de9 Optimize UI system somewhat.
Especially styling should be significantly faster now.
2019-07-26 17:32:58 +02:00
Pieter-Jan Briers
a4f2441153 Adds SnapGridComponent.GetLocal() 2019-07-26 13:49:09 +02:00
Pieter-Jan Briers
e1f2742c8f Optimize RSI loading significantly. 2019-07-26 12:21:50 +02:00
Pieter-Jan Briers
6f26f77ce6 Add efficient ImageSharp blitting method. 2019-07-26 12:20:59 +02:00
Pieter-Jan Briers
da1baba550 Add cast from Vector2u to Vector2i. 2019-07-26 12:20:34 +02:00
Pieter-Jan Briers
dd53239554 Change to new freetype build.
This hopefully fixes #835
2019-07-25 14:03:40 +02:00
Pieter-Jan Briers
25f9ba5ec2 Remove debug drawing of rotated rect. 2019-07-25 14:03:40 +02:00
Acruid
ed97cbb42d The *World functions on TransformComponent now properly account for the grid world location. This fixes entities being drawn around the world origin when they touch a grid that isn't at 0,0 in the world. 2019-07-24 10:29:40 -07:00
Pieter-Jan Briers
78bbac52f0 Fix entity spawn erase mode. 2019-07-24 16:10:12 +02:00
Pieter-Jan Briers
83c738e423 Correctly handle fractional scrolling coming in from OpenTK. 2019-07-24 09:31:16 +02:00
Pieter-Jan Briers
b0a8e3923b Give bad username feedback before attempting connection. 2019-07-24 00:40:49 +02:00
Pieter-Jan Briers
311bd2b874 Fix UIManager popups. 2019-07-24 00:27:51 +02:00
Pieter-Jan Briers
59caaeca8c Better feedback for why usernames are invalid. 2019-07-24 00:27:21 +02:00
Pieter-Jan Briers
832be75c5c Fix UITest command. 2019-07-24 00:27:09 +02:00
Pieter-Jan Briers
08e214b3d2 Add SS14Window.OpenCenteredMinSize 2019-07-24 00:27:03 +02:00
Pieter-Jan Briers
f75ee08030 Add some separators to the main menu to make grouping easier. 2019-07-23 23:28:52 +02:00
Pieter-Jan Briers
cd9aed6696 Less ugly debug console color. 2019-07-23 23:14:36 +02:00
Pieter-Jan Briers
040dc2445c Use new IDynamicTypeFactory extension method. 2019-07-23 21:34:13 +02:00
Pieter-Jan Briers
414bd95eb2 DynamicTypeFactory improvements:
Can now make instances with constructor arguments.
Adds some helpers.
2019-07-23 21:08:01 +02:00
Pieter-Jan Briers
17424cc3f3 TextureButton can now be scaled. 2019-07-23 19:44:24 +02:00
Pieter-Jan Briers
795af9d0f4 Fix precise scrolling. 2019-07-23 19:43:03 +02:00
Acruid
91d0936a99 Eye now uses MapCoordinates instead of Grid Coordinates when building the view matrix. This fixes the bug where the view offsets from the map origin when the player touches a grid in the world that isn't positioned at the origin. 2019-07-20 14:07:38 -07:00
Acruid
89ff434528 Fixes ScreenToWorld entity picking. Now when you mouse over a grid it does not pick entities at the map origin. 2019-07-20 12:47:09 -07:00
Acruid
8c46c06497 Setting the world position of a Transform now properly sets the grid index. 2019-07-20 12:37:46 -07:00
Acruid
04c95d4ff8 Fixes a bug where the VV window did not open. 2019-07-20 12:18:45 -07:00
Pieter-Jan Briers
ecb641f403 Allow scaling SpriteView. 2019-07-20 15:49:44 +02:00
Pieter-Jan Briers
e10e7d165a Make outlines less ugly. 2019-07-20 15:49:11 +02:00
Pieter-Jan Briers
03edfc46cb Actually apply fullscreen preference on client restart. 2019-07-19 23:59:49 +02:00
Pieter-Jan Briers
13ad6f3f37 Show a warning in the main menu on old OpenGL versions. 2019-07-19 23:57:41 +02:00
Pieter-Jan Briers
8ec83a7654 Allow Clyde to draw rotated boxes. 2019-07-19 22:12:33 +02:00
Acruid
de68a62187 Box2Rotated & Vector2 Rotation (#827)
* Adds a function to rotate a vector by an Angle.
Adds the Box2Rotated struct for holding a rotated box.

* Use ApproxEqualityConstraint
2019-07-19 21:48:40 +02:00
Pieter-Jan Briers
95197075a5 Prune dead NetIDs. 2019-07-19 16:35:14 +02:00
Pieter-Jan Briers
167aa4791b Remove instance of Visibility = false for windows. 2019-07-19 16:08:19 +02:00
Pieter-Jan Briers
f38eb13866 Make opening a window twice not crash. 2019-07-19 16:07:01 +02:00
Pieter-Jan Briers
0c1c6cee0e Generate basic cyrillic for font atlasses. 2019-07-19 14:13:37 +02:00
Pieter-Jan Briers
c8a28b8c83 Allow using C# Object Initializers for Controls layout.
It's far from a good declarative syntax, but better than before.
2019-07-19 12:38:54 +02:00
Pieter-Jan Briers
81b521a8e4 Re-organize entity spawn window. 2019-07-19 12:07:58 +02:00
Pieter-Jan Briers
441980e1cb Remove spawnwindow command. 2019-07-19 12:07:41 +02:00
Pieter-Jan Briers
8f976ce810 Window titles left aligned, text clipping if necessary. 2019-07-19 11:31:04 +02:00
Pieter-Jan Briers
c2e8ee0fcd Change default rich text entry color to 200,200,200.
Less blinding white in the tutorial.
2019-07-19 10:55:43 +02:00
Pieter-Jan Briers
8d2ea9aed1 Remove SS14Window.AddToScreen and related systems. 2019-07-18 22:48:51 +02:00
Pieter-Jan Briers
31ca502418 Less fragile kdialog detection. 2019-07-17 14:03:13 +02:00
Pieter-Jan Briers
7318247da2 Do not attempt to open file dialogs on headless 2019-07-17 14:00:54 +02:00
Pieter-Jan Briers
bed9a082bc Probably fix AppVeyor. 2019-07-17 13:56:01 +02:00
Pieter-Jan Briers
5694f4ff28 Actually use sprite layer colors.
They were previously ignored.
2019-07-17 00:35:29 +02:00
Pieter-Jan Briers
0865398fe1 Never trust me to actually commit files. 2019-07-14 08:54:14 +02:00
Pieter-Jan Briers
fb2feee93b Finish file dialog support.
Implemented automatic download of swnfd.
Made swnfd run synchronously on macOS to prevent issues.
2019-07-14 08:53:00 +02:00
Pieter-Jan Briers
093481cb77 Better documentation for FileDialogManager. 2019-07-13 22:05:34 +02:00
Pieter-Jan Briers
60f46afddd Tooltips do not block the mouse. 2019-07-13 22:03:38 +02:00
Pieter-Jan Briers
c504e58226 Remove a bunch of cruft from RobustUnitTest. 2019-07-13 21:55:47 +02:00
Pieter-Jan Briers
4cb9bd3332 Deduplicate IoC init. 2019-07-13 21:51:57 +02:00
Pieter-Jan Briers
f2cdb0d68c File dialog API.
Only works on KDE Linux right now until I compile the natives.
I'll ship libswnfd when I got it compiled for all platforms.
2019-07-13 17:54:21 +02:00
Pieter-Jan Briers
e3720ebe01 Implement MinSize for TextureButton 2019-07-13 14:49:46 +02:00
Pieter-Jan Briers
5d07887251 TextureRect can now be scaled. 2019-07-12 19:11:43 +02:00
Pieter-Jan Briers
ed340f7df9 Optimize the code to reduce a ton of allocations. 2019-07-11 14:51:20 +02:00
Pieter-Jan Briers
0de8615033 Document some GUI controls. 2019-07-08 23:02:59 +02:00
Pieter-Jan Briers
091c1b935b Implement GrowDirection on controls. 2019-07-08 21:00:28 +02:00
Pieter-Jan Briers
04b14e92e7 Fix #265 2019-07-08 16:45:08 +02:00
Pieter-Jan Briers
e6c4cbb662 Make placement respect map init. 2019-07-08 13:46:14 +02:00
Pieter-Jan Briers
1b57d4ec0b Remove TrySpawn* entity methods. (#833) 2019-07-07 22:24:21 +02:00
Pieter-Jan Briers
2a6696f7e3 Make outline corners smoother. 2019-07-06 22:38:58 +02:00
Pieter-Jan Briers
981bbc61ee Re-implement hollow rectangle drawing.
I missed a TODO.
2019-07-06 22:37:58 +02:00
Pieter-Jan Briers
78c393aac5 Fix Travis 2019-07-06 19:19:37 +02:00
Pieter-Jan Briers
09c36b57cd Shift half of Clyde around to implement better outline rendering. (#830)
* Attempted Clyde cleanup, didn't get far.

* Add negation operator to Vector2i.

* Add RenderOrder to ISpriteComponent.

* Post process shaders.

Adds "post process" shaders to sprite component.
These are executed on the WHOLE sprite component (every layer)
in one draw.

This is necessary to implement functional outlines.
2019-07-06 19:17:33 +02:00
Pieter-Jan Briers
a8be3a2844 Delete dead closewindow.png 2019-06-29 19:55:17 +02:00
Pieter-Jan Briers
4ae2f6b667 Helping content get AppVeyor 2019-06-29 16:55:53 +02:00
Pieter-Jan Briers
eb683e1838 Damnit Rider. 2019-06-29 01:56:56 +02:00
ZNixian
222e19ddc4 Add support for diagonal RSI sprites (#828) 2019-06-29 01:54:34 +02:00
Pieter-Jan Briers
ae42a3e3fa Integration testing improvements.
They no longer load system-wide config or user data.
User data is emulated through a VFS.

Also added more hooks to improve the customizability of the test,
for example allowing content to hijack their IoC registrations.
2019-06-29 01:51:40 +02:00
Pieter-Jan Briers
9a4c1cae1e Networked integration tests work. 2019-06-28 16:03:58 +02:00
Pieter-Jan Briers
67f433aeb2 Maybe fix loading on Windows 2019-06-23 11:29:17 +02:00
Pieter-Jan Briers
413680b602 Try to figure out why the launcher doesn't work with better logs. 2019-06-23 11:08:18 +02:00
Pieter-Jan Briers
822e6b7f6d Clean up signal handling and make it work on the client. 2019-06-05 12:12:10 +02:00
Pieter-Jan Briers
d3a67107bb Fix Join Public Server button. 2019-06-05 11:12:58 +02:00
Pieter-Jan Briers
00995d6a30 Do not try to set server console title in non-interactive shells. 2019-06-04 23:25:28 +02:00
Pieter-Jan Briers
ef57a4f4c3 Improve QoL of integration test API, document it. 2019-06-04 23:25:08 +02:00
Pieter-Jan Briers
1c2caca7e1 Fix dependency copy. 2019-06-04 19:07:49 +02:00
Pieter-Jan Briers
9115610d2f Integration testing v2 (#826)
* Rewrite Integration testing, add support for the client.

* Rewrite AssemblyLoader to not be static.

* Adds ability to post messages into thread.
2019-06-04 19:05:16 +02:00
Injazz
99c956dfb4 Circle Ranges (#825)
* Circle Range for Tiles

* fixes
2019-06-03 20:13:38 +02:00
Pieter-Jan Briers
6a1bed31ae Fix integration tests. 2019-06-02 20:15:28 +02:00
Pieter-Jan Briers
017a63f41c How the hell did I fail to commit this file. 2019-06-02 06:59:52 +02:00
Pieter-Jan Briers
5e872ec1e3 Implement animated RSI rendering for effects.
Fixes #822.
2019-06-02 01:14:14 +02:00
Pieter-Jan Briers
e314446575 Allow components to be created while iterating them. (#821)
This is necessary to avoid tons of papercuts with entity systems.
Without this it is not possible to create entities inside the update loop of an entity system, which is too common for me to disallow.

As for performance, I offset it by removing the LINQ usage.
It's marginally faster than before even.
2019-06-01 00:16:19 +02:00
Pieter-Jan Briers
58c7255087 Can now load wav PCM audio.
Clyde had the code for a while now but I didn't expose it because Godot
didn't either.
2019-06-01 00:13:34 +02:00
Pieter-Jan Briers
58ac8f0dba Log warning when using stereo audio positionally.
OpenAL doesn't support this so this should help avoid confusion.
2019-06-01 00:06:32 +02:00
Pieter-Jan Briers
e5024e80f4 Update Nett dependency. 2019-05-29 01:48:25 +02:00
Pieter-Jan Briers
00f6564351 Update some NuGet dependencies. 2019-05-29 01:45:31 +02:00
Pieter-Jan Briers
b32f695509 Make Sonar ignore Lidgren. 2019-05-29 01:18:36 +02:00
Pieter-Jan Briers
f74bf680e7 Add an assert to lighting rendering. 2019-05-29 01:11:45 +02:00
Pieter-Jan Briers
02802c0e70 Clip VV ToString() text to reduce some ridiculous cases. 2019-05-29 01:06:05 +02:00
Pieter-Jan Briers
300c2c05e4 Implement Label ClipText. 2019-05-29 01:05:43 +02:00
Pieter-Jan Briers
f9e192b01e Vertically center checkboxes. 2019-05-29 00:55:34 +02:00
Pieter-Jan Briers
7c6c8dcd41 Do not crash if client disconnects during initial handshake. 2019-05-28 20:59:39 +02:00
Pieter-Jan Briers
18c91e6be4 Fix bad copypaste with DebugPositions 2019-05-28 20:34:36 +02:00
moneyl
6a9a727e1f Add Control.SetOnlyStyleClass (#820)
This clears the collection of style classes and adds the new one. This allows controls to easily switch between several style classes without needing to keep track of the active one in their own code.
2019-05-28 20:32:32 +02:00
Pieter-Jan Briers
d7f5c1d9db Debug drawing to show exact entity positions. 2019-05-28 13:35:24 +02:00
Pieter-Jan Briers
97dfe3c216 Fix GetEntitiesInArc's using half range. 2019-05-28 13:35:09 +02:00
Pieter-Jan Briers
b65f108268 Load vsync from config on startup. 2019-05-28 01:59:27 +02:00
Pieter-Jan Briers
4892d0d0fa Fix some compiler warnings and remove dead code. 2019-05-28 00:30:18 +02:00
Pieter-Jan Briers
bb4a1eda8e Project file refactor (#819)
* Project file refactor

Move all the .csproj files to the new .NET Core style.
This doesn't make any difference for compiling for Framework,
but it does reduce a ton of useless boilerplate.

As an extension of this, killed a bunch of uncompiled & unmaintained .cs files.

Compiling for release (to profile) works now.
Removed AnyCPU targets from the solution file.

* Fix compiler warnings.
2019-05-28 00:16:01 +02:00
moneyl
110bd0921a Add StyleBox overrides to ProgressBar (#818)
* Add StyleBox overrides to ProgressBar

The overrides are StyleBoxFlat instead of StyleBox as StyleBox does not expose or possess a color property. _getBackground and _getForeground were also changed to return StyleBoxFlat instead of StyleBox to keep things simple.

* Change ProgressBar _getBackground and _getForeground back to StyleBox

* Change ProgressBar style box overrides from StyleBoxFlat to StyleBox
2019-05-25 01:41:39 +02:00
Acruid
61aba8fc50 Create Entities Without Prototypes (#815)
* Retrofitted ComponentManager_Test to use DependencyCollection.

* Renamed ComponentManager_Test to ComponentManager_Tests to follow naming conventions.

* Added component add/remove/delete events to IComponentManager.
Removed IEntity dependency from ComponentManager.

* Entities can now be spawned without a prototype.

* Removed unused function.

* CreateEntity now actually works with a null prototype ID. The other spawn functions should work as well.
Updated doc comments for IEntityManager.SpawnEntity().
2019-05-24 21:37:28 +02:00
Acruid
dc4cc71c72 Fixes game crashing because the player entity got deleted. (#814) 2019-05-24 17:03:13 +02:00
Acruid
322c706924 Allows you to use 0 (false) and 1 (true) as boolean arguments in the cvar concommand. (#817) 2019-05-24 16:59:17 +02:00
Acruid
8650143b8c ECS Events are now sent as reliable, and have their own category. (#816) 2019-05-24 16:57:45 +02:00
moneyl
b92ea9a2aa Remove GUI dependence on tscn files (#812)
* Remove unused options menu tscn

* Move SS14Window to pure C#

* Move SpriteView to pure C#

* Move EntitySpawnWindow and EntitySpawnItem to pure C#

* Removes using statements accidentally added by resharper

* Set EntitySpawnWindow default size to normal value

Note that in construction menu and storage menu this had to be done in the object initializer and didn't work if it was set in the Initialize function for the respective menus. For whatever reason setting it in the EntitySpawnWindow.Initialize works fine.
2019-05-24 16:57:13 +02:00
digitalis
1b38996905 Fixes incorrect null check in PredicateEntityQuery (#813) 2019-05-24 16:51:10 +02:00
Pieter-Jan Briers
e7a8e9b1aa Fix client side entity positions. (#811)
They were being interpolated to the origin.
2019-05-16 20:15:20 +02:00
Pieter-Jan Briers
a7d3b31ec4 Fix outline rendering. 2019-05-16 14:40:05 +02:00
Pieter-Jan Briers
10440648bc Remove IDisplayManager dependency from SS14Window 2019-05-16 14:27:51 +02:00
Pieter-Jan Briers
5226039b7c VV for PlayerManager. 2019-05-16 14:02:03 +02:00
Pieter-Jan Briers
3bad55a705 Move escape menu out of engine. 2019-05-14 15:19:27 +02:00
Pieter-Jan Briers
bb7288d26a ItemList only shows scrollbar when necessary. 2019-05-14 12:54:26 +02:00
Pieter-Jan Briers
b30c2155c7 Improve ItemList rendering to correctly handle margins. 2019-05-14 11:26:37 +02:00
Pieter-Jan Briers
70449b9ca2 Fix client not handling player state disconnects. 2019-05-14 11:25:36 +02:00
Pieter-Jan Briers
7323e454e4 Fix StyleBox.GetContentOffset(). 2019-05-14 11:18:26 +02:00
Pieter-Jan Briers
f7ccac2c11 Make Label align individual lines to center. 2019-05-14 01:19:01 +02:00
Pieter-Jan Briers
4d233ef6c2 Add [StringFormatMethod] to localization manager. 2019-05-14 00:22:52 +02:00
Pieter-Jan Briers
c10f7f2707 Document and clean up Control. 2019-05-13 19:06:57 +02:00
Pieter-Jan Briers
9db3473b7a Containers handle size flags better. 2019-05-13 14:51:50 +02:00
Pieter-Jan Briers
0b63dbd1f2 Move TileSpawnWindow to pure C#. 2019-05-13 09:15:03 +02:00
Pieter-Jan Briers
1403c14acb Fix MarginContainer layout. 2019-05-13 09:14:23 +02:00
Pieter-Jan Briers
ab8feee660 Add ItemList.ClearSelections() 2019-05-12 15:07:07 +02:00
Pieter-Jan Briers
e6417582c8 Fix OptionButton popup going under other controls. 2019-05-12 12:09:38 +02:00
Pieter-Jan Briers
977f51a9be Remove dead Godot references. 2019-05-12 11:56:10 +02:00
Pieter-Jan Briers
9977d64e2f Remove exception-catch tests from timers.
These tests were ensuring that exceptions were logged,
we decided these should bubble up instead.
2019-05-12 11:47:20 +02:00
Pieter-Jan Briers
2d6a529725 Make LocalizationManager fall back if not initialized.
This fixes unit tests.
2019-05-12 11:46:44 +02:00
Pieter-Jan Briers
ddbeccdb8c Some work supporting localization.
Far from complete, but a good start.
2019-05-11 23:59:48 +02:00
Pieter-Jan Briers
1fd6488362 Use Dns.GetHostEntryAsync.
I can't believe I missed this in the documentation.
2019-05-11 16:10:57 +02:00
Pieter-Jan Briers
f954bcb3e8 Switch to .NET Framework 4.7.2 2019-05-11 16:09:55 +02:00
Pieter-Jan Briers
17ebeac107 UI Scaling Support. (#809)
Not quite perfect, but quite usable.

Adds the ability to scale the UI. Scaling is controlled via a cvar,
and can be changed at runtime.
Fractional scaling is supported.

Some controls could be better (SpriteView, TextureRect),
but for now it's a good start.
2019-05-11 16:04:14 +02:00
Acruid
c4fb96b5e8 Tile Placement Improvements (#808)
* Tile Placement box actually uses the mouse snapgrid, not the players.

* Placement box only snaps to grids if cursor is over grid.
First tile of new grid is centered on cursor, instead of bottom left on cursor.

* Place square now sticks to the edge of a grid.
Cannot place tiles that would touch two grid Bounds.
2019-05-11 15:58:28 +02:00
Pieter-Jan Briers
2a9441a6da Remove redundant log. 2019-05-08 23:14:08 +02:00
Pieter-Jan Briers
55cf1c10a8 Do not catch async exceptions on debug.
Also renamed SS14SynchronizationContext to Robust*
2019-05-08 23:12:03 +02:00
Pieter-Jan Briers
967f144970 Do not catch timer timer exceptions on debug. 2019-05-08 23:11:38 +02:00
Pieter-Jan Briers
f548fd970e Do not catch Input exceptions in GameLoop on Debug. 2019-05-08 23:11:17 +02:00
Pieter-Jan Briers
5077b5ec4e Do not hide exceptions thrown in IoC service Dispose. 2019-05-08 22:59:45 +02:00
Pieter-Jan Briers
cd919302f8 Remove debug Console.WriteLine from SingleStreamLoader 2019-05-08 22:59:24 +02:00
Pieter-Jan Briers
f1c450e588 Make most tests parallel.
Now that IoC is thread local, this should be safe.
2019-05-08 22:33:46 +02:00
Pieter-Jan Briers
d6f288b667 Fix IoCManager_Test 2019-05-08 22:33:22 +02:00
Pieter-Jan Briers
6a9dac1b4e Fix GodotParserTest. 2019-05-08 22:33:15 +02:00
Pieter-Jan Briers
dec103ac1b Remove GameController.Mode
The difference between headless and Clyde is now handled by IoC.
2019-05-08 22:24:50 +02:00
Pieter-Jan Briers
d6a9343635 Make GameController created by IoC, remove GameControllerProxy. 2019-05-08 21:55:16 +02:00
Pieter-Jan Briers
dc6e186a26 Ensure Window Close does not fire from Dispose on Clyde. 2019-05-08 21:27:30 +02:00
Pieter-Jan Briers
4c02a2c059 Clean up GameController shutdown.
IoC is now cleared after the main loop finishes, not on Shutdown() call.
2019-05-08 21:27:02 +02:00
Pieter-Jan Briers
7d8ba30844 Don't include deleted components in GetAllComponents 2019-05-08 15:40:29 +02:00
Pieter-Jan Briers
1b4cbf58b8 Make all exceptions crash the game on debug. 2019-05-08 15:40:09 +02:00
Pieter-Jan Briers
6da21ab6c1 Clyde correct sRGB support.
This makes light stacking look less... awful.

Also minor cleanup.
2019-05-08 14:37:48 +02:00
Pieter-Jan Briers
0340cecd6d Clean up entity events some more. 2019-05-08 09:54:04 +02:00
Pieter-Jan Briers
878fade1bd Timers get cancellation support. 2019-05-08 09:48:57 +02:00
Pieter-Jan Briers
285f68b4dd Minor clean up of entity events. 2019-05-07 23:13:35 +02:00
Pieter-Jan Briers
afc2a747c8 Fix deleting entities that have containers. 2019-05-06 19:30:51 +02:00
Pieter-Jan Briers
3c9bcae474 Delete GodotWrapFont. 2019-05-06 16:44:34 +02:00
Pieter-Jan Briers
5c8986c075 Fix Texture.LoadFromImage not passing load params to Clyde. 2019-05-06 15:08:12 +02:00
Pieter-Jan Briers
454e5df939 Do not open tooltips for controls that have none. 2019-05-05 19:27:57 +02:00
Pieter-Jan Briers
c83ad3ab94 Map grid serialization fixes:
1. Actually makes grids stored row-major instead of column-major
2. Optimizations and cleanup.
2019-05-05 15:44:49 +02:00
Pieter-Jan Briers
1572d1fb3d Improve wording in the map format documentation file. 2019-05-05 15:44:11 +02:00
Pieter-Jan Briers
e032557c08 Fix Angle.Equals(object). 2019-05-05 15:43:59 +02:00
Pieter-Jan Briers
4979620486 Container improvements.
Make containers actually handle automatic removal of entities,
like say on unpartenting.
This was because a lot of content code was doing this manually,
and it broke, really badly.

They also emit events now that said content code can use instead.
2019-05-05 13:07:59 +02:00
Pieter-Jan Briers
3889066e9c Make parenting a transform to its current parent a no-op. 2019-05-05 13:05:31 +02:00
Pieter-Jan Briers
2c523115ab Fix compiler warning. 2019-05-05 11:48:51 +02:00
Pieter-Jan Briers
d62a6041ed Fix AppVeyor. 2019-05-05 11:26:14 +02:00
Pieter-Jan Briers
cde26f0567 Remove misc Godot references I missed. 2019-05-05 02:00:57 +02:00
Pieter-Jan Briers
cf2995437f Remove Godot support. (#805)
Let's be real, it's pretty damn broken already and will never be fixed.
2019-05-05 01:58:24 +02:00
Pieter-Jan Briers
296d39bee6 Make fonts use A8 textures.
Reduces VRAM usage.
2019-05-04 22:17:06 +02:00
Pieter-Jan Briers
772b680723 Render extended ASCII font glyphs. 2019-05-04 21:20:06 +02:00
Pieter-Jan Briers
e2c7a0086c Integration Testing Framework. (#804)
* Server works if not connected to a tty.

* Rich presence does not run IoC resolution at runtime anymore.

* Work towards integration tests.

Mostly work related to making it so the server and client can run in
parallel, and allowing more control over main loop for testing.

* Lots of code relating to integration tests.
2019-05-04 17:51:20 +02:00
Pieter-Jan Briers
6dc5b09005 Move escape menu over to C#, fix layout issues. 2019-05-04 17:51:01 +02:00
Pieter-Jan Briers
e538ca3879 Delete unused main menu scene files. 2019-05-04 17:50:47 +02:00
Pieter-Jan Briers
d621b1a611 Button default text align is centered.
This is in line with Godot's behavior.
2019-05-04 17:49:51 +02:00
Pieter-Jan Briers
130e8b7cf1 SS14Window now handles minsize correctly.
This means the root of it is now a container.
2019-05-03 17:12:01 +02:00
Pieter-Jan Briers
702f38e1fd Fix SplitContainer when constrained by minsize. 2019-05-03 17:11:13 +02:00
Pieter-Jan Briers
1a54d5f513 Load MarginContainer margins from tscn. 2019-05-03 17:10:50 +02:00
Acruid
39eeab14ea Disable Extrapolation (#803)
* Split GameState processing logic out of ClientGameStateManager into the new GameStateProcessor class.

* Adds a test fixture for GameStateProcessor with a basic use test.

* More unit tests and added Extrapolated property to GameStateProcessor.
2019-05-03 13:26:06 +02:00
Pieter-Jan Briers
ca97a46387 Fix headless client. 2019-04-29 13:13:09 +02:00
Pieter-Jan Briers
f4b0b69cbb Map Init & Map Loading improvements. (#801)
* MapInit v1, so people can criticize my code.

* Map init v1.

* Improve LocalPlayer to fix aghosting.

* Fix map saving.

* Map command improvements:

Implement loadbp
Made certain commands aware of uninitialized maps.

* Adds IMapManager.GetAllGrids()

* Add lsgrid and lsmap commands.

* MetaData component serialization fixes.

Serialize name and description default as null.
Don't serialize prototype.

* Explicit UID indices in map files.

* Update map format doc again.
2019-04-29 12:50:28 +02:00
Acruid
1b3cc8aba6 Grid Bounds (#800)
* Added centered unit box static field to Box2.

* MapGrid is more testable.

* Added some unit tests for MapGrid.
Fixed bug in MapChunk.GridTileToLocal().
MapGrid.UpdateAABB() actually expands properly now.

* Moved IMapChunk to Robust.Shared.Map.
Moved Chunk class out of MapManager class.

* Added unit tests for MapChunk.

* Bounds reduce by 1, so almost working.

* Now bound shrinking works :D

* Moved MapGrid out of MapManager.
Moved IMapGrid into the Shared/Map folder.
Replaced all calls to IMapGrid.ParentMap.Index with IMapGrid.ParentMapId.

* Added more MapGrid unit tests.
Fixed a bug in TryGetTileRef.
2019-04-29 12:43:20 +02:00
Acruid
d74151d242 Fixes ExposeData issue in MetaDataComponent. (#799) 2019-04-28 11:13:19 -07:00
Pieter-Jan Briers
0d00a6a659 Add Random.Prob extension method helper. 2019-04-27 21:16:30 +02:00
Pieter-Jan Briers
b2067da28f Remove dead folder reference from server csproj. 2019-04-26 16:08:33 +02:00
Pieter-Jan Briers
2d418eddf0 Prevent SpriteComponent spamming exceptions if RSI fails to load. 2019-04-26 15:48:22 +02:00
Acruid
5fe0bd6e55 EntityStates (#798)
* Added a new special MetaDataComponent to store entity data that isn't specific to a component.

* Adds ExposeData to MetaDataComponent.
Name of the entity now defaults to the prototype name.

* EntityStates changed so that the list of networked components is not sent every tick for a modified entity.

* Code cleanup & doc comments.

* MetaDataComponent Name and Description are taken from the prototype before storing them in the component.

* Adds the EntityState serializer benchmark. This isn't a test, but is really useful.

* Redesigned the logic in ServerGameStateManager.

* Adds MetaDataComponent registration to the UnitTesting project.
2019-04-26 15:38:56 +02:00
Víctor Aguilera Puerto
dabc3194b0 ItemLists now have a scrollbar and can be scrolled with the mouse wheel as well. (#797)
* You can scroll ItemLists now.

* ScrollBar actually appears!

* Remove System.Drawing

* Move total content height away from the drawing loop, recalculate it...

...when needed.

* Take ActualBackground minimum vertical size into account

* Fix cases where lists didn't scroll to the very bottom.

* Fix CalculateMinimumSize for real I hope
2019-04-23 01:51:42 +02:00
Acruid
7053fb15f8 Map System Code Refactor (#796)
* Removed unused method TileRef.GetStep().
Removed unused property TileRef.TileSize.
Removed unused property TileRef.Tile, made the field public with the same name.
Made the TileRef struct readonly.
Removed property TileRef.TileDef.
Removed property TileRef.LocalPos.
Renamed GridTile to GridIndices.
Implemented IEquatable on TileRef.
Implemented Equality operators on TileRef.
Added PublicAPI attribute to TileRef.
Added doc comments to TileRef.

* Modified Tile:
Added the PublicApi annotation.
Made struct readonly.
Filled out doc comments.
Changed auto properties to readonly fields.
Renamed TileId to TypeId.
Added a static Empty tile to the struct.
Implemented IEquatable.

* Modified MapCoordinates:
Added PublicApi attribute.
Implemented IEquatable.
Filled out doc comments.
Removed Map property.

* Modified ScreenCoordinates:
Filled out doc comments.
Added the PublicApi attribute.
Implemented IEquatable.

* Modified GridCoordinates:
Removed method IsValidLocation.

* Removed property GridCoordinates.Grid.

* Removed GridCoordinates.Map.

* Removed GridCoordinates.MapId.

* Removed property GridCoordinates.IsWorld.
Removed constructors taking a MapId.

* Removed static IoCManager calls from GridCoordinates.

* Modified GridCoordinates:
Added attribute PublicApi.
Filled out doc comments.

* Filled out doc comments for MapGrid.
Filled out doc comments for MapIndices.
Misc refactors for both.

* added command to teleport grids.

* Added method Box2.Intersect.
Added method Box2.Union.
Placement manager now spawns new grids to place tiles not connected to an existing grid.
2019-04-20 20:37:37 +02:00
Acruid
a5a3a539dc Tick Logic Timing and Bandwidth Improvements (#795)
Code was changed so that time starts at tick zero, and all entities are initialized in the space between tick 0 to 1. This was a solution to the fact fromSequence was including entities with lastStateUpdate tick one less than the actual sequence number. This is purely an issue about when exactly the game does its logic relative to the tick signals, ie positive or negative edge of the tick. Right now the game is set up to run the game logic on the positive edge of a Tick (enforced by GameLoop).

The second big part is that an empty collection takes 5ish bytes more than a null collection in the NetSerializer, even though they are conceptually the same thing in a game state. This PR puts null checks around everything and allows GameStates to have whole sections of itself null. This reduced the payload size of an empty game state from 49B to 15B.

This PR also fixes the bug where the physics system marks every movable entity as dirty every tick.
2019-04-20 18:08:43 +02:00
Acruid
faf99d2231 By default events raised on the ECS event bus are now dispatched immediately. (#794)
Added a new EntityManager.QueueEvent() method that queues the event for the next tick.
2019-04-20 10:58:04 +02:00
Pieter-Jan Briers
55fb70af8b Fix some compiler warnings. 2019-04-19 23:24:19 +02:00
Pieter-Jan Briers
33480f5527 Improve StatusHost
Now uses a list of handlers to make it easier to add REST API endpoints.
2019-04-17 23:24:36 +02:00
Pieter-Jan Briers
ce052d4db3 Add method to post a delegate to the main thread.
Helps for writing threaded code.
2019-04-17 23:23:35 +02:00
Pieter-Jan Briers
28290614a1 Fix CVar command not working to set string CVars with null value. 2019-04-17 23:22:30 +02:00
Silver
25926a17b7 Renames SS14.* to Robust.* (#793)
RobustToolbox projects should be named Robust.* 

This PR changes the RobustToolbox projects from SS14.* to Robust.*

Updates SS14.* prefixes/namespaces to Robust.*
Updates SpaceStation14.sln to RobustToolbox.sln
Updates MSBUILD/SS14.* to MSBUILD/Robust.*
Updates CSProject and MSBuild references for the above
Updates git_helper.py
Removes Runserver and Runclient as they are unusable
2019-04-15 20:24:59 -06:00
tentekal
3aec6eb561 Quick fix for wall draw depth being above the player (#792)
I guess I accidentally removed some comment strings and didn't realize until I pushed. Related to issue #180 on the content repo. I'll put in a separate PR on that repo to fix the prototype for walls too.
2019-04-15 11:28:18 -06:00
PrPleGoo
02f2e051dc Actual lockers (#787)
Adds storing entities into lockers the way we all know and love.
2019-04-14 21:17:33 +02:00
Pieter-Jan Briers
aa5581f10f Discord Rich Presence improvements:
Makes it toggle-able with a CVar.
2019-04-13 21:07:30 +02:00
Pieter-Jan Briers
8875b88e0f Fix the main menu breaking upon disconnect.
Simulation is necessary for UI to work but it was getting paused.
2019-04-13 21:06:34 +02:00
Pieter-Jan Briers
0a3b2e9bf7 Change config system so you can get notified on config changes. (#791)
Fixes #257
2019-04-13 19:57:14 +02:00
Pieter-Jan Briers
39bfa9f0c3 Change default tick rate back to 60 2019-04-13 13:38:20 +02:00
Pieter-Jan Briers
6b8311100b Fix crash on client connect. 2019-04-13 13:38:15 +02:00
Pieter-Jan Briers
e9b45adf1c Remove chat from the engine. (#790)
* Remove chat from the engine.

* I could've sworn I ran tests
2019-04-13 09:41:28 +02:00
Acruid
a2c1ddb22c Entity Interpolation (#789)
* add a new GameTick struct.

* Everything now uses the new GameTick struct.

* TickRate was changed to a byte, no way it is going over 255.
Fixed bug with changing TickRate after the loop has started.
Client now properly sets the TickRate when connecting to a server.

* Removed the old CurTime fields from game states.
Getting to the Connected runlevel on the client does not require a gamestate.
GameState processing now only starts after the client runlevel >= Connected.
Added some preprocessor conditions to not catch exceptions in Debug builds.
Nightly work on the GameStateManager, it is still pretty broken.

* NetMessages now have a Size property.
Player states were fixed, you can now join the game again!

* Frame interpolation kinda works.

* Frame Interpolation pretty much works!

* simulation can now catch up if a lag spike causes it to fall behind.

* Added concommand to debug draw the interpolation targets.

* Fixed a bug with applying just the NextState to an entity.

* Skip/replay a tick to slow down if the client is running ahead of the server.

* Solved a null ref exception when an extrapolated packet is applied.

* The TickRate is now officially 10.

* ClientGameStateManager stops running when the client leaves the server.

* Replaced poorly implemented FastForward with new TickTimingAdjustment.

* Update System.Runtime.CompilerServices.Unsafe to get rid of version conflict.

* Added 'net.interp' cvar.

* Disabled frame interpolation by default. The entire feature will be disabled until clientside input prediction is working.

* Removed or disabled log spam.
Fixed Transform unit test.

* Fix compile.
2019-04-13 09:33:01 +02:00
Acruid
613ad10f29 Remove InjectDependencies Calls (#784)
* Removed Static IoC calls from MapLoader.
Misc Code cleanup in MapLoader.

* Removed static IoC calls from ViewVariablesPropertyControl.

* StateManager now uses the DynamicTypeFactory to create States.
Removed static IoC calls from States.

* EntitySystemManager now uses the DynamicTypeFactory to create States.
Removed static IoC calls from EntitySystems.
Minor code cleanup.

* Removed static IoC calls from DebugDrawing.

* ComponentFactory now instantiates Components with IDynamicTypeFactory.
Removed static IoC calls from all engine components.
Misc code cleanup.

* Removed static IoC calls from all DebugMonitors.
Misc code cleanup.

* Removed static IoC calls from spawn windows.

* Removed static IoC calls from UserInterface/CustomControls.

* Fixed unit tests.

* Removed static IoC calls from AppearanceComponent.
2019-04-12 21:04:03 -07:00
PrPleGoo
eec287c19a Locker shoving (#785)
Added a bool to ICollidable to indicate friction with the floor, for thrown items down the line.
Added a bool to PhysicsComponent to indicate if movement is possible.
Added list of PhysicsComponent that are slowing "this" down.
PhysicsComponent handles BumpEntMsg by adding the bumping entity to that list.
Implemented ICollideSpecial to prevent collision with items in that list.
Reworked movement code:
- Separated calculating movement from doing movement;
- Calculating movement now involves several recalculations to see who is on "that" list;
- Friction of a tile now slows movement down depending on an object's mass;
Optimized collision code by building a Dictionary with a snapped grid location for key, reducing the amount of bodies that need to be checked significantly.
2019-04-12 19:40:21 +02:00
PrPleGoo
fb21726dfa Rendering order now done by who was last dirty instead of Uid (#786) 2019-04-12 00:09:55 +02:00
Pieter-Jan Briers
4b663fd508 Implement RichTextLabel, move FormattedMessage to shared. 2019-04-09 16:42:25 +02:00
Pieter-Jan Briers
277647e0c7 Add a helper to async await net messages in entity systems. 2019-04-09 14:41:42 +02:00
Pieter-Jan Briers
5c7a8624c4 You cannot click invisible entities. 2019-04-09 13:40:13 +02:00
Pieter-Jan Briers
f6b7601575 Prevent infinite loop when parenting control to itself. 2019-04-09 13:40:04 +02:00
Pieter-Jan Briers
afc8048d8a Refuse to start if content is not loaded. 2019-04-09 13:03:29 +02:00
Pieter-Jan Briers
dd60ca8883 Shoddy SplitContainer implementation. 2019-04-09 01:41:17 +02:00
Pieter-Jan Briers
25615842c5 Do not render lights on a different map. 2019-04-08 23:14:08 +02:00
Pieter-Jan Briers
b172a47d9e Implement Tree if shoddily. 2019-04-08 18:57:56 +02:00
Pieter-Jan Briers
e40cda6c99 Fix ForceSpawnEntityAt on client throwing an exception. 2019-04-08 18:03:34 +02:00
Acruid
d58d576677 Entitiy Queries & TypeFactory (#783)
* Changed EntityQueries for 3x perf increase for the EntitySystemManager.Update() method.
Removed the useless giant list EntityQuery.
Allowed the DependencyCollection to be able to inject itself as a dependency. Hopefully it won't be abused too bad.
Added the new IDynamicTypeFactory to IoC for instantiating arbitrary types. This removes the need for Activator.CreateInstance() and IoCManager.InjectDependencies() anywhere in code.
Utilized IDynamicTypeFactory in IComponentManager as an example of its use.

* Added IDynamicTypeFactory to SS14UnitTest.
2019-04-08 12:11:01 +02:00
tentekal
e689da51ba Implemented IEquatable on Angle (#782)
* Implemented IEquatable on Angle

* Removed extrenous code to GetHashCode
2019-04-08 12:10:13 +02:00
Pieter-Jan Briers
42e883c097 Move keybinds OUT of the engine. 2019-04-06 18:06:24 +02:00
Víctor Aguilera Puerto
a890957d30 Implement ItemLists. (#781)
Resolves #756
Style in https://github.com/space-wizards/space-station-14/pull/183

It works, but I'm sure it can be improved further.
2019-04-06 17:04:32 +02:00
Pieter-Jan Briers
1640eb2b6b Fix warning in Lidgren. 2019-04-06 14:41:48 +02:00
Pieter-Jan Briers
506d9a8c22 Stop using Encoding.UTF8. Use EncodingHelpers.UTF8
Apparently, Encoding.UTF8 defaults to inserting a BOM.
This is very dumb.

EncodingHelpers.UTF8 does not emit BOMs.
2019-04-05 01:57:44 +02:00
Pieter-Jan Briers
1b72be9923 Adds GridCoordinates.Distance(GridCoordinates) helper method. 2019-04-05 00:19:35 +02:00
Pieter-Jan Briers
685f9dc07a Copy paste is a dangerous thing. 2019-04-04 19:44:10 +02:00
Pieter-Jan Briers
7e6b5ec290 Adds a frame graph to F3. 2019-04-04 19:20:43 +02:00
Pieter-Jan Briers
6db4722a13 Actually draw ScreenSpace overlays. 2019-04-04 16:23:41 +02:00
Pieter-Jan Briers
fa15950b91 Remove player movement code from the engine. (#780) 2019-04-04 16:18:06 +02:00
Injazz
9ff6a7ec02 Initial Discord Rich presence (#776)
thanks @occune for initial work
put some edits there
doesnt work on macos(waiting on nuget update again)
btw future reference: https://discordapp.com/developers/docs/rich-presence/how-to
2019-04-04 15:14:28 +02:00
Pieter-Jan Briers
c8d939a732 Rework entity initialization. (#779)
* Rework entity initialization.

Map loading now correctly processes entity load stages:
1. First all entities are allocated. This allocates the entity and gives
   it a UID, nothing more. No user code is executed.
2. Then all entities are loaded. This runs ExposeData on components.
3. Then all entities are initialized. This runs Initialize.
4. Then all entities are started. This runs Startup.

Entity spawning methods on IEntityManager now actually set position
before Initialize.

Also cleaned up a lot of spaghetti.

* Add some comments.
2019-04-04 15:07:34 +02:00
Injazz
b1bf694c35 Prettyfying README.MD (#777)
Adds header, fixes few links
![rtgithubheader](https://user-images.githubusercontent.com/43905364/55467941-bb6b7c00-561b-11e9-9e11-998f6d158914.png)
2019-04-04 15:06:59 +02:00
Pieter-Jan Briers
0c1c9fae33 Mark YamlHelpers as pure. 2019-04-04 01:37:53 +02:00
Pieter-Jan Briers
5e711072d9 Remove unused field. 2019-04-04 00:36:07 +02:00
Pieter-Jan Briers
0c93f3756a Fix IconSmooth being ignored in engine instead of content. 2019-04-04 00:35:41 +02:00
Pieter-Jan Briers
322fb06be1 Add TileRef GetTile(MapIndices tileCoordinates) to IMapGrid. 2019-04-04 00:33:39 +02:00
Pieter-Jan Briers
d71218943d Expose MapIndices for TileRef. 2019-04-04 00:33:21 +02:00
Pieter-Jan Briers
d7d0363cc3 Refactor tile IDs. (#778)
* Refactor tile IDs.

Tile IDs are now automatically assigned at runtime.
A mapping is also stored in map files to avoid compatibility issues.
Also removed tile prototypes. Content is now responsible for it.
This is so content can define its own data for tiles.

* Update map format specification.

* Fix tile placement.
2019-04-03 21:19:55 +02:00
Pieter-Jan Briers
2bb73aa93d Fix macOS builds. 2019-04-01 21:43:05 +02:00
Pieter-Jan Briers
d4cd328f96 Implement UI tooltips. 2019-04-01 20:05:25 +02:00
Pieter-Jan Briers
633eaade45 Prevent empty usernames. 2019-04-01 15:53:29 +02:00
Pieter-Jan Briers
c176392599 New main menu.
Has a join public server button and a username field.
2019-04-01 15:53:21 +02:00
Pieter-Jan Briers
78fc0af6cb Try to fix macOS 2019-04-01 15:14:09 +02:00
Pieter-Jan Briers
c1ec11b4c2 Fix bad log call in AssemblyLoader. 2019-04-01 02:00:36 +02:00
Pieter-Jan Briers
859a39b41b Fix server going in infinite loop. 2019-03-31 16:24:07 +02:00
Pieter-Jan Briers
e5ee9c19ab Fixes server exceptions from #773 (#775) 2019-03-31 14:54:11 +02:00
Pieter-Jan Briers
9e9508937a Fix lights going weird when resizing the window (#774) 2019-03-31 14:50:28 +02:00
Silver
d337fda1e9 localpath special character work around 2019-03-30 18:09:09 -06:00
Pieter-Jan Briers
25a485aea7 NetManager connection handshake improvement. (#773)
* Reworked the net manager connection sequence.
* Correctly handle IPv4/IPv6 prioritization and fallback.
* Making a proper handshake for an auth system further down the line should be much easier now too.
* Added feedback to connection sequence in the main menu.
2019-03-31 00:51:10 +01:00
Pieter-Jan Briers
b5635201c2 Automate GodotSharp.dll download 2019-03-30 23:17:29 +01:00
Silver
e758c114bd Update download_ss14_noise.py 2019-03-30 00:43:47 -06:00
Silver
4fda7867b1 Update readme.md 2019-03-29 14:10:32 -06:00
Pieter-Jan Briers
b72962ac14 Made server data self contained. 2019-03-28 20:45:15 +01:00
Pieter-Jan Briers
5069a2b1a9 Options menu now includes a high res lights toggle. 2019-03-28 19:31:33 +01:00
Pieter-Jan Briers
65e3b0d0d9 Fix default user name being invalid. 2019-03-28 19:30:36 +01:00
Pieter-Jan Briers
f4cd69139d Config refactor.
Config is now stored in the user data directory.
User data directory is now correctly set depending on system.
2019-03-28 16:59:25 +01:00
Pieter-Jan Briers
92bb1d05ba Fix compiler warning in server. 2019-03-28 14:28:57 +01:00
Pieter-Jan Briers
0852561cc1 Implement line rendering in Clyde.
Fixes #754
2019-03-28 14:24:36 +01:00
Pieter-Jan Briers
d4c56c7e9f Fix scrolling not working in entity spawn panel. 2019-03-28 11:31:34 +01:00
Pieter-Jan Briers
20f29fa899 Make entity spawn panel not hang (as much) with this one simple trick. 2019-03-28 11:24:45 +01:00
Pieter-Jan Briers
a30334fc74 Try to work around CAS violations on Windows 10. 2019-03-28 11:12:22 +01:00
Pieter-Jan Briers
8a478326a0 SubscribeEvent<T>(EntityEventHandler<T> evh) for EntitySystem. 2019-03-28 11:12:22 +01:00
Nirnael
287dfceb81 Adds a frame counter to timing debug monitor (#769)
Use case explained in its documentation. I could probably make it a long in case someone runs at thousands of fps for days, or make it debug only.
2019-03-28 09:32:56 +01:00
Pieter-Jan Briers
9661c4490c Merge branch 'master' of github.com:space-wizards/space-station-14 2019-03-27 22:57:22 +01:00
Pieter-Jan Briers
a2e9e0d15f Adds "hide UI" keybind.
Man posting screenshots is much nicer when there's no ugly chat window.
2019-03-27 22:50:19 +01:00
Nirnael
6481a22a71 Establish standard format for runtime log naming and future-proof it until the human race perishes (#767)
This PR establishes the format "Runtime-yyyy-MM-dd-THH-mm-dd.txt" for runtime logs from the server, preventing locale from messing with string escape characters and causing directory runtimes at next line. ~I've replaced the dash with an underscore as they can cause problems in some shells such as windows CLI.~ Dashes are staying because whoever has a shell that complains needs to get a new one.

~~**_I have most importantly made sure that SS14 can live on until the year of our Lord God Emperor and veritable saviour 99,999 Anno Domini of the Gregorian Calendar by extending the runtime-log-naming  year range to 5 digits._**~~ 
~~_Let the meme PRs begin if they haven't already_~~

4 digits so logs will display until 9999, godspeed future maintainers.
2019-03-27 22:46:11 +01:00
Víctor Aguilera Puerto
72fcf86227 AudioParams can be defined in YAML now (#768) 2019-03-27 22:45:49 +01:00
Pieter-Jan Briers
84b4b3d6b5 Bind QuadVAO in _drawQuad.
This fixes lighting if parallax isn't initialized yet.
2019-03-27 18:18:19 +01:00
Pieter-Jan Briers
14bfb8aa5b Suppress gdparse warnings. 2019-03-27 17:16:27 +01:00
Pieter-Jan Briers
6d4612e40b Fix edge sampling issues on nvidia. 2019-03-27 15:53:53 +01:00
Pieter-Jan Briers
4c3ed1181d Allow toggling light rendering with a command. 2019-03-26 19:46:55 +01:00
Pieter-Jan Briers
0763f949a5 Properly fix ClipboardManagerLinux. 2019-03-26 14:52:47 +01:00
Pieter-Jan Briers
46a89686bc Half lightmap dimensions by two on Intel iGPUs.
I was unable to reach 60 FPS steady on my Intel UHD 630,
so I'd say this is probably warranted.

It doesn't reduce visual quality in any way I can tell.
2019-03-26 14:38:01 +01:00
Pieter-Jan Briers
b26bab1361 Implement SpriteComponent Rotation on Clyde. 2019-03-26 11:45:32 +01:00
Injazz
27a91e3880 Implements move disabler (#765)
blocks entity movement
2019-03-26 11:17:13 +01:00
Pieter-Jan Briers
2043a1e345 Fix exception if trying to delete air with placement. 2019-03-26 09:32:04 +01:00
Pieter-Jan Briers
2850bc80d1 Make Clyde more uuuh robust against problems. 2019-03-26 09:31:47 +01:00
Pieter-Jan Briers
5942e6fba6 Deleting an entity deletes entities in containers too.
If you want to avoid this behavior, the entity can be ejected early.
2019-03-26 09:04:22 +01:00
Pieter-Jan Briers
458a5a05b2 Fix inability to move while placing. 2019-03-26 08:46:28 +01:00
Pieter-Jan Briers
8efd997810 Implement OptionButton shoddily but functionally. 2019-03-26 08:28:50 +01:00
Pieter-Jan Briers
0dd5f72b3b Fix Popup control defaulting to visible. 2019-03-26 08:28:34 +01:00
Pieter-Jan Briers
ab9f9a99d6 Implement modal popups correctly. 2019-03-26 01:10:15 +01:00
Pieter-Jan Briers
7870a540cf IList<T>.Pop() Helper. 2019-03-26 01:09:47 +01:00
Pieter-Jan Briers
74e002b5a0 I fixed'nt it in the wrong direction. 2019-03-26 00:09:32 +01:00
Pieter-Jan Briers
eac17e5b25 Placement manager cleanup. 2019-03-26 00:01:36 +01:00
Pieter-Jan Briers
df6feae7f4 Fix incorrectly offset godot and clyde grid rendering.
Every tile was incorrectly one tile down.
2019-03-26 00:01:23 +01:00
Pieter-Jan Briers
120beb29ad More verbose TileRef ToString. 2019-03-26 00:00:44 +01:00
Pieter-Jan Briers
522ce2fe59 Current grid tile in debug coords panel. 2019-03-26 00:00:32 +01:00
Pieter-Jan Briers
bc9b490169 Fix placement modes not centering large sprites correctly. 2019-03-25 23:13:51 +01:00
Pieter-Jan Briers
34a5649462 Fix reconnect exception. 2019-03-25 14:04:05 +01:00
Pieter-Jan Briers
1ff08f70ef More culture fixes for YamlObjectSerializer 2019-03-25 13:26:07 +01:00
Pieter-Jan Briers
cc0948c1e2 Adding entity while iterating all entities works now. 2019-03-25 13:09:26 +01:00
Pieter-Jan Briers
e3117263ac Ah crap. 2019-03-25 12:55:00 +01:00
Pieter-Jan Briers
83baaea8f1 Fix locale issues with map saving. 2019-03-25 12:47:56 +01:00
Pieter-Jan Briers
75ebdb4a00 Remove debug code from clipboard managers. 2019-03-25 12:47:55 +01:00
Remie Richards
f4983cc1cc Expose a readonly version of YamlObjectSerializer's TypeSerializer dict. (#763) 2019-03-24 23:37:43 +01:00
Pieter-Jan Briers
00694aa46b AppVeyor fix attempt 2 2019-03-24 20:39:16 +01:00
Pieter-Jan Briers
8e80e3a5c3 AppVeyor fix attempt 1 2019-03-24 20:28:05 +01:00
Pieter-Jan Briers
1f42e9672d Re-implement RSI atlassing with norma atlasses. 2019-03-24 20:01:45 +01:00
Pieter-Jan Briers
6328fb86b3 Fix incorrect tile atlas generation. 2019-03-24 20:01:20 +01:00
Pieter-Jan Briers
226ec200ca Use Rgba16f for lighting framebuffer.
This significantly improves performance and I can't tell a difference.
2019-03-24 17:31:25 +01:00
Pieter-Jan Briers
1c460e1d85 Fix unit tests. 2019-03-24 17:20:39 +01:00
Pieter-Jan Briers
54c920b2d4 Grid rendering improvements:
1. tile sprite is no longer hardcoded so multiple floor types is
possible.
2. Batches are cached across frames to improve performance.
2019-03-24 17:19:01 +01:00
Víctor Aguilera Puerto
422fe4666e Remove SS14.Shared.Bsdiff from submodules. (#762)
Seems it's not really needed anymore.
2019-03-24 13:51:49 +01:00
PJB3005
ae21b98d9a Implement clipboard on Windows 2019-03-23 20:08:44 +01:00
Pieter-Jan Briers
a74f8c9787 Re-implement UserInterfaceManager.Popup. 2019-03-23 17:21:43 +01:00
Pieter-Jan Briers
de50dcf49c Add clipboard support. 2019-03-23 17:17:10 +01:00
Pieter-Jan Briers
dd37e54e43 Switch lighting framebuffer back to Rgba32f.
Apparently implementations aren't required to implement Rgb32f.
2019-03-23 16:25:44 +01:00
Pieter-Jan Briers
43c06c81c0 Less hideous outlines. 2019-03-23 15:02:31 +01:00
Pieter-Jan Briers
4767b23fb8 Adds a camera offset to eyes. 2019-03-23 14:39:13 +01:00
Pieter-Jan Briers
9e0c33c9bf Rays do not intersect with non hard collidables.
This was causing you to be unable to fire a laser gun through an open
door.
2019-03-22 23:57:08 +01:00
Pieter-Jan Briers
ab1dfed25c Rebuild world matrix on parent change.
This fixes things getting reset to 0,0 on ejection from containers.
2019-03-22 22:15:51 +01:00
Pieter-Jan Briers
e467df24f8 Do not show nested entities in showbb. 2019-03-22 22:15:31 +01:00
Pieter-Jan Briers
bc79f07395 Remove HRTF hack.
Turns out it's HRTF and disabling it at a system level is better.
2019-03-22 22:05:41 +01:00
Pieter-Jan Briers
94e5561157 Just commit the fancy main menu already.
I've been sitting on this for weeks and I'm too lazy to make it "proper"
So I'll just push it like this.
2019-03-22 21:51:41 +01:00
Nirnael
ee3c017104 Fix runtimes log missing dir exception (#761) 2019-03-22 21:50:05 +01:00
Remie Richards
c73cb9fefc Error/Hint when using RSIs as texture in SpriteComponent (#760)
We've all ran into this before.
2019-03-22 21:49:56 +01:00
Pieter-Jan Briers
5d855b7aec Spawn command works from server console. 2019-03-22 21:49:20 +01:00
Pieter-Jan Briers
3222574b61 Load up icon. 2019-03-22 21:49:20 +01:00
Pieter-Jan Briers
dd3bd307ed Update readme. 2019-03-22 21:49:20 +01:00
Pieter-Jan Briers
cf7c401ee0 Runtime Log & Exception Catching. (#759) 2019-03-22 12:50:17 +01:00
Pieter-Jan Briers
41cd4ca888 Time for 5 commits trying to fix Travis. 2019-03-21 23:29:09 +01:00
Pieter-Jan Briers
21be226b33 Fix audio quality on Linux? 2019-03-21 23:28:25 +01:00
Pieter-Jan Briers
3c8ee48d3f Use Rgb32f instead of Rgba32f for lighting buffer. 2019-03-21 21:53:32 +01:00
Pieter-Jan Briers
d382f7e6ab SS14Serializer improvements:
1. OpenTKTypeSerializer is no longer necessary since we have our own
math types.
2. Added a check to prevent NetSerializable on server/client types.
2019-03-21 21:30:10 +01:00
Pieter-Jan Briers
2dc42a7b75 Fix missing dependency issues:
Load up OpenTK.dll.config again. PackageReference doesn't copy it due to
incorrect packaging.
I had to make packages be downloaded locally to the solution again via
nuget.config to do this, because otherwise I couldn't get a reference to the OpenTK.dll.config in the NuGet package.

Adds a Python script to auto download freetype6.dll and openal32.dll on
Windows.
2019-03-21 18:49:25 +01:00
Pieter-Jan Briers
fdc414975b Fix inability to open APC on Godot. 2019-03-21 18:08:47 +01:00
Pieter-Jan Briers
75d13cc8a1 Implement Modulate on controls under Clyde.
This fixes content notifies crashing.
2019-03-21 18:02:51 +01:00
Pieter-Jan Briers
c5f6f9b12a Correctly apply shaders to sub handles of overlays on Clyde.
Fixes lasers not being unshaded.
2019-03-21 17:52:20 +01:00
Pieter-Jan Briers
39dffd6d9e Increase darkness brightness.
This should be more in line with Godot.
2019-03-21 17:51:56 +01:00
Pieter-Jan Briers
2195c1653a Clyde now does lights.
Shadows not included.
2019-03-20 23:25:46 +01:00
Pieter-Jan Briers
505f6b2fd7 Fix config system errors due to audio device. 2019-03-20 23:25:08 +01:00
Pieter-Jan Briers
3cf0a19c36 Effects work on Clyde.
Closes #757
2019-03-20 14:33:42 +01:00
Pieter-Jan Briers
c5c74d7f1d Apply pitch and volume. 2019-03-20 01:12:13 +01:00
Pieter-Jan Briers
824e071eb6 Avoid OpenAL errors by disposing all audio sources on shutdown. 2019-03-20 00:26:53 +01:00
Pieter-Jan Briers
6d523f8551 Audio stream playback in animations. 2019-03-19 23:55:58 +01:00
Pieter-Jan Briers
fc7ca1471c Use NVorbis for Vorbis decoding.
Removes one native dependency.
2019-03-19 23:18:21 +01:00
Pieter-Jan Briers
88a0ba7172 Audio actually gets played back now. 2019-03-19 22:41:09 +01:00
Pieter-Jan Briers
492ffe159b Rename "OpenGL" to "Clyde" where applicable. 2019-03-19 17:08:43 +01:00
Pieter-Jan Briers
a6d21996c7 OpenAL beginnings and audio sample loading. 2019-03-19 16:58:00 +01:00
Pieter-Jan Briers
a236193e24 Outlines draw now. 2019-03-19 00:45:12 +01:00
Pieter-Jan Briers
835dba99a4 The big "suddenly shaders" commit.
Clyde does custom shaders. Woo!

Still some things need implementing like custom uniforms and vertex shaders,
but this commit is big enough as is.

Also gets rid of texture array based batching because it was a pain.
2019-03-18 23:52:49 +01:00
Pieter-Jan Briers
379d653117 Fix Godot. 2019-03-18 15:00:35 +01:00
Pieter-Jan Briers
9eb6a75290 Remove dead SpriteView file. 2019-03-17 22:32:38 +01:00
Pieter-Jan Briers
67528e9c20 Pretty sure this fixes Godot 3.1 support. 2019-03-17 22:32:21 +01:00
Pieter-Jan Briers
ff2a642b4a Adds list pick utility. 2019-03-17 15:48:12 +01:00
Pieter-Jan Briers
19784b4c31 Adds entity delete command. 2019-03-17 15:34:57 +01:00
Pieter-Jan Briers
d524d3138f Do not render invisible sprite components. 2019-03-17 15:34:05 +01:00
Pieter-Jan Briers
b8a7c36f0c Add EntityUid.TryParse method. 2019-03-17 15:33:53 +01:00
Pieter-Jan Briers
2d127a476b Fix incorrect ordering of godot scene siblings without explicit index in their header. 2019-03-17 14:36:44 +01:00
Pieter-Jan Briers
ee54f35185 Ensure consistent entity drawing order. 2019-03-17 13:27:13 +01:00
Pieter-Jan Briers
a1425e03fc Animation system. 2019-03-17 13:23:54 +01:00
Pieter-Jan Briers
fca69233ea Fix non-incrementing LayerSetAnimationTime 2019-03-17 13:22:47 +01:00
Pieter-Jan Briers
437f01bd14 Fix timers dropping seconds. 2019-03-17 12:14:01 +01:00
Pieter-Jan Briers
01b781ac03 Optimize SpriteComponent.LayerSetAnimationTime for going forward.
Also actually fix it setting texture.
2019-03-17 00:36:22 +01:00
Pieter-Jan Briers
19c47e93dc Allow controlling animations externally on sprite component. 2019-03-17 00:27:46 +01:00
Pieter-Jan Briers
1c3b7fe242 Animated RSI states have an animation length now. 2019-03-17 00:27:06 +01:00
Pieter-Jan Briers
8f966e2c83 Rework SpriteComponent animation code.
It now assumes that a state has the same total animation length for each
direction, this solves problems like rotating resetting animations.
Also paves the way for manual animation control.
2019-03-16 23:26:10 +01:00
Pieter-Jan Briers
866f96b912 Print exception stack trace when a command errors on the server. 2019-03-16 21:21:43 +01:00
Pieter-Jan Briers
b092aa2ccf Don't run Godot circle drawing on Clyde. 2019-03-16 21:21:25 +01:00
Pieter-Jan Briers
369e6d4f11 Actually respect the prototype default placement mode.
This is kinda just a stopgap since the selection button
isn't implemented on Clyde.
2019-03-16 21:20:43 +01:00
Pieter-Jan Briers
370302ce59 Fix ToRelativePath() for "/" 2019-03-16 21:19:33 +01:00
Pieter-Jan Briers
c2782cb0b9 Improve savebp command:
1. Now gives feedback whether the save worked.
2. Actually listen to the path argument.
2019-03-16 20:50:08 +01:00
Pieter-Jan Briers
b73df4c478 Make trying to get a nonexistant component have a better error. 2019-03-16 20:23:36 +01:00
Pieter-Jan Briers
73bd4f6301 Actually load window size from config file. 2019-03-16 19:08:15 +01:00
Pieter-Jan Briers
34821b7e9b Change GL context version to 3.3.
I have decided that we should be able to run the code on OpenGL 3.3.
Mostly because I was inspired to keep it working on that 2008 macbook.
2019-03-16 19:03:53 +01:00
Pieter-Jan Briers
fde75ad02a SpriteComponent uses WorldMatrix & handles Directional correctly.
This makes gun projectiles look correct.
2019-03-16 18:57:04 +01:00
Pieter-Jan Briers
13ce078126 Matrix3.CreateRotation override for Angle. 2019-03-16 18:56:28 +01:00
Pieter-Jan Briers
fef7fe1980 Use in parameter for DrawingHandle.SetTransform(Matrix3) 2019-03-16 18:35:06 +01:00
Pieter-Jan Briers
a3594b2ded Set anchors to zero in Container.FitChildInBox(). 2019-03-16 18:25:32 +01:00
Pieter-Jan Briers
8c184864e2 Fix MarginContainer size calculations. 2019-03-16 18:25:18 +01:00
Pieter-Jan Briers
5bc9073b26 Implement GridContainer. 2019-03-16 18:13:27 +01:00
Pieter-Jan Briers
70d18a13b1 Do not apply text align if button has to clip text. 2019-03-16 18:13:17 +01:00
Pieter-Jan Briers
68a5e75ea8 Implement CenterContainer. 2019-03-16 16:46:15 +01:00
Pieter-Jan Briers
80900ba708 Implement MarginContainer. 2019-03-15 23:51:24 +01:00
Pieter-Jan Briers
9fbaf144a6 Channels the power of spaghetti to implement SpriteView in Clyde.
I'm channeling the power of spaghetti through individual spaghett-
Wait what do you call an individual thing of spaghetti.
A noodle?
A strand?
Should I use this word every time I write bad code?

// Noodle incoming.

So many questions.
2019-03-15 19:07:03 +01:00
Pieter-Jan Briers
8d78fc41e7 Prevent crash when rendering fonts. 2019-03-13 23:20:08 +01:00
Pieter-Jan Briers
010d32424a Relicense future code to MIT. 2019-03-13 13:25:55 +01:00
Pieter-Jan Briers
ae0d34cd7e Just barely implement Popup 2019-03-12 10:01:00 +01:00
Pieter-Jan Briers
db45961936 Fix middle and right click being treated as left click. 2019-03-12 10:00:44 +01:00
Pieter-Jan Briers
b2bb711dbb CheckBox works. 2019-03-11 11:55:13 +01:00
Pieter-Jan Briers
d139203367 UITest command for testing. 2019-03-08 17:14:11 +01:00
Pieter-Jan Briers
ec314a64b2 Implement ProgressBar 2019-03-08 17:14:01 +01:00
Pieter-Jan Briers
ebbcd36524 Define CheckButton so APC UI opens 2019-03-08 17:13:49 +01:00
Pieter-Jan Briers
4874254acc Apparently I completely forgot to push this.. 2019-03-08 17:13:14 +01:00
Pieter-Jan Briers
af186959db Load Range values from tscn. 2019-03-08 17:12:37 +01:00
Pieter-Jan Briers
f6e4dd6a00 Drop keyboard focus when clicking on nothing. 2019-03-08 14:22:14 +01:00
Pieter-Jan Briers
d025065d40 Controls now lose focus when hidden or deleted. 2019-03-08 14:18:14 +01:00
Pieter-Jan Briers
7919be26f1 Fix crash on Godot as a result of bff03cd2b8 2019-03-08 14:17:58 +01:00
Pieter-Jan Briers
82d1a24f78 Entity Spawn Window now takes name into consideration for search. 2019-03-08 13:59:19 +01:00
Pieter-Jan Briers
bff03cd2b8 Placement drawing moved to overlay; works in Clyde.
Fixes #597
2019-03-08 10:23:08 +01:00
Pieter-Jan Briers
cf32f0874d Clyde improvements.
Fix some render state leaking across drawing handles.
Draw world space overlays.
2019-03-08 10:21:37 +01:00
Pieter-Jan Briers
24b6240f3b Clip culling for controls.
This significantly speeds up rendering of things like
the entity spawn panel.
2019-03-08 09:26:05 +01:00
Pieter-Jan Briers
12896f306c Fix VSync button not starting in the right color. 2019-03-08 09:06:25 +01:00
Pieter-Jan Briers
40a037a97a Fix initial LineEdit placeholder being the wrong color. 2019-03-08 08:57:46 +01:00
Pieter-Jan Briers
b533968531 Fix bad layout in tscn files for spawn panels. 2019-03-06 16:06:52 +01:00
Pieter-Jan Briers
88572c5bae Change base types of spawn panel items to PanelContainer.
To match the types in the tscn files.
2019-03-06 16:06:38 +01:00
Pieter-Jan Briers
8b23a80357 Improve the GUI dump command. 2019-03-06 16:06:06 +01:00
Pieter-Jan Briers
06675cd956 Load rect_clip_content and rect_min_size from tscn. 2019-03-06 16:05:53 +01:00
Pieter-Jan Briers
20e5fe9b4d Fix Godot 3.0 compatibility. 2019-03-05 21:56:47 +01:00
Pieter-Jan Briers
19a7e21d47 Fix inconsistent FPS on Clyde.
Fixes #729

This was simple. Client was defaulting to 50 FPS while the server was defaulting to 60.

Jeez.
2019-03-05 18:04:51 +01:00
Pieter-Jan Briers
2ff15f7fb0 Improve ridiculous VV window sizes. 2019-03-05 09:37:34 +01:00
Pieter-Jan Briers
2848d40d5d Implement Button.ClipText. 2019-03-05 09:35:18 +01:00
Pieter-Jan Briers
f8359a38e0 Change default filter mode for containers.
This fixes VV's "click to expand" functionality on the property controls
2019-03-05 09:21:35 +01:00
Pieter-Jan Briers
975439c388 VV debug command addition.
Now has a Vector2 field. I needed this to check something.
2019-03-05 09:03:51 +01:00
Pieter-Jan Briers
94e744b751 Unit test BoxContainer. 2019-03-05 09:03:27 +01:00
Pieter-Jan Briers
5c57ce1118 Fix BoxContainer with multiple expanding children. 2019-03-05 09:03:13 +01:00
Pieter-Jan Briers
c751bff500 Use the power of operator overloading to implicit cast tuples to Vector2 2019-03-05 09:02:47 +01:00
Pieter-Jan Briers
df2e2af7f2 Default vertical size flags for label correctly. 2019-03-04 17:59:58 +01:00
Pieter-Jan Briers
ba59e71b7a Control input clipping. 2019-03-04 17:40:12 +01:00
Pieter-Jan Briers
274dfb769d Increase ScrollContainer scrolling speed.
Really this shouldn't be hardcoded but oh well.
2019-03-04 15:45:09 +01:00
Pieter-Jan Briers
12a61918ab Add GUI dump command. 2019-03-04 15:41:41 +01:00
Pieter-Jan Briers
28e60109f0 Code Cleanup of Console/Commands/Debug.cs 2019-03-04 15:40:50 +01:00
Pieter-Jan Briers
e24f55476e VV can now VV VV. 2019-03-04 15:38:46 +01:00
Pieter-Jan Briers
8c5a2dedb9 Oh yeah maybe commit this. 2019-03-04 15:36:23 +01:00
Pieter-Jan Briers
07880f4352 Give VV windows a control name to ease debugging. 2019-03-04 15:36:07 +01:00
Pieter-Jan Briers
4b104c01a1 Fix StyleBoxFlat margins being a mess. 2019-03-04 15:35:37 +01:00
Pieter-Jan Briers
278e1299b8 Slap [ViewVariables] on Control. 2019-03-04 15:35:17 +01:00
Pieter-Jan Briers
46e1b10269 Fix Control.SetMarginPreset with right and bottom anchors. 2019-03-04 15:34:40 +01:00
Pieter-Jan Briers
9f24bf2602 Remove bad AutoLoad from project.godot. 2019-03-04 13:48:54 +01:00
Pieter-Jan Briers
15350e7969 Merge branch 'master' of github.com:space-wizards/space-station-14 2019-03-04 12:48:15 +01:00
Pieter-Jan Briers
88b6a7f4da DebugConsole history is less broken and saved to disk. 2019-03-04 12:47:39 +01:00
Pieter-Jan Briers
4a8fdf744e Fix all the ScrollContainer crashes.
Probably.
2019-03-04 12:47:20 +01:00
Pieter-Jan Briers
37f51a9dd1 Implement LineEdit.Editable, improve LineEdit styling. 2019-03-04 12:47:01 +01:00
Pieter-Jan Briers
9352ccf82d LineEdit improvements:
Added IgnoreNext bool to prevent keys that focus it getting entered.
Made OnTextChanged not fire when setting Text.
2019-03-04 11:27:34 +01:00
Nirnael
200bc572bf Fix viewport size on window creation for OS-imposed sizes (#743)
Adds a call to viewport on opengl init in order to properly initialize the viewport size when the OS imposes a window size on window creation. Fixes Windows OS tablet mode-imposed window sizes.

That System diff is a bug.
2019-03-01 21:04:19 +01:00
Pieter-Jan Briers
de5f3d8870 Mostly functional ScrollContainer. 2019-03-01 16:28:17 +01:00
Pieter-Jan Briers
5505ee91f0 Help the entire UI system is spaghetti and we need to fix this. 2019-03-01 16:27:58 +01:00
Pieter-Jan Briers
7340e1212c Once again remove 3.1 project.godot 2019-02-27 13:53:01 +01:00
Pieter-Jan Briers
2ec0ae41fe Add safety check to ScrollBar.IsAtEnd. 2019-02-26 17:04:58 +01:00
Pieter-Jan Briers
9e718a01d8 OutputPanel uses ScrollBars 2019-02-26 17:04:37 +01:00
Pieter-Jan Briers
45efe4f29f Implement scroll bars. 2019-02-26 15:39:57 +01:00
Pieter-Jan Briers
acd0299f1e Avoid redundant pseudo class restyles. 2019-02-26 14:31:26 +01:00
Pieter-Jan Briers
11b0c871c3 Fix MouseMove only firing on mouse focus. 2019-02-26 10:49:23 +01:00
Pieter-Jan Briers
3fb791bd0d Do not stop mouse wheel with stop filter mode.
Arguably we should have some kinda event mask for this,
but this is how Godot does it and I'm not gonna engineer a better
solution.
2019-02-26 10:49:07 +01:00
Pieter-Jan Briers
fb4b325f59 TabContainer mostly works, shoddily. 2019-02-25 10:52:30 +01:00
Pieter-Jan Briers
85da2b9a19 Add StyleBox.GetEnvelopBox. 2019-02-25 00:43:48 +01:00
Pieter-Jan Briers
9858004de8 Fix really bad copy paste mistake.
Jeez. X always comes before Y when sorting like that. Style man.
2019-02-25 00:05:08 +01:00
Pieter-Jan Briers
47180ab2d5 Use this newfound clipping power on OutputPanel. 2019-02-24 23:04:42 +01:00
Pieter-Jan Briers
fa8f4b697f Implement Control RectClipContent with Scissor testing. 2019-02-24 22:43:45 +01:00
Pieter-Jan Briers
68a2543020 Adds UIBox2i.Intersection. 2019-02-24 22:33:56 +01:00
Pieter-Jan Briers
76f47e07df Control.OnVisibilityChanged does not fire if value == _visibility. 2019-02-24 21:30:18 +01:00
Pieter-Jan Briers
4e71bd541f Controls get a ChildMoved event. 2019-02-24 21:29:57 +01:00
Pieter-Jan Briers
8747d68ee3 Change default font DPI to 96.
Windows also treats 96 as the default 100% I believe.
2019-02-24 15:54:57 +01:00
Pieter-Jan Briers
0a84fca028 I should learn to be careful with C APIs.
Fixes crashes related to the font system.
2019-02-24 15:53:37 +01:00
Pieter-Jan Briers
66bf5d7c48 Make Chatbox use OutputPanel. 2019-02-24 01:11:39 +01:00
Pieter-Jan Briers
4a7b39bc84 Prevent negative scroll amounts on OutputPanel. 2019-02-24 01:10:31 +01:00
Pieter-Jan Briers
5f3b1414f8 Fix OutputPanel with null panel override on Godot.
Also add StyleBoxEmpty.
2019-02-24 01:05:54 +01:00
Pieter-Jan Briers
0984befcae DebugConsole: remove need for separate PanelContainer. 2019-02-24 00:12:54 +01:00
Pieter-Jan Briers
91854cfd0b OutputPanel gets its own style box to draw. 2019-02-24 00:12:30 +01:00
Pieter-Jan Briers
90c351bb21 Load size flags from tscn. 2019-02-24 00:11:44 +01:00
Pieter-Jan Briers
6bd84abaf4 Rename NetDebugPanel to DebugNetPanel 2019-02-23 23:31:39 +01:00
Pieter-Jan Briers
f753b131e0 Maybe don't forget to commit the PanelContainer implementation. 2019-02-23 23:29:51 +01:00
Pieter-Jan Briers
1d23df6d79 Make DebugConsole scene purely in code. 2019-02-23 23:28:11 +01:00
Pieter-Jan Briers
72788cc263 Fix Control Size setter if minsize < margin-calculated size. 2019-02-23 23:15:09 +01:00
Pieter-Jan Briers
60d0e9c62b Debug Monitors don't update text while hidden. 2019-02-23 23:08:19 +01:00
Pieter-Jan Briers
1fd2cfa7fd Containers re-sort on resize. 2019-02-23 23:07:54 +01:00
Pieter-Jan Briers
e463718917 Fix bad copy paste bug in Container.FitChildInBox. 2019-02-23 23:07:43 +01:00
Pieter-Jan Briers
5890e08bb3 Add Control.VisibleInTree 2019-02-23 23:06:59 +01:00
Pieter-Jan Briers
a1840b9732 Control Size related convenience helpers. 2019-02-23 20:03:51 +01:00
Pieter-Jan Briers
43430b458c Prevent infinite Control parent chain recursion. 2019-02-23 19:57:56 +01:00
Pieter-Jan Briers
c99622c2f8 Improve OutputPanel scroll speed. 2019-02-23 16:55:54 +01:00
Pieter-Jan Briers
2462caf25a Improve LineEdit styling and rendering. 2019-02-23 16:35:09 +01:00
Pieter-Jan Briers
bbef6657c1 More Clyde optimizations.
Just less data copying, better data copying, reduced pooling usage.
2019-02-22 14:22:17 +01:00
Pieter-Jan Briers
096ac8624e Improve FPS significantly...
By raising the command pool capacity.
2019-02-21 22:47:04 +01:00
Pieter-Jan Briers
f9753e80ac Fix various compiler warnings. 2019-02-21 22:01:13 +01:00
Pieter-Jan Briers
b3e3066c53 More premature optimizations. 2019-02-21 18:13:03 +01:00
Pieter-Jan Briers
99cd2adfc7 Clyde rendering optimizations. 2019-02-21 17:04:18 +01:00
Pieter-Jan Briers
052125e62a Fix clear not resetting enough state on OutputPanel. 2019-02-21 17:04:07 +01:00
Pieter-Jan Briers
8f61b898b7 Improve StyleBoxTexture API.
SetMargin has been deprecated in favor of the more clear SetPatchMargin.
Added SetExpandMargin.
2019-02-21 13:49:35 +01:00
Pieter-Jan Briers
eed8b670d1 Implement Control order control. 2019-02-21 13:33:09 +01:00
Pieter-Jan Briers
2e608e2e52 Implement OutputPanel with RichTextLabel in Godot. 2019-02-21 12:10:16 +01:00
Pieter-Jan Briers
6f5d16b55a Make RichTextLabel internal & fix some bugs.
It's never going to be re-implemented on Clyde,
so I'm making it internal so content doesn't try to touch it.

Also fixed ScrollFollowing not being set.

So uh... Godot. Mind explaining why call()ing a nonexistant function
is completely silent?
2019-02-21 12:09:41 +01:00
Pieter-Jan Briers
13b5b365e3 Implement Control.SetAnchorAndMarginPreset 2019-02-21 11:40:19 +01:00
Pieter-Jan Briers
96a622f94f OutputPanel as a simpler alternative to RichTextLabel.
Godot's RichTextLabel is extremely complicated to re-implement.
OutputPanel is a stripped down version that's significantly simpler.
It does what it needs to for the purposes we use RichTextLabel.
2019-02-21 02:11:27 +01:00
Pieter-Jan Briers
016fbc1e70 Clean up FormattedMessage a bit. 2019-02-21 02:07:34 +01:00
Pieter-Jan Briers
7bba1b52eb Controls now fire Resized correctly. 2019-02-21 02:04:05 +01:00
Pieter-Jan Briers
7ef499c1da Implement MouseWheel input. 2019-02-21 02:03:25 +01:00
Pieter-Jan Briers
0b0a5d4887 Add LineSeparation to Font. 2019-02-21 02:02:22 +01:00
Pieter-Jan Briers
8fe579a104 Fix bad doc comment in ShallowClone. 2019-02-20 14:50:43 +01:00
Pieter-Jan Briers
2c8a76a8ea Improve LineEdit mouse -> cursor position. 2019-02-19 19:56:37 +01:00
Pieter-Jan Briers
2e774c5b68 Rough but functional LineEdit. 2019-02-19 16:28:13 +01:00
Pieter-Jan Briers
acfb56dca2 Add StyleBox.GetContentOffset 2019-02-19 16:28:00 +01:00
Pieter-Jan Briers
8bd30ce72e Add UTF-16 surrogate check to OpenTK's KeyPress.
I'm not sure if this can happen but if it does I'd rather blow up and have to figure out why there's random surrogates all over the place.
2019-02-19 16:27:38 +01:00
Pieter-Jan Briers
b517481014 Make BoxContainer ignore visible controls.
While this behavior is debatable, I'm mimicking Godot's behavior here.
2019-02-19 15:02:58 +01:00
Pieter-Jan Briers
c8f8fbf964 KeyUp/KeyDown now handled by UI 2019-02-19 14:45:26 +01:00
Pieter-Jan Briers
79806c397c Use KHRDebug debug groups in rendering. 2019-02-19 13:25:50 +01:00
Pieter-Jan Briers
31d0bec93e Font metrics improvements.
Adds more data to CharMetrics.

TryGetCharMetrics.
2019-02-19 12:44:38 +01:00
Pieter-Jan Briers
c8b793a8fb Do not shy away from repeated key down events. 2019-02-19 12:44:06 +01:00
Pieter-Jan Briers
1c46a156c4 Automatic keyboard focus grabbing. 2019-02-19 09:19:07 +01:00
Pieter-Jan Briers
e3ff9bf4a7 Implement TextEntered event. 2019-02-19 00:08:10 +01:00
Pieter-Jan Briers
5af16c2ef4 Some refactorings related to implementing GUI keyboard input. 2019-02-18 23:28:31 +01:00
Pieter-Jan Briers
7462aeb8f3 Fix EntitySpawnWindow crash. 2019-02-18 23:27:41 +01:00
Pieter-Jan Briers
d838f568af Do not propagate mouse events to InputManager if intercepted by GUI 2019-02-18 11:21:12 +01:00
Pieter-Jan Briers
73a1f2ec61 Implement BoxContainer separation via CSS. 2019-02-18 09:03:24 +01:00
Pieter-Jan Briers
793ae245ac Skip nonexistant glyphs in font atlas generation. 2019-02-18 01:15:28 +01:00
Pieter-Jan Briers
e44c4275e7 Make element selectors use Type instead of type names. 2019-02-18 00:43:00 +01:00
Pieter-Jan Briers
af1137418a Implement Button font color. 2019-02-18 00:14:04 +01:00
Pieter-Jan Briers
052feee756 Remove DummyUserInterfaceManager.
It was a relic of Godot. UserInterfaceManager now runs under unit tests.
2019-02-17 23:52:07 +01:00
Pieter-Jan Briers
a73e966175 Unit test UserInterfaceManager. 2019-02-17 23:51:02 +01:00
Pieter-Jan Briers
40f635483b Fix incorrect relative positioning on mouse events. 2019-02-17 23:50:33 +01:00
Pieter-Jan Briers
a30de7659f Make mouse input do propagation correctly. 2019-02-17 19:10:53 +01:00
Pieter-Jan Briers
b202cc196d Fix edge cases with child selector by making Control.Restyle sorta recursive but not really. 2019-02-16 01:06:09 +01:00
Pieter-Jan Briers
386fc519e3 Fix some size bugs with Button styling. 2019-02-16 01:04:38 +01:00
Pieter-Jan Briers
8730d6a867 Make Button styling possible. 2019-02-16 00:56:49 +01:00
Pieter-Jan Briers
97fc8d6392 Implement GetDefaultContentMargin for StyleBoxTexture. 2019-02-16 00:56:34 +01:00
Pieter-Jan Briers
e0beaf638f Style classes for SS14Window elements. 2019-02-15 14:04:36 +01:00
Pieter-Jan Briers
9d3f501240 TextureButton CSS support. 2019-02-15 14:03:37 +01:00
Pieter-Jan Briers
4804b2de2c Add ExpandMargin to StyleBoxTexture. 2019-02-15 13:55:25 +01:00
Pieter-Jan Briers
00d7717c82 Panel style can be specified via CSS. 2019-02-15 13:55:05 +01:00
Pieter-Jan Briers
0a2a1420b1 Control ModulateSelf, Pseudo classes. 2019-02-15 13:54:53 +01:00
Pieter-Jan Briers
5612e589e0 Adds persistent modulate to DrawingHandle. 2019-02-15 13:48:07 +01:00
Pieter-Jan Briers
b5a3ef0ffb Adds multiply operator to Color. 2019-02-15 13:45:44 +01:00
Pieter-Jan Briers
a31f9223e7 Fix bad handling of font height. 2019-02-15 00:55:46 +01:00
Pieter-Jan Briers
d6625f9c6a Implement CSS-like stylesheets into GUI.
Label now reads properties from the CSS system.
2019-02-14 23:24:35 +01:00
Pieter-Jan Briers
0f935fc925 Stop log spam from OpenGL performance debug info. 2019-02-14 22:32:52 +01:00
Pieter-Jan Briers
19e767031d Fix edge case with texture param loading.
And unit test it. Gotta get that coverage.
2019-02-14 17:15:03 +01:00
Pieter-Jan Briers
7e22d724fe Texture load parameter system.
Basically now you can control whether a texture has filtering or wrapping enabled or whatever. Neat huh.
2019-02-14 16:49:15 +01:00
Pieter-Jan Briers
b5d9c54893 Clean up ResourcePath.
Also fix some issues pointed out by Sonar and Rider.
2019-02-14 15:12:07 +01:00
Pieter-Jan Briers
525cee8058 Add ResourcePath.WithName() 2019-02-14 15:04:18 +01:00
Pieter-Jan Briers
5b278e54e1 Control Position and Size set tests 2019-02-13 12:29:07 +01:00
Pieter-Jan Briers
3ccb1a4f2b Control layout related unit tests 2019-02-13 12:06:52 +01:00
Pieter-Jan Briers
63988e6554 I forgot to commit UnitTesting 2019-02-13 11:03:24 +01:00
Pieter-Jan Briers
ffda71dae2 Fix window dragging.
It was using Godot.OS which doesn't work on Clyde.
2019-02-13 00:28:26 +01:00
Pieter-Jan Briers
0b4173def9 Implement MouseMove events for GUI. 2019-02-13 00:23:31 +01:00
Pieter-Jan Briers
02d4e4cf10 Implement Control.GlobalMousePosition 2019-02-13 00:22:49 +01:00
Pieter-Jan Briers
e88daac8b7 Add Control.GlobalPosition 2019-02-13 00:22:28 +01:00
Pieter-Jan Briers
4fae142722 Fix bad Control.Position setter. 2019-02-13 00:21:52 +01:00
Pieter-Jan Briers
7aeb868f38 Implement TextureRect. 2019-02-12 22:59:38 +01:00
Pieter-Jan Briers
f829896da5 Implement hover textures in TextureButton. 2019-02-12 19:35:08 +01:00
Pieter-Jan Briers
f40a65a0f2 Fix center-aligned Label rendering, implement font color override rendering in Label. 2019-02-12 19:34:52 +01:00
Pieter-Jan Briers
4ce9da7af6 WiP CSS-like style sheets. 2019-02-12 00:29:28 +01:00
Pieter-Jan Briers
9c7adb7248 Make LineEdit be drawn at the very least. 2019-02-11 15:13:38 +01:00
Pieter-Jan Briers
f6d8c5506b Fix sonar fraction loss complaints. 2019-02-11 14:16:26 +01:00
Pieter-Jan Briers
3c3396c461 Fix bad conditions in Container.FitChildInBox.
Thanks Sonar.
2019-02-11 14:14:42 +01:00
Pieter-Jan Briers
a4d567a3ec Make DebugCoordsPanel suck less. 2019-02-11 14:12:49 +01:00
Pieter-Jan Briers
efc47ee3f5 Vector2i ToString. 2019-02-11 14:11:11 +01:00
Pieter-Jan Briers
0eb702d68d Make hovered control accessible on UserInterfaceManager. 2019-02-11 12:53:50 +01:00
Pieter-Jan Briers
2a9769ff4f Implement mouse entered/exited.
And use it to implement button hovering.
2019-02-11 12:50:21 +01:00
Pieter-Jan Briers
e7b5e2a9bb Implement TextureButton roughly. 2019-02-11 12:37:19 +01:00
Pieter-Jan Briers
e1d064158c Fix TextureRect tscn loading. 2019-02-11 12:37:04 +01:00
Pieter-Jan Briers
b8c6100ab7 Prevent crash when sneezing. 2019-02-11 11:53:17 +01:00
Pieter-Jan Briers
c7fe2bb876 Mostly implement Label VAlign. 2019-02-11 11:52:45 +01:00
Pieter-Jan Briers
0c9d6f0f91 Make Options menu work. 2019-02-11 11:40:47 +01:00
Pieter-Jan Briers
605b541010 Improve button press handling. 2019-02-11 11:29:27 +01:00
Pieter-Jan Briers
f7147464c6 Button input sorta works 2019-02-11 10:16:33 +01:00
Pieter-Jan Briers
eedeb5214b Invalidate batch buffers to make life easier on Mesa 2019-02-11 09:45:04 +01:00
Pieter-Jan Briers
f40d94f39f You saw nothing 2019-02-11 09:02:44 +01:00
Pieter-Jan Briers
c70df3f504 Make Control input virtuals protected internal 2019-02-11 09:01:20 +01:00
Pieter-Jan Briers
8fa3f25f98 Fix BoxContainer layout. 2019-02-10 23:21:15 +01:00
Pieter-Jan Briers
2c0589166a Give Control a ToString to ease debugging. 2019-02-10 22:42:54 +01:00
Pieter-Jan Briers
1f28850477 Give TextureRect a minimum size so it draws something. 2019-02-10 22:41:18 +01:00
Pieter-Jan Briers
484fa31b23 Load button align from tscn. 2019-02-10 22:26:07 +01:00
Pieter-Jan Briers
60518cdc3a Handle Control size flags in containers. 2019-02-10 22:26:00 +01:00
Pieter-Jan Briers
84e6ad230b Fix unit tests. 2019-02-10 00:00:34 +01:00
Pieter-Jan Briers
985a9a798e Some work towards GUI input.
Implemented a basic screen coord -> control lookup method.
2019-02-09 23:51:20 +01:00
Pieter-Jan Briers
8f6fc42207 Implement buttons and texture rect somewhat. 2019-02-09 13:51:38 +01:00
Pieter-Jan Briers
773ad46165 Don't modify margins to fit minimum size. 2019-02-09 13:51:17 +01:00
Pieter-Jan Briers
f26b109126 Implement Label Align sorta jankily. 2019-02-08 17:38:35 +01:00
Pieter-Jan Briers
08c2737d58 Load label text from Godot assets. 2019-02-08 15:51:08 +01:00
Pieter-Jan Briers
e6191dd823 Systems for loading sub resources like StyleBoxes from Godot resources. 2019-02-08 15:45:00 +01:00
Pieter-Jan Briers
ccca5b69ea Implement more of StyleBox
Texture style boxes now render and there's a bunch of properties like ContentMargin that Godot has but we didn't.
2019-02-08 14:04:28 +01:00
Pieter-Jan Briers
673c2705ac Basic UI theming system.
Not great but it gets the job done.
2019-02-08 14:03:35 +01:00
Pieter-Jan Briers
86175c7b6f Implement Control.SetMarginsPreset 2019-02-08 14:02:07 +01:00
Pieter-Jan Briers
deb86273fe Fix grid rendering being offset. 2019-02-08 14:01:26 +01:00
Pieter-Jan Briers
a54382f9b7 Box2 variants get a ToString(). 2019-02-08 14:00:29 +01:00
Pieter-Jan Briers
86da0fc88d Round control positions before rendering.
This is to fix rounding errors.

Ideally the GUI system should just straight up use integral pixel coordinates but oh well.
2019-02-08 14:00:13 +01:00
Pieter-Jan Briers
d92cb2603c Change type of SS14Window to fix drawing of it. 2019-02-08 13:59:07 +01:00
Pieter-Jan Briers
a583de32bc Fix order issues with Control property application. 2019-02-06 12:50:53 +01:00
Pieter-Jan Briers
d21863abb9 Remove unused field in FixedEye 2019-02-06 12:23:26 +01:00
Pieter-Jan Briers
55efca6b7d _doUpdateLayout works without parent. 2019-02-06 12:19:03 +01:00
Pieter-Jan Briers
411495ce95 Apply some GUI properties from loaded scene files. 2019-02-06 12:13:59 +01:00
Pieter-Jan Briers
307c94b399 Make GUI layout updates propagate even for parentless controls. 2019-02-06 12:13:45 +01:00
Pieter-Jan Briers
f79e733b1e Resize UIRoot when window size changes. 2019-02-06 12:12:52 +01:00
Pieter-Jan Briers
5b3511b951 Parse properties from Godot scene files. 2019-02-06 12:12:39 +01:00
Pieter-Jan Briers
38cab68f89 Fix Control.SetAnchorsPreset being incorrect. 2019-02-06 12:11:57 +01:00
Pieter-Jan Briers
cdbf95bbc8 Implement a default font 2019-02-06 00:00:13 +01:00
Pieter-Jan Briers
0b76613f38 Fix grid rendering being offset 2019-02-05 23:48:13 +01:00
Pieter-Jan Briers
9fd3fdf21a Re-implement godot naming conflict avoidance in GUI to avoid crashes 2019-02-05 23:35:00 +01:00
Pieter-Jan Briers
10cc81ca5a Fix mouse position fetching 2019-02-05 23:24:56 +01:00
Pieter-Jan Briers
5072873ea1 Fix glyph metric race conditions 2019-02-05 23:10:52 +01:00
Pieter-Jan Briers
10470c65ef Make Label work 2019-02-05 22:36:59 +01:00
Pieter-Jan Briers
b541a3c40a Add fontdpi to config file 2019-02-05 21:10:45 +01:00
Pieter-Jan Briers
c99807e9c9 Fix handling of space glyph advance 2019-02-05 21:10:08 +01:00
Pieter-Jan Briers
93277e2333 More font work 2019-02-05 21:00:38 +01:00
Pieter-Jan Briers
e87ee17ada Adventures into font rendering 2019-02-05 20:02:06 +01:00
Pieter-Jan Briers
79c7b0164d Change z of final meshes to improve mesh view in RenderDoc 2019-02-05 20:01:28 +01:00
Pieter-Jan Briers
006342e4d8 Fix subregion batching in screen space. 2019-02-05 19:13:14 +01:00
Pieter-Jan Briers
4efca634b2 Allow loading of Image<Alpha8> images. 2019-02-05 16:21:34 +01:00
Pieter-Jan Briers
3c587eec49 Add Vector2i.ComponentMin/Max methods. 2019-02-05 16:20:40 +01:00
Pieter-Jan Briers
c170345b7f Implement BoxContainer layout 2019-02-04 21:09:07 +01:00
Pieter-Jan Briers
5dda42868c Fix GUI under Godot 2019-02-04 16:33:40 +01:00
Pieter-Jan Briers
c8a949d115 Implement basic GUI layout. 2019-02-04 16:27:07 +01:00
Pieter-Jan Briers
32f4e8c410 Preparations for GUI rendering 2019-02-03 19:54:19 +01:00
Pieter-Jan Briers
8d8dc9f3ce Texture Array based batching 2019-02-03 17:40:30 +01:00
Pieter-Jan Briers
d2b230c6a4 Use an UBO for projview matrices 2019-02-02 01:50:23 +01:00
Pieter-Jan Briers
2f93d8855e Use ShaderProgram 2019-02-01 00:40:41 +01:00
Pieter-Jan Briers
0ac9b94099 Use new Buffer wrapper API 2019-01-31 21:27:30 +01:00
Pieter-Jan Briers
ecd88b3752 Rewrite Buffer API already 2019-01-31 20:16:01 +01:00
Pieter-Jan Briers
48069ad519 Utility classes to wrap OpenGL objects. 2019-01-31 18:20:46 +01:00
Pieter-Jan Briers
6df91d5b19 Fix listed GLSL versions to 410. 2019-01-29 00:32:25 +01:00
Pieter-Jan Briers
6b5cbc5494 Rename DisplayManagerOpenGL to Clyde.
And give it its own namespace.
2019-01-29 00:30:58 +01:00
Pieter-Jan Briers
165538c265 Add ability to load ArrayTextures
Drawing does not work yet.
2019-01-29 00:23:01 +01:00
Pieter-Jan Briers
705a3dbfcc Move frame update to gameloop update 2019-01-28 16:37:20 +01:00
Pieter-Jan Briers
ff16ee1472 Mouse input implemented but it doesn't seem to work 2019-01-28 16:29:51 +01:00
Pieter-Jan Briers
1943cfd1b4 Implement texture rect drawing to simplify code 2019-01-28 15:25:02 +01:00
Pieter-Jan Briers
093a68dbc4 Fix crash on shutdown 2019-01-28 13:52:14 +01:00
Pieter-Jan Briers
0683202ce4 Actually bind VAO instead of relying on luck 2019-01-27 12:12:45 +01:00
Pieter-Jan Briers
23305e53a7 Actually implement batch positions 2019-01-27 11:59:20 +01:00
Pieter-Jan Briers
5c05ef98de Bikeshed painted 2019-01-27 01:24:36 +01:00
Pieter-Jan Briers
563dcc804e Switch to struct handles to avoid mixing things up 2019-01-27 01:12:36 +01:00
Pieter-Jan Briers
a55ef4268f Fixed texture mixup 2019-01-27 00:27:30 +01:00
Pieter-Jan Briers
0269a74bc7 Work in progress OpenGL batching 2019-01-26 23:39:48 +01:00
Pieter-Jan Briers
250d80eb8b Code cleanup in preparation of batching 2019-01-26 19:06:33 +01:00
Pieter-Jan Briers
b460404b7f Load textures with ImageSharp 2019-01-26 14:47:06 +01:00
Pieter-Jan Briers
88b8705b7b OpenGL 4.1 and maybe even 3.x support. 2019-01-26 14:07:29 +01:00
Pieter-Jan Briers
76280f46f9 Rename GameController.Headless to Standalone
This better fits the actual function of it now.
2019-01-26 00:07:16 +01:00
Pieter-Jan Briers
5eabe39fc4 Preparations for UI rendering 2019-01-26 00:06:25 +01:00
Pieter-Jan Briers
3de36d7a38 Implement sprite draw depth in OpenGL 2019-01-25 17:11:59 +01:00
Pieter-Jan Briers
492d0b14d0 Fix splash screen and screen space texture flipping 2019-01-25 16:38:18 +01:00
Pieter-Jan Briers
6a08536f7c Fix GraphicsContextFlags in Debug 2019-01-25 15:27:49 +01:00
Pieter-Jan Briers
361fdbe684 OpenGL 4.5 rendering backend (#728)
This is a really crappy OpenGL 4.5 rendering backend. Doesn't draw a lot of things but it's a hell of a lot better than Godot in the stability department. Mostly.

It's far from production ready but I already wrote all this. There's some minor API improvements in here too.
2019-01-25 14:57:11 +01:00
Pieter-Jan Briers
67c962b612 Add .directory to gitignore 2019-01-23 15:27:12 +01:00
Pieter-Jan Briers
dbc88e253b Allow client to run headlessly. (#727)
AKA Without Godot.

Still links against GodotSharp, but this does mean that you can run headless or not from the same binary.
2019-01-19 18:23:41 +01:00
Pieter-Jan Briers
58fb11a989 Refactor map netcode. (#726)
Maps are now synchronized as part of game states.
This instantly fixed all race conditions and the client can now live through a round restart with 0 problems (outside of Godot crashing yay).
2019-01-19 00:39:55 +01:00
Pieter-Jan Briers
8d58ad304a Fix collidable already registered spam 2019-01-18 12:04:43 +01:00
Pieter-Jan Briers
6d9a1a4e43 Refactor Transforms. (#725)
See commits.
2019-01-18 11:35:57 +01:00
Pieter-Jan Briers
6873ad70f4 Fix incorrect control disposal order 2019-01-17 20:52:10 +01:00
Pieter-Jan Briers
21ddbc1433 Modernize texture loading to use load_png_from_buffer 2019-01-17 20:51:21 +01:00
Pieter-Jan Briers
68a9b3e6ce Remove some debug logging. 2019-01-17 18:27:25 +01:00
Pieter-Jan Briers
6ee26df088 Remove hack now that godot #21667 is fixed 2019-01-17 18:24:27 +01:00
Pieter-Jan Briers
aa36a9e378 Make the code work on Godot 3.1 Alpha 4. (#724) 2019-01-17 18:11:16 +01:00
Acruid
a500a42d6f Instanced IoCManager (#723)
I took the functionality of `IoCManager` and moved it into a non-static class. This new class is called `DependencyCollection`. The static `IoCManager` is now just a proxy to a `DependencyCollection` singleton. I also added the ability to directly register instances into the collection. The Smocks library was added to `SS14.UnitTesting`.

This is super useful for unit testing, because now you can register mock instances directly into the collection and then other services can resolve them. You can also apply a shim to static `IoCManager` calls and handle them properly. Because the collection is instanced, we can now run tests in parallel (with a shim) that modify `IoCManager`. The Smocks library gives us the ability to shim static method calls.
2018-12-31 11:01:05 +01:00
Pieter-Jan Briers
d8ee7249e9 Fix Travis (#722)
Dear god.

Fuck Python.
2018-12-21 12:50:11 +01:00
Pieter-Jan Briers
a330deb249 Step 1 in fixing Travis 2018-12-21 00:49:31 +01:00
digitalis
8813d90bcb Convert PushInheritance to iteration in EntityPrototype (#718)
fixes the "TODO: remove recursion somehow" comment
2018-12-13 20:04:00 +01:00
Acruid
3cd7690c58 Unparent transform fix. (#719)
* Fixed bug where godot node is not being sync'd with SS14 transform when unparenting.

* CanInsert does not throw an exception when creating a loop.
2018-12-13 14:48:16 +01:00
Pieter-Jan Briers
4d9a243685 Keep track of child entities of transforms. 2018-12-02 13:58:33 +01:00
Pieter-Jan Briers
c76f791799 Leak shaders to work around Godot issue #24108 2018-12-01 23:41:25 +01:00
Pieter-Jan Briers
921a9de1fa Random normal distribution helper 2018-12-01 16:53:28 +01:00
Pieter-Jan Briers
468accfb08 Remove audio load debug message 2018-12-01 15:18:21 +01:00
Pieter-Jan Briers
028b8cabb9 Client-side command history 2018-11-30 17:25:54 +01:00
Pieter-Jan Briers
7c4eeb136f Add below world screen overlay. 2018-11-29 23:48:39 +01:00
Pieter-Jan Briers
6fd5e166b6 Vector deconstruction operators. 2018-11-29 23:20:08 +01:00
Pieter-Jan Briers
e427373f16 Fix Color.Blend 2018-11-29 22:26:56 +01:00
Pieter-Jan Briers
94b8359644 Bypass Mono's bullsit SharpZipLib version. 2018-11-29 22:23:05 +01:00
Pieter-Jan Briers
0fcfe1c2a4 Move to .NET 4.7.1 2018-11-29 22:22:44 +01:00
Pieter-Jan Briers
d478e2fdbb Add color dst/src factor blend helper. 2018-11-29 21:36:54 +01:00
Pieter-Jan Briers
d0e8ed10b8 Mark GodotConversions as internal. 2018-11-29 21:36:15 +01:00
Pieter-Jan Briers
4a5e330be5 Add ImageSharp for texture generation. 2018-11-29 21:36:02 +01:00
Pieter-Jan Briers
a57d9910f1 Add component-wise Vector3 multiply. 2018-11-29 21:35:16 +01:00
Pieter-Jan Briers
6ea25f95df Clean up bloat in WritableDirProvider.cs 2018-11-29 21:34:43 +01:00
Pieter-Jan Briers
6dc2b4ca0e Pull content assemblies directly from their bin folder. 2018-11-29 21:34:20 +01:00
Pieter-Jan Briers
7aa2acf652 Fix broken log calls in AssemblyLoader. 2018-11-29 21:33:56 +01:00
Pieter-Jan Briers
c3b857343f Throw if prototypes get accessed before first load.
Fixes #716
2018-11-29 13:44:50 +01:00
Pieter-Jan Briers
4f48774a26 Rust-based noise generation API. (#715)
Supports tileable 2D, 2D, 3D & 4D Ridged & FBM noise.

I still need to generate native versions for all the platforms, so we can't merge this yet.
2018-11-29 10:43:59 +01:00
Pieter-Jan Briers
50d6097c51 I could've sworn I pushed this. 2018-11-29 09:02:03 +01:00
Pieter-Jan Briers
535905d993 Thread safety on the client too. 2018-11-28 22:49:55 +01:00
Pieter-Jan Briers
e3f702781f Logging improvements.
1. Logging is now thread safe.
2. Slight optimizations.
2018-11-28 22:31:09 +01:00
Pieter-Jan Briers
04396b4397 Replace all occurences of GetComponent<ITransformComponent>() 2018-11-28 21:24:18 +01:00
Pieter-Jan Briers
bfba5c4f94 Minor LINQ-removing optimizations. 2018-11-28 21:16:22 +01:00
Pieter-Jan Briers
2c41750dad Fix incorrect entity message queuing.
The entity manager is supposed to delay entity messages of which the entity doesn't exist (presumably because it *might* due to networking).

Problem is that somebody put a .Clear() at the end right after re-filling the queue.

Wasn't me.
2018-11-28 20:43:57 +01:00
Pieter-Jan Briers
f1fd386614 Remove a bunch of unused local variables. 2018-11-28 10:08:30 +01:00
Pieter-Jan Briers
88fa4072f3 Remove old dead code, minor cleanup. 2018-11-28 09:38:44 +01:00
Pieter-Jan Briers
8397c955a8 Map Pausing. (#710)
You can now "pause" a map. Ideally this would result in the map not doing significant processing until unpaused.

This can be used later to code proper map editor modes that won't have any side effects while being edited.
2018-11-27 00:32:45 +01:00
Pieter-Jan Briers
1e00b864b4 Automatically log in people connecting from localhost. (#711)
This can be disabled with a config value, which should be done for production servers, but for local testing this is very convenient.
2018-11-27 00:32:28 +01:00
Pieter-Jan Briers
e0f8c10978 Add documentation on status server. 2018-11-26 15:12:04 +01:00
Pieter-Jan Briers
21fd3e5d96 Server status framework. (#709)
Adds a HTTP server to the server that exposes `/status` to fetch the server status.
2018-11-26 09:58:58 +01:00
Pieter-Jan Briers
baff29362a Allow VVing IoC services. 2018-11-25 16:38:40 +01:00
Pieter-Jan Briers
861aabbe9b Fix client run level not resetting to Initialize on disconnect. 2018-11-25 14:09:25 +01:00
Pieter-Jan Briers
8baf7e46a4 Fix exception on client close. 2018-11-25 13:11:25 +01:00
Pieter-Jan Briers
ba072c2abd GameScreen is no longer in charge of the chat box. 2018-11-25 12:51:10 +01:00
Pieter-Jan Briers
a00e20b91c Fix client not correctly detaching from entities.
It would only detach if it had a new entity to attach to, not if the new entity is null.
2018-11-24 19:10:26 +01:00
Pieter-Jan Briers
812a9066e5 Chatbox UI improvements.
Now uses proper containers.
2018-11-24 19:08:49 +01:00
Pieter-Jan Briers
10b2073f21 IPlayerManager.GetAllPlayerData()
This is to be able to catch player data on players that're disconnected at the moment.
2018-11-24 19:07:46 +01:00
Pieter-Jan Briers
73715552e4 PlayerSession.AttachEntity(null) now does not throw. 2018-11-24 19:07:12 +01:00
Pieter-Jan Briers
18133af09f Hide go.sys log spam. 2018-11-23 10:55:25 +01:00
Pieter-Jan Briers
2c05701c8a Remove data like server motd from engine-level handshake. 2018-11-23 10:52:27 +01:00
Pieter-Jan Briers
e3449e454b Remove InLobby client side. (#708)
Same deal as #706, the concept of a lobby should be handled purely content side so it's no longer the engine's problem.
2018-11-22 23:06:50 +01:00
Pieter-Jan Briers
67b766b07e Remove debug code from NetPeer.Internal.cs 2018-11-22 09:12:12 +01:00
Pieter-Jan Briers
5c977b6f07 Make EyeManager resilient to invalid grid IDs 2018-11-22 00:51:47 +01:00
Pieter-Jan Briers
8320339ab0 Fix FinishEntity not doing initializations correctly 2018-11-22 00:18:46 +01:00
Pieter-Jan Briers
fcc405e6b6 Remove ServerRunLevel. (#706)
It's a content-ish feature that should be implemented in content only.
2018-11-21 21:20:51 +01:00
Pieter-Jan Briers
153b57ed56 IPv6 & multi-peer NetManager support. (#705)
1. IPv6 support. Woo!
2. NetManager can now explicitly bind to adresses and work with multiple peers. ~~I thought I needed this for IPv6 because I forgot about IPv4-mapped adresses, but the code's written so let's keep it.~~ OpenBSD doesn't support IPv4-mapped IPv6 addresses so effort not wasted.
2018-11-21 20:57:47 +01:00
Pieter-Jan Briers
1fc18c3538 Add a few extension methods to ease netmessage serialization. 2018-11-21 20:20:13 +01:00
Pieter-Jan Briers
8c093b827e Make NetMessage constructor accessible to content. 2018-11-21 20:19:49 +01:00
Pieter-Jan Briers
91b8312e99 Add Modulate to Control 2018-11-21 10:02:00 +01:00
Acruid
cfda72b771 Fixed bugs with remote closing UI windows on clients. (#702)
Clients are now unsubscribed from entities when they move out of range.
2018-11-20 19:28:08 +01:00
Pieter-Jan Briers
69c0d409c8 Add Nullspace static to GridLocalCoordinates 2018-11-19 21:05:43 +01:00
Pieter-Jan Briers
62aeb8b1e3 Add ScreenCoordinates.AsVector 2018-11-19 09:23:30 +01:00
Pieter-Jan Briers
448042afdd PopupHide hook for Popup 2018-11-14 23:08:44 +01:00
Pieter-Jan Briers
b3515d1b0b Raise entity system network messages to specific clients. 2018-11-12 23:26:46 +01:00
Acruid
872e9cf43f Fix Container Crash (#701)
* Transforms now unparent themselves before being removed.
Fixed crash with removing deleted entities from containers.

* Removed ClickedOnEntityMessage, use the Input System.
2018-10-30 22:07:32 +01:00
Acruid
5ae665c3d2 Collision Groups (#699)
* Removed unused types from Physics system.

* Made CollisionEnabled actually work.
Added Collision group system.
CollidableComponent now registers the collidable in Startup instead of OnAdd.
Fixed BoundingBoxComponent namespace.

* Fixes a bug with adding components remotely.
Adds setters to the new ICollidable properties.

* Fixed unit tests.
2018-10-28 21:51:23 +01:00
Acruid
307030ec8f Client IPlayerSession Interface. (#696)
* Added new IPlayerSession interface to client.
Removed session interfaces out of the lame `Interfaces` namespace.

* Fixed a doc comment.
2018-10-26 00:15:42 +02:00
Acruid
d8ca95db0c No More Physics Buckets (#694)
* Converted everything (I think) to ICollidable.

* Renamed CollisionManager to PhysicsManager.
Removed the bucket system out of the PhysicsManager.
RayCastResults.Distance was changed from PositiveInfinity to 0f when no entity is hit.

* Soft collidables (bullets) work again.
2018-10-26 00:15:24 +02:00
Acruid
a6d2a3497a GetComponentInstances() (#695)
Added a function to get the unique component instances, instead of unique types.

Resolves https://github.com/space-wizards/space-station-14/issues/636.
2018-10-26 00:15:10 +02:00
Acruid
c4c6c67599 Added a Close function to UI windows. (#693) 2018-10-22 20:18:19 +02:00
Acruid
bc99875979 Adds LayerGetState function. (#692) 2018-10-21 22:59:25 +02:00
Pieter-Jan Briers
61185f3bde Make IApproxEquatable have an in type param 2018-10-20 14:43:35 +02:00
PJB3005
96802bdbe0 Fix Travis unit tests hopefully 2018-10-16 09:28:33 +02:00
PJB3005
60e6a56b30 Fix TypeHelpers_Test using Godot instead of SS14.Shared.Maths. 2018-10-16 09:21:12 +02:00
PJB3005
8e5f8d1125 Fix incorrect client GUID in SS14.UnitTesting.csproj 2018-10-16 09:21:12 +02:00
Pieter-Jan Briers
f801511d5c Fix Travis looking for NUnit 3.8 2018-10-14 17:17:19 +02:00
Pieter-Jan Briers
7156e3ee74 Unit test the timer system some. 2018-10-14 17:13:48 +02:00
Pieter-Jan Briers
c28547490c Make IoCManager.Resolve Pure. 2018-10-14 16:52:44 +02:00
Pieter-Jan Briers
6efcfaeaa1 PointerInputCmdHandler gets screen location. 2018-09-30 13:16:31 +02:00
Pieter-Jan Briers
8d119549c7 Make client input system public 2018-09-30 13:15:29 +02:00
Pieter-Jan Briers
504ffd55ab Make Godot-referencing methods on Control internal. 2018-09-23 17:31:42 +02:00
Pieter-Jan Briers
27dd1055f5 Open(UIBox2) for Popup control. 2018-09-23 16:50:25 +02:00
Pieter-Jan Briers
28e4573afe Add a NotNull assertion. 2018-09-23 16:50:05 +02:00
Pieter-Jan Briers
ba3e944f44 Give some more structs readonly.
Also gave ScreenCoordinates ToString and Serializable.
2018-09-23 16:07:45 +02:00
Pieter-Jan Briers
e8ff251b12 Fix SS14Window resizing. 2018-09-21 21:32:28 +02:00
Pieter-Jan Briers
5eee3de527 Serialize container data to map files. 2018-09-21 20:06:55 +02:00
Pieter-Jan Briers
a7800348d7 Components added outside of the prototype are now loaded from map files correctly. 2018-09-21 20:06:39 +02:00
Pieter-Jan Briers
16dc444dbe Fix context passing of nested YamlObjectSerializers. 2018-09-21 20:05:50 +02:00
Pieter-Jan Briers
bf9b0e8aef Worn items are not serialized. 2018-09-21 08:36:34 +02:00
Pieter-Jan Briers
136b470b36 Adds a command to reload cached resources. 2018-09-20 22:19:28 +02:00
Pieter-Jan Briers
833c6ec37d A horrible thing. 2018-09-20 19:33:33 +02:00
PJB3005
a4ebf7d31a Fix eyes throwing an exception when mob is detached and deleted at the same time. 2018-09-20 18:09:51 +02:00
PJB3005
894c52db09 PhysicsComponent safety BB check moved to Initialize.
Where it belongs. OnAdd() runs *while* adding components, not after. Not all components exist yet.
2018-09-20 18:09:24 +02:00
PJB3005
e118888f96 Remove requirement for players to have a bounding box. 2018-09-20 18:08:48 +02:00
PJB3005
5ff85123d5 Move entity/map start/stop to BaseClient.
Previously the GameController was in control of starting the EntityManager, and GameScreen responsible for shutting it and MapManager down.

There was no way to restart the Entity Manager.

This commit makes the start/stopping be handled in the connection procedure of BaseClient.

@Acruid please review.
2018-09-20 14:56:35 +02:00
Pieter-Jan Briers
7ee48c4a7b Fix some missing CultureInfo.InvariantCulture 2018-09-19 18:43:06 +02:00
Pieter-Jan Briers
99ab6fce9c Sprite Layer Map improvements.
Can now be loaded from a prototype.
If loaded from a prototype, it's flyweighted.
2018-09-19 18:36:33 +02:00
Pieter-Jan Briers
bf9315358d Fix bug where per-layer RSIs did not work on prototype load. 2018-09-19 18:35:19 +02:00
Pieter-Jan Briers
4e236be85d Clean up Transform_Test.cs some more. 2018-09-19 13:40:51 +02:00
Pieter-Jan Briers
11394c5fea Fix ParentMapSwitchTest.
Also cleaned it up slightly, but that shouldn't affect the results.
2018-09-19 13:38:57 +02:00
Pieter-Jan Briers
9d1dc0b61e Fix sprite layer direction desyncing on join. 2018-09-18 22:06:55 +02:00
Pieter-Jan Briers
1e06c8181f Remove debug log message from sprite component. 2018-09-18 20:52:37 +02:00
Pieter-Jan Briers
512d99c900 Remove spammy audio system log. 2018-09-18 20:52:05 +02:00
Pieter-Jan Briers
d74a6e41d9 Fix syncing of parented components. 2018-09-18 20:48:04 +02:00
Pieter-Jan Briers
02c844a396 Adds an abstract field to entity prototypes to hide them in the entity spawn panel. 2018-09-18 19:06:18 +02:00
Pieter-Jan Briers
afdfd9ed5c Alphabetically sort entity spawn list. 2018-09-18 18:16:21 +02:00
Pieter-Jan Briers
87f3a1f6e3 Fix stacked layer rendering. 2018-09-18 17:50:48 +02:00
PJB3005
dbe18df32e Use a default shaded texture instead of no shader.
Shouldn't matter in practice, but it does. Godot's 2D renderer is turbo fucked. Yay.
2018-09-18 17:27:32 +02:00
PJB3005
ae408d7674 Fix setting SpriteComponent texture: "" server side. 2018-09-18 17:26:51 +02:00
PJB3005
aa61eb3483 Ensure all entities exist before applying entity states.
If not, an entity state could reference another, not yet instantiated, entity. (transform parenting did this sometimes)
2018-09-18 15:13:35 +02:00
PJB3005
df21d0db14 Fix RSI schema to make flags and selectors optional. 2018-09-18 15:09:10 +02:00
Pieter-Jan Briers
7f12355f34 Add AddBlankLayer() to SpriteComponent 2018-09-18 08:09:23 +02:00
Pieter-Jan Briers
0d9e748cd0 And push the csproj because I'm dumb. 2018-09-17 21:33:20 +02:00
Pieter-Jan Briers
5d1f34a3c9 Remove dead file SpriteComponentState.cs 2018-09-17 21:32:51 +02:00
Pieter-Jan Briers
6bb34e9456 Add a client command line arg to automatically connect.
Pass --connect and you don't even have to hit the connect button anymore.
2018-09-17 21:11:19 +02:00
Pieter-Jan Briers
7f74ae7b61 ldrsc command.
I coded this to test something. No reason to just delete the code forever so I'm committing it.
2018-09-17 20:01:57 +02:00
Pieter-Jan Briers
8ca36380ce Improve Matrix3 Transform API. 2018-09-17 19:42:24 +02:00
Pieter-Jan Briers
03075641ab Make ScreenToWorld correctly output relative grid coordinates. 2018-09-17 18:58:31 +02:00
Pieter-Jan Briers
b6ec18fa6b Fix docs blunder. 2018-09-17 18:57:57 +02:00
Pieter-Jan Briers
428596312e Attempt to fix broken zoomed screen -> world conversions. 2018-09-17 16:45:42 +02:00
Pieter-Jan Briers
2ef1839304 Fix Matrix3 <-> Godot.Transform2D conversions. 2018-09-17 16:45:21 +02:00
Pieter-Jan Briers
e1d1a8ea9d Fix some angle related issues.
Guns work again.
2018-09-17 12:34:05 +02:00
Pieter-Jan Briers
9e888ab28e Improve RayCastResult documentation 2018-09-17 12:33:49 +02:00
Pieter-Jan Briers
76df7dda88 Make angles use degrees in YAML.
They can be parsed as radians if suffixed with "rad"
2018-09-17 12:33:10 +02:00
Pieter-Jan Briers
ef77ae14f6 Actually commit .csproj changes. 2018-09-17 12:28:16 +02:00
Pieter-Jan Briers
a56f9b7dc5 Improve time panel layout. 2018-09-17 12:27:54 +02:00
Pieter-Jan Briers
f2bac93c18 Fix color of NetDebugPanel 2018-09-17 12:26:06 +02:00
Pieter-Jan Briers
04bf1782e9 Commands to show game time. 2018-09-17 12:25:52 +02:00
Pieter-Jan Briers
4c0e9bf1c7 Mark AudioParams.With<X> methods as Pure. 2018-09-17 12:24:20 +02:00
Pieter-Jan Briers
0079fea2d3 Cleans up some seemingly-issues. 2018-09-17 10:41:35 +02:00
Pieter-Jan Briers
796626b7d8 Y+ Up (#691) 2018-09-17 10:22:49 +02:00
Pieter-Jan Briers
ec02d6480a Project file maintenance, C# 7.2 (#690)
1. Updates all the NuGet packages (except CommandLineParser because they ruined their API)
2. Makes all projects use C# 7.2 explicitly. (not latest)
3. Use some C# 7.2 features like readonly structs and default literals.
2018-09-13 20:09:20 +02:00
Pieter-Jan Briers
16d56bc810 VV Refactor. (#689)
* VV Refactor.

Yes I just wrote it and it's already inadequate and filled with legacy code.

Instances and sessions were a terrible idea, they're getting replaced with "traits".

It's not even more modular.

Practical difference: it now supports private members, fields and displaying things implementing IEnumerable.

* Clean up code, fix some bugs. Document everything.

* Fix broken unit tests.
2018-09-12 17:56:28 +02:00
PJB3005
523e4d8c49 Fix compiler warning 2018-09-09 14:45:54 +02:00
PJB3005
dbb9fb8cf3 Fixes Travis unit tests. 2018-09-09 14:42:34 +02:00
Pieter-Jan Briers
43a270d486 View Variables (#683) 2018-09-09 14:32:55 +02:00
Remie Richards
cc89b3af0d Adds a var to forcibly show a godot transform. (#682) 2018-09-08 17:36:39 +02:00
Centronias
850e48d118 Client name change command (#681)
Adds member field to BaseClient to hold onto override name string. Figured that was the closest place to the usage, so why not stick it there.
On connecting to the server, the client will prefer to use that name, if it's set, over the name from the configuration.

Adds client console command to set that field.

Fixes #660
2018-09-04 16:12:02 +02:00
Centronias
f23f2f5a95 Math unit tests (#679)
Handful of unit tests for more of the math stuff along with minor changes to implementations fixing some bugs found by the tests.
2018-09-04 16:11:03 +02:00
Pieter-Jan Briers
6e95476156 Make all resources accessible to Godot. (#677) 2018-08-31 10:48:22 +02:00
PJB3005
a1f3c5fdbb Remove public setter on Angle.Zero. 2018-08-30 12:16:27 +02:00
PJB3005
230032421b Fix dead reference to SavedEntities.xml 2018-08-30 12:16:12 +02:00
PJB3005
f266afbd4d Fixes compiler warning 2018-08-30 12:07:18 +02:00
PJB3005
5dfeb7c8aa Fixes debugging of SS14.Shared.Maths on the client. 2018-08-30 12:04:59 +02:00
Pieter-Jan Briers
41e955e980 Entity-bound UI system. (#676)
Keeps track of which clients have a GUI open and such.
2018-08-30 11:59:58 +02:00
Pieter-Jan Briers
0fdbb48f9d GameScreen.GetEntityUnderPosition (#669)
Fixes #603
2018-08-30 11:43:20 +02:00
Pieter-Jan Briers
f5d9b64db5 Fix debugging of Content in Rider. (#670) 2018-08-30 11:42:16 +02:00
Pieter-Jan Briers
a750db22df Add ProgressBar Control wrap. (#675) 2018-08-30 11:41:51 +02:00
Pieter-Jan Briers
a7b6509d9f Add an event for when SS14Window is closed. (#674) 2018-08-30 11:41:36 +02:00
Pieter-Jan Briers
a6f4aacc37 Allow Control.GetChild to use /. (#673)
Just like Godot, you can now do `GetChild("A/B")`
instead of `GetChild("A").GetChild("B")`
2018-08-30 11:41:21 +02:00
Pieter-Jan Briers
4624051540 Adds ObjectSerializer.ReadStringEnumKey (#672)
Fixes #626
2018-08-30 11:40:44 +02:00
Pieter-Jan Briers
b3a3bbfc22 Fix bug with changing between animated RSI states causing exceptions. (#671) 2018-08-30 11:39:03 +02:00
clusterfack
7225e24e1c Two small fixes
Makes AABB of grids expand to the correct size
Removes redundant world position setting during spawn
2018-08-28 02:13:31 -05:00
Pieter-Jan Briers
b5bbbd9dde Allow lights to be nested one layer deep. (#668)
Fixes the first half of https://github.com/space-wizards/space-station-14-content/pull/92
2018-08-27 09:58:45 +02:00
Centronias
01daf9561a MathHelper minor changes and unit tests (#667)
Added unit tests for all MathHelper methods. Very open to test data values, I tried to specifically seek out edge cases, but I'm sure there're some things I've missed. Added tests for ensuring parameter preconditions throw exceptions.

Made some minor chanes to MathHelper.NextPowerOfTwo:
- Made the long, int and float overloads defer to the double overload since the original implementation was using the same thing as the double implementation anyway.
- Modified the precondition checking for negative numbers to check for non-positive numbers since the implementation for 0 shouldn't work since log(0) is undefined.
- Added precondition checks for float and double implementations to check for NaN and +/-Infinity
- Added special case handling for float and double implementations when the input is greater than zero but less than one where the previous implementation would return negative powers of 2 (ie, non-integer results), which I assumed are not intended. Depending on what people think, that same case could be extended to all inputs less than 1, or contrarily all inputs less than 1 could be considered out of range.

I've noticed that Acruid has PR #666 open to move MathHelper, among others, to a different place, so once that's in, I can merge it into this.


Lemme know if I've missed some procedure in the PR process.
2018-08-25 21:30:42 +02:00
Acruid
f49768e15a Math Assembly (#666)
Moved SS14.Shared.Math namespace into its own assembly. This allows projects to reference the math library without needing to include the entire Shared assembly.
2018-08-24 21:21:28 +02:00
Pieter-Jan Briers
74705b5a66 Engine Content Culling (#665)
* Engine culling.

Sandbox is gone.
Anything resembling "content" such as prototypes and textures is gone.
The engine can no longer load up directly
(short of the client's main menu, of course).

* Make tile prototype definitions workable.

Still not great though.
You can now manually specify their insertion order,
so technically tile ID.
2018-08-24 12:44:01 +02:00
Acruid
71121f8fef Added an SystemMessage for when an entity changes parents. (#662) 2018-08-22 09:55:15 +02:00
Pieter-Jan Briers
22fdca62bb Move more Player things into content. (#661)
* Move more Player things into content.

Spawning of players is now 100% up to content.
IPlayerData is now purely for content.

* Stupid sandbox.

* Sandbox pls go.

* Aaaaaah.
2018-08-20 16:13:58 +02:00
Pieter-Jan Briers
d8a5a617fe You now rejoin into the same body. (#659)
PlayerIndex is dead, it's been replaced by NetSessionId.
NetSessionId is basically just the client username.

Conflicts between usernames are auto resolved by the server,
due to lack of auth server & need for local testing.

dupeip config option is gone, it doesn't understand NAT.
2018-08-20 11:18:14 +02:00
Acruid
1c1c003b80 Input - Migrate Keybinds (#658)
* Moves PlayerInputMover logic into an EntitySystem.

* Removed old PlayerInput system.
Removed spammy input dbg message.
2018-08-18 14:40:17 -07:00
Pieter-Jan Briers
bddd355f17 Fix reconnection. (#657) 2018-08-17 00:02:19 +02:00
Acruid
0c66313255 Click Migration + Input Contexts (#656)
* Migrated click handling from old `ClickParser` to new `InputSystem`. Resolves #631.
* Input Context system added. Resolves #630.
* `PlacementManager` now uses its own input context.
* Added addon `Entrypoint.PostInit` function.
* Moved EntitySystemManager initialization from after the first state update, to right after the EntitySystem init.
* Made the EntitySystems only run Update/FrameUpdate/events after the map has been initialized.
2018-08-16 23:58:48 +02:00
PJB3005
900e2c94e8 Rename SpriteMirror -> SpriteProxy. 2018-08-16 22:16:17 +02:00
Pieter-Jan Briers
ba04fa0ae1 Sprite Mirror system. (#654)
Allows you to render a copy of a ISpriteComponent anywhere (in 2D).

This will be used in content to draw entities in GUI elements.
2018-08-16 22:01:37 +02:00
Pieter-Jan Briers
4a85a2a397 Smoothwalling for occluders. (#653)
Fixes #382
2018-08-13 14:38:18 +02:00
Pieter-Jan Briers
051e661cb6 Improve exception robustness. (#652)
All exceptions going to Godot are caught and logged.
Control no longer causes a Finalizer crash if .ctor threw.
2018-08-09 22:45:48 +02:00
Pieter-Jan Briers
1503a8b1f4 We Outta There. (#651)
Fix a bunch of console log spam.
2018-08-09 22:19:31 +02:00
Pieter-Jan Briers
b2e378359a Adds coloring to the client console. (#650)
* Adds coloring to the client console.

* Make input echos green.
2018-08-09 21:27:59 +02:00
Pieter-Jan Briers
be10df217e Engine changes to support content smoothwalling. (#649)
* MapIndices implements IEquatable.

* Add sane Modulo method to MathHelper.

* SnapGrid improvements.

Has an OnMoved-like event now.
GetInDir helper, basically like BYOND get_step.

* Make MapChunk use new standard mod method.

* entfo command improvements.

Can print diagnostic info from components now.
Doesn't list components multiple times.

* Transform implements IComponentDebug

* Move code to Godot 3.0.6.

It changed collections to use its own collection types.

* Helper to turn Directions.

* I forgot to commit csproj for IComponentDebug.

* Improve SpriteComponent.

Add direction offsets for layers.
Handling of directions is better now.
2018-08-09 17:28:02 +02:00
Acruid
21b00df2b1 Input Handling (#647)
* Added a shared interface for player sessions.

* Mouse Keys are now additionally handled like Keyboard keys.
Added Keybind for inspect.

* Added KeyFunctionId type.

* Keys now get passed through Gamescreen and into InputSystem.

* Remove useless KeyBindDown and KeyBindUp.

* Tried to get serverside input handling working (Spoiler: It does not).

* Stopped trying to make it over complicated, serverside input handling works!

* More cleanup, made InputSystem more symmetrical between client/server.

* Made it *actually* work with the examine system.
2018-08-08 10:55:47 -07:00
Pieter-Jan Briers
5b52d75a94 SnapGrid tracking system. (#646)
A new component, SnapGrid, now tracks the entity position on the actual tile grid.
This can be used to provide (relatively) quick indexing for say smoothwalling, atmos room calculations, etc...
2018-08-03 17:08:58 +02:00
Acruid
dcb22bf546 NetManager now blocks the main thread when waiting for the network thread to shut down. (#633) 2018-08-03 17:05:14 +02:00
Pieter-Jan Briers
830ff0f5b1 ITransformComponent & entity spawning QoL. (#645)
You can now access an entity's transform with the Transform property.
IEntityManager now has entity creation helpers.
2018-08-02 10:15:12 +02:00
Pieter-Jan Briers
786db099d1 Add zoom parameter to EyeComponent prototype. (#644) 2018-08-02 09:08:35 +02:00
Pieter-Jan Briers
c019e24a3a Fix CI by uploading GodotSharp.dll elsewhere. (#643) 2018-08-02 08:36:39 +02:00
Pieter-Jan Briers
4bc36834a9 Adds SpriteSpecifier. (#642)
It's a class for EITHER a texture path or an RSI state.
2018-08-02 00:15:17 +02:00
Pieter-Jan Briers
6b7a7d16e6 "Fix" DebugCoordsPanel exceptions on client start. (#641)
Pretty sure this is a race condition, so this should be fixed properly.
But hey, at least the client can reconnect now.
2018-08-01 22:24:06 +02:00
Pieter-Jan Briers
4e8d1c6b4f Fix bug where eye stays on map 0 until moved. (#640) 2018-08-01 22:16:47 +02:00
Pieter-Jan Briers
c79c01189f Terrible hijacking of placement. (#639) 2018-08-01 21:49:28 +02:00
Pieter-Jan Briers
c15288bfec Client-sided entities & other misc crap. (#638) 2018-08-01 17:27:08 +02:00
Pieter-Jan Briers
8e3f641155 Ah shit I did the thing I said I wouldn't do and I just forgot to commit the csproj. (#635) 2018-07-31 09:24:44 +02:00
Pieter-Jan Briers
d3af9fcd1b Wrap Godot.ItemList for GUI use. (#634) 2018-07-31 09:21:02 +02:00
Pieter-Jan Briers
8c4b3635ac Wrap Godot.Tree for GUI use. 2018-07-30 00:29:06 +02:00
Acruid
0ce3a8f233 DebugTools.Assert (#624)
Added a new DebugTools.Assert function to replace the System Assert. The System assert does not work well on mono, and was not gracefully handled by Visual Studio. This version now throws a unique exception when it fails, instead of the popup window. You can setup Visual Studio to break whenever the exception is thrown. The call sites to the new Assert are still removed in release builds, similar to the System version.

This resolves #569 without needing to add a trace listener.
2018-07-28 22:36:11 +02:00
Pieter-Jan Briers
0fb6cab703 ReadDataField version that does not use defaults but throws. 2018-07-28 16:08:00 +02:00
Pieter-Jan Briers
00b16c63ac Allow content to ignore prototype-types. 2018-07-28 15:33:48 +02:00
Pieter-Jan Briers
5d2d56bc64 Make SS14Loader a script on MainScene instead of AutoLoad. 2018-07-28 11:32:17 +02:00
Pieter-Jan Briers
8aa6d1ccc3 Adds dictionary shallow clone. 2018-07-27 15:45:10 +02:00
Pieter-Jan Briers
4679b853f7 Certified genius. 2018-07-27 10:25:39 +02:00
Pieter-Jan Briers
051f4a6399 Make YamlObjectSerializer constructor private. 2018-07-27 09:33:29 +02:00
Pieter-Jan Briers
b57b416d50 Add Lerp functions to FloatMath. 2018-07-27 09:33:14 +02:00
Pieter-Jan Briers
696bf486a6 Remove all compiler warnings. 2018-07-26 23:55:19 +02:00
Pieter-Jan Briers
f6c771f8ce Don't accidentally cache TestResult.xml on Travis. 2018-07-26 23:39:46 +02:00
Pieter-Jan Briers
bceda76bf8 Entity Data Refactor (#621)
* Remove `LoadParameters`
* Significantly refactor `EntitySerializer` to be better, no longer specific to entities.
* `IExposeData` so sub objects can be deserialized.
* Map format is now standardized & good.
* Entity and grid references inside map files now cross referenced and resolved correctly. Fixes #524 
* Prototype data caching to speed up prototype instantiation.
2018-07-26 23:35:13 +02:00
Acruid
5c2bd4049c ECS - ComponentManager Restructure (#620)
* Switch from storing the components on each entity to a central database inside of ComponentManager.
* Better deferred component remove.
* Turn the IEntity component functions into proxies of the ComponentManager functions.
* Remove Update() base function from Components. If components need to update, an EntitySystem needs to do it.

Resolves #618.
2018-07-26 23:10:24 +02:00
Acruid
2b69075bc2 Server Console - Cumulative Feature Update (#616)
### Purpose
* Merge ServerConsole and ClientConsoleHost shells into one system named ConsoleShell.
* Migrate all server side commands to the new ConsoleShell system.
* Add a PermissionGroup system, for 'ranks' like user/mod/admin/owner.
* Track per-client permission group, allow clients to elevate permission with global 'sudo' password.
* Changed `IWritableDirProvider.Open()` to return a `Stream` instead of a `FileStream` to help test-ability.

Resolves #612.

### Open Questions and Pre-Merge TODOs
- [x] This fix is tested on the same branch it is PR'ed to.
- [x] I correctly commented my code.
- [x] This PR does not include any unnecessary .meta, .prefab or .unity (scene) changes.
- [x] This PR does not bring up any new compile errors.
- [x] This PR has been tested in editor.
- [x] This PR has been tested in multiplayer.
2018-07-26 20:09:31 +02:00
Pieter-Jan Briers
22520fc1cf Fix exceptions upon game start. 2018-07-20 17:56:56 +02:00
Pieter-Jan Briers
44946d9be2 Catch exceptions in _Process. 2018-07-20 17:52:36 +02:00
Pieter-Jan Briers
05b4e64a29 Comments for appearance component. 2018-07-17 11:49:25 +02:00
Pieter-Jan Briers
92f12334b4 Appearance Controllers 2: Electric Boogaloo. (#615) 2018-07-17 11:11:01 +02:00
PJB3005
fec7d6481b Fix accidental Godot 3.1 config file 2018-07-15 15:45:23 +02:00
Pieter-Jan Briers
d1e4b259bb Appearance Controllers fundamentals. (#614) 2018-07-14 23:24:09 +02:00
Pieter-Jan Briers
0a397dc4d5 Fix resetting sprite layer animations if state gets set to the same value. 2018-07-14 16:56:47 +02:00
Pieter-Jan Briers
4c8be76aa9 Make Control.Disposed public. 2018-07-14 16:44:08 +02:00
Pieter-Jan Briers
63f56252f9 Fix broken format string in SpriteComponent. 2018-07-14 16:44:02 +02:00
Pieter-Jan Briers
a418bde812 Fix exception spam from deleting hovered entities. 2018-07-14 16:42:47 +02:00
Pieter-Jan Briers
86ddf5989b Display exceptions if map entities fail to be created. 2018-07-14 16:42:32 +02:00
indeano
f6d01c5d61 Public access modifiers for YAMLEntitySerializer (#610)
This is necessary to allow content packs to create their own class serializers
2018-07-10 10:19:31 +02:00
PJB3005
c7d56759b3 Allow disabling lighting. 2018-07-06 15:29:50 +02:00
Acruid
3d128747c4 VFS Features (#611)
* Added the new writable VFS API. Resolves #566.

* Moved resource interfaces into the new Interfaces.Resource namespace.

* Adds the property `ResourcePath.Directory`.
Removes the obsolete property `IResourceManager.ConfigDirectory`.

* Marked string version of content functions as obsolete.

* Removed unused `System.IO` using statements.

* Removed the System.IO namespace from a bunch of files.
Made the string version of IResourceCache obsolete, and converted everything to use the ResourcePath versions.
This should Resolve #567.

* Fixing some bugs.

* Un-Obsolete the string functions in IResourceCache and IResourceManager.
2018-07-02 20:33:14 +02:00
Pieter-Jan Briers
0abdcbd1f8 Never forget to hit save. 2018-06-23 21:57:26 +02:00
Pieter-Jan Briers
c20848902e Update export preset. 2018-06-23 21:55:35 +02:00
Pieter-Jan Briers
f1d3d2c5ce Async Delay and Spawn helpers for Timer. (#607) 2018-06-11 20:29:41 +02:00
Pieter-Jan Briers
c6d941f0cf Detaches grids from maps. (#595)
Grid IDs are now globally unique.
This'll make moving grids between maps possible.

Also, LocalCoordinates has been renamed to GridLocalCoordinates.
2018-06-11 20:24:23 +02:00
Pieter-Jan Briers
11230fe98f Fix reconnecting with the client. 2018-06-09 16:03:24 +02:00
Pieter-Jan Briers
170e1ad5af Nice typo. 2018-06-09 15:47:59 +02:00
Pieter-Jan Briers
100d21196b Improve readmes.
Moved the intimidating all caps readme info out into its own file.
Deleted the linux file as it was horribly outdated.
2018-06-09 15:19:21 +02:00
Acruid
46ca2d2cc5 TileDefinitions can be loaded from prototypes now. (#594)
The server now uses the config file to figure out which map to load.
2018-06-08 19:32:14 +02:00
Pieter-Jan Briers
0563a5beb3 Fix build issue on Godot 3.0.x 2018-06-08 14:52:48 +02:00
Pieter-Jan Briers
6d35e339cb Fix caching of GodotSharp.dll on AppVeyor. 2018-06-07 23:30:27 +02:00
Pieter-Jan Briers
8a8ed75084 Fix typo. 2018-06-07 23:28:16 +02:00
Pieter-Jan Briers
fbeb10e8c2 Make download_godotsharp 522 proof. 2018-06-07 23:25:02 +02:00
Pieter-Jan Briers
be174cc027 Sprite per-layer color modulate. 2018-06-07 23:14:55 +02:00
Pieter-Jan Briers
d1cf753f22 Debug Coords Panel gets entity display. 2018-06-03 16:40:59 +02:00
Pieter-Jan Briers
6ede21aa14 Fix Overlay.ZIndex setter. 2018-06-03 16:11:18 +02:00
Pieter-Jan Briers
59a1cc899b Even einstein agrees. 2018-06-03 16:09:23 +02:00
Pieter-Jan Briers
ee7c5d9da1 It it quantum-physically impossible to get CI scripts right the first time. 2018-06-03 16:03:38 +02:00
Pieter-Jan Briers
88520e8db5 Coverage badge. 2018-06-03 16:01:38 +02:00
Pieter-Jan Briers
e73bcd57c0 Fix coverage reports. 2018-06-03 16:01:32 +02:00
Pieter-Jan Briers
cd376711bf Does this fix coverage. 2018-06-03 15:49:36 +02:00
Pieter-Jan Briers
ca0037a402 I'm a genius. 2018-06-03 15:35:29 +02:00
Pieter-Jan Briers
7aee21b689 Guess no multiline then. 2018-06-03 15:31:02 +02:00
Pieter-Jan Briers
348ca5b107 Shall coverage work first try? 2018-06-03 15:27:53 +02:00
Pieter-Jan Briers
136d306d1d Use after_test maybe? 2018-06-03 15:06:43 +02:00
Pieter-Jan Briers
3c14e1d1db Make Sonar import unit test results. 2018-06-03 14:59:50 +02:00
Pieter-Jan Briers
c058c2e3d4 Outlines & Custom non-entity drawing. (#592)
* Shader work WiP

* Probably implement basic shader param support.

* Really rough and hacky version

* Fix dumb exception.

* Custom fullscreen drawing API prototype.

* Significantly optimize debug colliders drawing.

* Fix drawdepths on clothing & overlays.

* Re-add license to outline shader.

* Update .editorconfig for .gdsl files.

* Fix unit tests.
2018-06-03 14:38:56 +02:00
Pieter-Jan Briers
1812e8743d Makes EntityUid IComparable. 2018-05-30 16:10:11 +02:00
Pieter-Jan Briers
036daa2ac8 ToString() for entities.
Intended for debugging mostly.
2018-05-30 16:09:47 +02:00
Pieter-Jan Briers
480a0b4a0a Can now change SS14Window titles. 2018-05-30 14:22:57 +02:00
Pieter-Jan Briers
693769cbd4 Improve sprite drawdepth ordering. 2018-05-30 14:07:21 +02:00
Pieter-Jan Briers
00fe03b61b Placement fixes. 2018-05-27 23:27:23 +02:00
Pieter-Jan Briers
b761d9a1eb Fixes directional icons not being used in placement previews. 2018-05-27 21:44:35 +02:00
Pieter-Jan Briers
3728c7eeee Some entity improvements to work on power code. (#591)
* Client-specific component network messages.

* Make entity serializer aware of color names.

* Fix input log spam.
2018-05-27 16:57:42 +02:00
Pieter-Jan Briers
dc80060757 Input Refactor (#590)
* *some* input work.

* Remove explicit numbers from Key enum.

* Hey, keybinds sorta work!

* Input almost works?

* It works.

* Fix networking issues.
2018-05-27 10:08:36 +02:00
Pieter-Jan Briers
909bb5936f Fixing issues sonar pointed out. (#589)
* Fixing issues sonar pointed out.

* Fix build.
2018-05-26 18:21:40 +02:00
Pieter-Jan Briers
0da7507c64 shhhhh. 2018-05-13 15:54:32 +02:00
Pieter-Jan Briers
0a195fe3c7 Game State Refactor (#586)
* Rename SS14.Server/GameState directory.

* Server now runs at 60 FPS.

* RegisterNetMessage<T> more generic!

Also started refactoring game states.

* HOLY SHIT I CAN MOVE AROUND.

* Dirty(); calls and improvements.

* Implement deletions + mark components as dirty initially.

* Remove bsdiff submodule.

* Remove Bsdiff.

* Fix System.ValueTuple reference.

* Server no longer crashes when the gun is used.

* Optimize player sync.

* Prevent constant dirtiness from player input mover.
2018-05-13 11:40:16 +02:00
Pieter-Jan Briers
64e22fc031 Fix GodotSignalSubscriber leakage. (#588)
Every signal subscriber was getting leaked because I didn't know how Godot's memory model works. This is fixed now.
2018-05-12 00:13:21 +02:00
Pieter-Jan Briers
1375da7f70 Rename IEntity.GetComponents to GetAllComponents. (#584)
This is to avoid confusion.
A single s to distinguish it from GetComponent() is quite hard to miss.
2018-05-10 18:52:17 +02:00
Pieter-Jan Briers
6b37906c85 Logging API cleanup. (#585)
Added versions of the log calls not doing formatting.
Moved the LogLevel argument for .Log() to be first.
2018-05-10 18:51:55 +02:00
Pieter-Jan Briers
6c7dff77c5 Fixing some crashes and errors. (#583)
Fixes #559 and resolves a ton of error spam & shutdown crashes.
2018-05-10 18:51:42 +02:00
Pieter-Jan Briers
86a432bdeb Debug monitor system & UI improvements. (#581)
Debug monitors like coord debug, FPS and the (now re-added)
have been amde into a more centralized system.

Networking debug is back! No chart though.

Bunch of improvements and fixes to the UI code to facilitate this.
2018-05-10 18:50:56 +02:00
Pieter-Jan Briers
cb469c4f86 Fixes description loading in prototypes 2018-05-09 17:12:56 +02:00
clusterfack
dd0be25ab6 Placement Systems (#580)
* Deactivate special placement mode after placement
Comments
Fix collision checks for placement manager
Remove unnecessary usings
Fix the alignment issues
Wow this commit has literally almost all the work done in it alone
time to test some sketchy shit, commit first

* Fix align similar
2018-05-09 16:33:50 +02:00
Pieter-Jan Briers
4471e0ccca The SpriteComponent refactor (#577)
* Adds Godot shader support.

* New sprite component with a layer system.

Supports per-layer shaders. Only texture and shader properties are implemented.

More TODO.

* Basic RSI loading.

* Direct textures for layers.

* Implement a scale layer parameter.

* RSI directions work now.

* Animation support.

* Make sprites appear again.

* Fix error message about shaders on the server.

* Implements directional sprite handling & rotation of transforms.

* Remove debug logs from ShaderSourceResource.Load

* Work on a public API & better handling of errors.

* Layer addition API coded but untested.

* Fix init crash.

* Add a client side API for SpriteComponent.

* Remove dead NetIDs.

* Fix bug where sometimes entities start flat on their face.

* Refactor IconComponent.

* Adds rotation property to layers.

* Expose scale and rotation APIs, sprite-global rotation.

* Adds visibility property.

* Netcode work.

* Server side prototype loading done.

* Netcode works.

Also adds a visibility layer option.
2018-05-02 21:24:59 +02:00
clusterfack
adece0e39b Description information on entity and loading from prototypes (#579) 2018-05-02 21:24:02 +02:00
clusterfack
9aed85b4c7 Click modifiers (#578)
Apparently @pjb3005 did almost all the work for this when he changed the system to godot but didn't say anything, adds a property to parse the clicktype on mousebuttoneventargs and passes it in the network message instead
2018-05-01 02:43:40 -05:00
clusterfack
3a78a26652 PJB will love this (#573)
* PJB will love this

Containers 2: The uncontained

* Yes
2018-04-23 01:57:18 +02:00
clusterfack
498349bbcf Companion PR (#574)
https://github.com/space-wizards/space-station-14-content/pull/61

Adds a keybind for opening the character menu and makes texture rect not die when setting texture to null
2018-04-22 19:59:04 +02:00
clusterfack
8b83362c61 Gridcontainer (#571)
* Gridcontainer Wrapper

* This is probably important too

* Oopsie daisy

* Creates the client and shared portions of the new inventory code
2018-04-21 01:36:03 -05:00
Pieter-Jan Briers
32caf088ef Adds a system to load tscn files from content. (#570) 2018-04-19 21:22:16 +02:00
Pieter-Jan Briers
a34006f8ff Make project files default to x64. (#568)
Also fixes Lidgren's output directory. Not like it mattered.
2018-04-19 21:16:26 +02:00
Pieter-Jan Briers
20b9fd3228 Sawmills! (#565)
* Sawmills

* They seem to work on the server now, sorta.

* They work.

* More shit that works.

* Shit works yo.

* File logging for the server.

* Adds some debug commands and finishing touches.

* Oh yeah change this default.

* Fix unit tests.
2018-04-19 20:19:40 +02:00
clusterfack
320aa3f9c0 Gridcontainer Wrapper (#564)
* Gridcontainer Wrapper

* This is probably important too
2018-04-18 21:44:30 +02:00
clusterfack
f445addcd5 These should have no distinction on the client (#563) 2018-04-17 02:25:09 -05:00
clusterfack
44b00a1fa7 Make handle message use optional arguments (#561)
* Make handle message use optional arguments

Instead of arbitrarily using object as the first argument and killing type safety

* Ohboy
2018-04-15 13:34:22 -05:00
Pieter-Jan Briers
909ba41890 Remove usage of PitchScale. (#562)
It was apparently a very new 3.1 feature,
so it doesn't work on Godot 3.0.x.
2018-04-15 13:34:08 -05:00
PJB3005
b5ca9095b0 Remove Bitstream 2018-04-13 01:08:08 +02:00
PJB3005
c22a199a5b Remove binaries 2018-04-13 00:40:09 +02:00
Pieter-Jan Briers
2395b456e2 Update all NuGet packages. (#556)
* Update all NuGet packages.

* What a way to waste one and a half hours of my life.

* fucking

* fuck everything.
2018-04-12 23:41:56 +02:00
Pieter-Jan Briers
d7414930ff RSI support (#552)
* RSI WiP

* More work but we're doing bsdiff now

* RSI loading seems to mostly work.

* Vector2u deserialization test.

* Add in packages again.

* This is the part where I realize I need a path manipulation library.

* The start of a path class but it's late so I'm going to bed.

* HIGHLY theoretical ResourcePath code.

Partially tested but not really.

* Allow x86 for unit tests I guess jesus christ.

Thanks Microsoft for still not shipping x64 VS in 2018.

* Resource paths work & are tested.

* I missed a doc spot.

* ResourcePaths implemented on the server.

* Client works with resource paths.

TIME FOR A REFACTOR.

* Some work but this might be a stupid idea so I migh throw it in the trash.

* Resources refactored completely.

They now only get the requested resourcepath.
They're in charge of opening files to load.

* RSI Loader WORKS.

* Update AudioResource for new loading support.

* Fix package references.

* Fix more references.

* Gonna work now?
2018-04-12 21:53:19 +02:00
Pieter-Jan Briers
796555fad5 Audio system! (#550)
Supports positional, entity-tracking and global audio.

Special thanks to Zumo on Discord,
for figuring out how to load audio files Godot.
2018-04-12 17:54:18 +02:00
Pieter-Jan Briers
1e749952db Unit test improvements. (#548)
* Unit test improvements.

Adds an ApproxEqualityConstraint and IApproxEquatable<T> for certain tests.
Gives [Parallelizable] to a bunch of tests.

* ParallelScope.All | ParallelScope.Fixtures
2018-04-12 17:53:10 +02:00
clusterfack
e191be3a75 Fix stored object clicking bug (#553)
Fixes a humorous bug where you click on things that are contained in another thing because the mousedown doesn't check if something is on the map or not
2018-04-12 11:23:04 +02:00
Pieter-Jan Briers
ba3bad68c8 New logo courtesy of @outbools. (#549) 2018-04-12 02:55:45 -05:00
Pieter-Jan Briers
2bc7e09f65 Stop building the resource pack on Travis and AppVeyor. (#551) 2018-04-12 02:55:25 -05:00
Pieter-Jan Briers
896ac87f04 Remove broken particle editor. (#547) 2018-04-11 10:47:38 -06:00
Pieter-Jan Briers
b5c0202647 Godot (#545)
* bsdiff submodule

* All the other stuff

* Upgrade to 0.2 of SS14.Shared.BSdiff

* Use streams. Even faster!

* All rendering refactors should start with the killing of the SFML submodule. Trust me I've done this before!

* And after that comes the removal of the references in the project files!

Of course, neither of these compile. Meh.

* IoC loads, now to port the entire client over.

* More work

* Trying to debug the null exception.

* More messy WiP code

* More WiP

* Transform components now make Node2Ds inside the scene tree.

* Work on the UI system.

* Redo project configurations to work better.

* More work on the Godot GUI binding.

Added BaseButton and Button bindings, including events for them.

More APIs on Controls like GetChild() and alike.

Ability to instance a Godot PackedScene and have it automatically be wrapped by the SS14 GUI wrapper, thus allowing the usage of Godot's GUI editor while maintaining the good C# API.

* Fix incorrect sRGB profile on bootsplash.png

* LineEdit API.

* Maybe commit the csproj too.

* Exit button works now!

* Change MainMenu root to a normal Control.

* Some stuff messing with window popups.

* Fix popup not scaling down again after housing large text.

* Make popup dialog helper.

* Auto wrap controls that spawn others when not instancing.

* Nice typo me.

* Work getting server connections working.

* Server didn't start anymore due to still trying to load removed zip packs.
* Made MainMenu dump UI elements in shutdown.

* We now successfully connect to the server.

* WE Ingame NOW!

* Basic map rendering works now!

* Camera & Input work.

Though I'm not sure whether the input issues are this piss poor laptop or actual bugs.

* Fix input issues.

KeyHeld() was firing KeyUp() into States, which broke everything.

* WiP Debug console.

UI Works, command processing doesn't.

* Remove some debug logs.

* Fixing focusing issues with the Debug Console.

* In which I copy paste in the DebugConsole code.

* More WiP DebugConsole work.

* Use RichTextLabel for DebugConsole.

* Disable DebugConsole test text.

Also disable context menu on the IP Box because of font size issues.

* ITextureSource for texture wrapping.

* Make resource loading not copy every build.

It now loads from repo root. Release builds are TODO.

* Bsdiff 0.3 for fixed targets.

* Fix iCCP sRGB errors.

* Give full texture paths to prototypes.

* Sprite component old API restored. *shudder*

* Finish sprite rendering.

By hitting delete on basically everything.

* Fixing camera delay with this one weird trick!

The input lag was because the camera lagged, not because the input lagged. I didn't have visualization.

* Use greyshirt as temporary human replacement.

* FPS Counter.

* Fix Windows, re-add space tile def.

Windows broke because Mono on Windows can't use System.IO.Compression.
The GZIP streams use by MsgFullState have been moved to
ICSharpCode.SharpZipLib.GZip. Works fine.

Also re-added the space tile def because everything blows up otherwise I
guess.

* Debug colliders works.

* Highly WiP varied Window code.

* Work on the quit button. Doesn't work yet. Needs state overhaul.

* Do a better job of freeing Godot objects correctly.

* Simplify game states.

States are no longer cached. They're GC'd after shut down. Their creation has been simplified too due to IoCManager.InjectDependencies().

This makes returning to main menu work GUI wise.

* Be less aggressive on resource freeing. Only dispose Mono handles now.

* More work getting quit to work.

* Grids get cleared upon disconnect correctly.

* Disable rendering of the filler space tile.

I'll leave a nice parallax background up to content.

* Oops forgot to stage these.

* Fix issues in the csproj file.

* Make controls have own namespace.

* Chatbox GUI, other stuff.

Compiles but doesn't quite work yet.

* Git fuck you

* Chat works.

* Clicking on a not-control removes focus now.

* Fix an exception.

* Update mono. Use enums instead of constants now!

* Fix window dragging

* Fix chat stealing focus from other LineEdits on MacOS I guess.

* Correctly handle client shutdown & server disconnect.

* Fix error spam on client shutdown probably.

* Tiny amount of lighting code to have access to it from other computers

* Lighting works mostly.

* Godot.Texture.Flags -> FlagsEnum

* More WiP lighting code

* Turns out you can't control custom layers with cameras eh.

* WiP lighting almost works

* Lighting WORKS!

* Lobby thing.

* Some options menu work. I'm gonna try something

* Options menu works.

* More improvements.

* In game options menu works.

* Remove a debug log.

* Fix Window Movement and Drag.

* Huh Godot edited these scenes.

* Forgot to commit projects

* It compiles.

* I never claimed that.

* Update sandbox csprojs a bit.

* Makes sandbox load.

Client goes ingame but dies due to broken map manager networking code.

* Fix grids.

* Fix relogging duplicating entities inside Godot.

* Eyes!

* How about removing the TODO entry.

* Auto fetch bsdiffwrap.

* Update TODO.

* Remove TODO list.

* Tilemaps get cleaned on disconnect now.

* Fix bsdiff submodule HOPEFULLY

* Highly WiP and not compiling or working placement.

Yes this is the best way for me to share code between my computers.

* Fix bsdiff with spaces in path names bloody MSBuild + cmd.

* PLACEMENT KINDA WORKS.

NO RENDERING OR TILES YET.

ALSO I NEED TO REBASE THIS.

* Kill EngineContentPack.zip

* Fix map code and remove sprite components from the server.

* Ok entity placement mostly works.

* Grid lines sorta work but SnapgridCenter is still broke.

* Fix Center Grid Rendering.

* Work getting tile spawns to work. Not quite there yet.

* Fix placement and remove tiledef networking.

It werks!

* Remove SolutionSpecific.targets

Didn't end up being needed.

* Kill off wearableanimatedsprite component states.

* Do not put binaries relative to the solution.

* Remove shaders, reorganize prototypes for content.

* Reimplement SpriteComponent color.

* Correctly set __engine_human DrawDepth.

* Round coordinates passed to Godot to pixels to prevent issues.

* Remove some GUI log spam.

* Resource cache now uses the VFS more-proper but still awfully.

* Fix color reading code on SpriteComponent.

See, e94bf4854b106da51c89eeeab9a609be369f9622 did work.
The problem was all the code it NEEDED to work was broken.

* Step one into trying to fix Travis and AppVeyor.

* Auto download GodotSharp on Travis.

* Let's not make dumb mistakes with the cache directories.

* 2018 and requests still isn't in the stdlib.

* This maybe?

* This maybe?

* AppVeyor time.

* How 'bout we don't download sonarqube at all outside master.

* Try to cache on AppVeyor.

* Fix mac builds maybe.

* Finishing up Godot: cleanup.

* Eh this works too for SS14Loader.

* Remove some dead files

* Make Omnisharp not choke on buildchecker.

* Controls for box containers.

* Remove debug port from project.godot.

* Control and drawing improvements.

Controls are now properly capable of overriding Godot virtuals.
Importantly minsize calculations and stuff like HasPoint.

There is now a system for doing direct drawing on controls.
This is done with a DrawingHandle system.

TextureSource has been renamed to Texture.

Also there's a wrapping for Godot's style boxes now.

* Yeah don't insult omnisharp.

* Stylebox fixes and margin API on controls.

* Hey it compiles!

* Fix things.

* Fix null godot texture conversion.

* Fix client transform parenting.

* Fix movement sticking to north.

* Some updates.

* Work on exports.

* Unstubs client/Godot timing code.

It's mostly implemented now.

* Client unit tests work.

Jesus Christ.

* Let's figure out why AppVeyor hates me.

* Does the remie.

* Update GodotSharp download URL.

* Export templates for the builds server.

* Remove mac export icon.

* TO THE BUILDS SERVER.

* Probably implement the effects system in Godot.

* Fix mouse handling everywhere.

* Fix some CollidableComponent exceptions.

* Effects system works + unshaded option for LAZORS.

* Let's not fuck with Angle yet.

* Make file/line numbers show up on Windows Godot.
2018-04-07 15:24:46 +02:00
clusterfack
5f5c5f13c9 Changes physics and collidables (#543)
This is for projectile weapons, adds some enhancements and modifiers for collision behavior which will help out
2018-04-06 00:34:24 +02:00
clusterfack
b13af4cd8d Adds getentititiesinarc (#544)
A bit of a shitty function that somewhat works, get entities in a range that intersects ours but also has a center point within an angular range that we specify
2018-04-05 19:27:17 +02:00
clusterfack
f64309ba6f Arbitrary Effects System (#537)
* Moves client entity system to be closer to IoC registration and before gamescreen initialization

* Gives the raycasting system an argument to ignore a particular entity when finding what entity it will intersect

* Adds an arbitrary effects system

By creating a message defining things such as position, spritename, rotation, size, and delta values, you can create a temporary effect on the client. Just create a new message, define all the values upon it, pass it to the serverside effects system to send to the clients.

* Effects csprojs stuff and adding a datatype for priorityqueue from a nuget package

* Modifies nuget to use $solutiondir

* Effectsystemstuff
2018-04-05 19:26:35 +02:00
Acruid
67ecfe7ddb BaseServer - Kick Players On Shutdown (#541) 2018-03-27 13:56:52 -06:00
Acruid
77f7efdf6e MapLoader now catches any errors when creating an entity and prints them to the console instead of crashing the program. (#540) 2018-03-25 14:17:52 +02:00
Acruid
7d681567d1 Serializer Improvements (#539)
* Added Data Get/Set functions for use with Properties.

* Able to serialize generic List and Dictionary.

* Can now actually serialize generic lists and Dictionaries.

* Manually set the newline string for StreamWriter so the tests pass in linux/mac.
2018-03-25 14:17:41 +02:00
Acruid
553a0aca53 GameLoop Refactor (#538)
* Added Unit Tests for GameTiming.

* Added GameLoop class.

* Removed TimeScale.

* Switched server to the new GameLoop.

* Client now uses GameLoop.

* Allowed friend assemblies in release builds, so TravisCI can run tests.
2018-03-25 14:15:47 +02:00
DamianX
556fcbf7bd GetAllPlayers() doesn't return nulls (#542) 2018-03-22 17:03:03 +01:00
Acruid
3a5ea35c0b Raycasting + Turret AI (#532)
* Ray -> Box intersection works.

* Turret AI finished.

* Turret Works :D

* Light masks can now be rotated.

* Shoddy angle MoveTowards works.

* Shoddy Vector2 MoveTowards works.

* And pretty broken Quaternion version..

* Slept on it, rotation works good enough now.

* Fixed nuget dependencies.

* Moved AimShootLifeProcessor.cs to content.
2018-03-09 21:48:34 +01:00
Pieter-Jan Briers
2fb6f27cd1 Fix Travis and code analysis compiler warnings on Unix. (#535)
* Fix Travis and code analysis compiler warnings on Unix.

* Actually let's just disable macOS builds.
2018-03-09 18:03:20 +01:00
clusterfack
f57196a481 Directional Placement Manager Fix (#533)
* Placement Manager rotation fix

* Makes sure the default nondirectional sprites work as well
2018-03-09 18:02:54 +01:00
clusterfack
c03569a4e8 Full interaction system (#534)
Raises an event on click, regardless of whether we clicked on something or not. Sends it to the server to be parsed in the content interaction system.
2018-03-09 17:30:30 +01:00
Acruid
c8aaab48ad InputSystem Messages (#531)
* Misc cleanup.

* Removed BoundKeyChangeEventArgs.

* Removed event IClickableComponent.OnClick.

* Nothing uses EntityEventArgs now.

* Input messages are now sent through the network as SystemMessages instead of ComponentMessages.
Fixed EntitySystemMessage namespace name colliding with the base class.
Removed some unused code from server.

* Ignored KeyBindingInputComponent in the client prototype system.
Removed useless update code from client InputManager.
2018-03-03 13:19:18 +01:00
Acruid
a850c722cc Color Merge (#530)
* Removed useless CLSComplientAttribute from math structs.
Removed Obsolete functions from math structs.
Minor code cleanup.

* Merged Color into Color4, then renamed Color4 back to Color.
2018-02-27 19:37:33 +01:00
Acruid
b9cadc4599 Minor Refactorings (#529)
* Moved GameStateManager functions out of BaseServer.

* Moved PlayerManager NetMsgs out of BaseServer.

* Moved MapManager NetMsg out of BaseServer.

* Moved TryLoadAssembly from BaseServer to AssemblyLoader.

* Removed some service locator calls.
2018-02-27 19:35:18 +01:00
Acruid
eb74c4227f Component Messaging Rework (#528)
* Sealed Entity class.
Removed Entity.Update().
Code cleanup.

* Component.Update() is now obsolete.

* Added skeleton of new Component Message system.

* Converted everything to use new `SendMessage(owner, message)`.

* Removed more of the old system.

* Changes `IEntity.AddComponent(IComponent)` to `IEntity.AddComponent<T>`.
Removes some initialization functions from IEntity.

* Pulled ComponentManager registration out of Component into Entity.
Removed unused OnShutdown events from Entity and Component.

* Converted Component.ReceiveMessage() to Component.HandleMessage().

* Killed component message params.

* Remove EntityNetworkMessage params.
2018-02-24 09:16:28 -08:00
Acruid
ba981a13e0 Can now save and load full IMaps. (#523)
Server concmds for save/load map.
2018-02-18 00:10:17 +01:00
Acruid
eee7b3c598 Transform Parenting Enhancement (#522)
* Nightly Progress.

* Getting closer...

* !!! IT FUCKING WORKS !!!

* Cleanup

* Relative Rotation works.

* SpriteComponents now rotate properly.
2018-02-18 00:07:45 +01:00
clusterfack
441bdf628a Fix placement dragging affecting entities (#521)
* Fix placement dragging affecting entities

It now only affects tile placement

* Tuturu

* Fix annoying defaultanimatedsprite bug as well
2018-02-06 21:34:53 -06:00
Acruid
309ef2cea2 Map Blueprint Save/Loading (#520)
* YAML deserializer is coming along.
Nightly work.

* Should be pretty much working now.

* Converted most of the server components over.

* Entity loading/saving works.

* Grid saving/loading works.

* Cleans up old code.

* Saving and Loading of blueprints works.

* Improved map commands a bit.

* MapLoader fixes grid and map IDs in blueprint.
Can now load blueprints from the VFS.

* Removed Entity.LoadData(YamlMappingNode).

* Updated the nuget 'YamlDotNet' package to 4.3.0.

* Fixed Sandbox entry point.
Unit tests pass again.
2018-02-06 18:56:58 -06:00
clusterfack
8b31da2e0a Adds the same event subscriber entity has to entitysystems (#518)
* Adds the same event subscriber entity has to entitysystems

* Add the other helpers because pjb asked
2018-02-05 12:52:24 -07:00
clusterfack
59f158b13a Fixes spawn entity bug (#508)
* Fixes spawn entity bug

Now transform is called before initialize is, yay.

Call it shitcode but unless there is a better way that I cant find, this is the fix, and if there is please tell me

* Fixes incorrect AABB
2018-02-02 15:19:56 -07:00
clusterfack
2301c8d6ee Prevents sprite exceptions (#507)
* Prevents sprite exceptions

Even though setsprite has a default value that it gets set to, unless you give basesprite a non-null value and call setsprite it will cause the animatedsprite components to have an exception without fail. This happens if you don't include it in the prototype for whatever reason.

* Unnecessary
2018-02-02 15:19:40 -07:00
clusterfack
0427fa1537 Makes mouseclicktype an enum (#506)
* Changes clicktype to an enum because why isn't it

* Oops

* Whatever sure lets call it "ClickType" instead of "Clicktype"
2018-02-02 15:19:27 -07:00
Pieter-Jan Briers
f5e5cca2aa Supposedly fix collisions. 2018-01-31 22:37:02 +01:00
Acruid
5c0537f008 CloseTK (#503)
* Added math types from OpenTK project.

* Removed OpenTK from SS14.Server.

* Removed most references to OpenTK from SS14.Shared.

* Removed OpenTK from SS14.UnitTesting.

* Fixed errors in SS14.Client.Graphics.

* Removed more references.

* Remove OpenK from SS14.Client.

* Fised the last compile errors.

* Deleted opentk config file.
2018-01-26 07:31:37 -07:00
Acruid
a2f37d2613 Placement Click-Drag (#502)
* Fixes placement again.

* Can now click-drag tile placement to place multiple tiles.
2018-01-24 20:45:53 +01:00
Jordan Brown
f532d90b78 Fixes appveyor clone (#501) 2018-01-21 00:24:28 +01:00
Pieter-Jan Briers
785d164d29 Make AppVeyor use non-shallow clones for Sonar blame. (#500) 2018-01-21 00:09:37 +01:00
Pieter-Jan Briers
15823b1cb4 Fix AppVeyor maybe 2018-01-20 23:59:04 +01:00
Acruid
d0c317c8b4 Content Build Targets (#499)
* Changed projects so that Sandbox content is built in its own folder, and then copied to ./Resources/Assemblies.

* Moved SS14.Sandbox.targets to the ./MSBuild/ folder.
2018-01-20 23:47:42 +01:00
Acruid
21ebda05c2 Appease Sonar (#495) 2018-01-20 13:24:14 -07:00
clusterfack
8d208dca16 Entity Getters 2 (#496)
* Location Getters 2

Oh my god I didn't even make them part of the interface last time
Fixed a bug with local coordinates not be converted to world coordinates before comparing to other entities world transform
Added some more getter overloads

* Changes entities getters more

Adds a get entities in range for entity and range overload
Changed getentitiesinrange to take into account the bounding boxes of objects instead of their absolute coordinates

* SQUARE
2018-01-20 15:09:18 +01:00
Acruid
03a06cead9 EntityUid Type (#498)
* Wraps Entity Uids in their own type.

* EntityId can't be serialized by entity params.
2018-01-20 15:07:38 +01:00
Acruid
a2278f8ef2 Move Component Initialize to the Entity class. (#497)
Allowed EntityManager to work with the Entity class instead of IEntity.
2018-01-19 20:20:15 -06:00
Acruid
494c5c3eb3 kick Command (#494)
* Added a NetManager.DisconnectChannel so that server/shared can disconnect clients.
Added listplayers command to list all connected session on the server.
Added kick command to forcefully disconnect a connected session.

* Part 2, everything works now.
2018-01-18 18:51:23 -07:00
Silver
594f53d275 update appveyor.yml 2018-01-18 14:00:39 -07:00
clusterfack
9fbb0e6705 Fix Compile (#493)
Some conflicts in Acruid's PRs caused compile to be broken
2018-01-18 11:17:33 -07:00
clusterfack
d1e4a526c0 Adds some Location Getters (#492)
There's probably a million more I could add to be honest
2018-01-18 11:17:20 -07:00
clusterfack
ac38588a56 Updates some obsolete UI vars (#491)
Components is meant to be obsolete now, and anywhere its used are the primary cause of most current UI bugs. I removed one usage of it here.
2018-01-18 10:03:36 -07:00
clusterfack
8690c7a3f5 Updates content compatibility (#490)
Changes way content loads instead of using config, attempts content then loads sandbox instead
Fixes some compiler warnings
Adds a field needed for content player mob
2018-01-18 09:59:34 -07:00
Acruid
cfddef484c Embrace NetMessages (#488)
* Lidgren removed from Client.
ScreenBlocker control removed.

* Lidgren removed from server.
Lidgren removed from UnitTesting.
Lidgren only referenced in SS14.Shared.Network.

* Removed useless traffic debug printing.
Fix a bug with Keybinds being sent to server.

* NetMessages enum is finally gone :D

* Add warning for receiving NetMsgs without a registered callback.

* Moved some of the RegisterNetMessage calls out of BaseServer.
Added 'netaudit' concmd to list NetMsg callbacks on the server.

* Fixed exceptions, it works now.
LocalCoordinates.IsValidLocation() added.

* Moved all objects out of the SS14.Shared root namespace.
2018-01-18 09:58:46 -07:00
Acruid
e804fd3d2a Sprite Offset Property (#489)
Like
2018-01-18 09:55:23 -07:00
Acruid
976f8d7f76 Light Rendering and Masks (#487)
* Remove IoC self-referencing in MapManager.

* Added Circle to the math library.
Made LocalCoordinates equatable.
MapManager refactoring.
Light refactoring.

* Removed LightArea.

* GetEntities* functions now check mapIds.
PlacementManager does not place things in null space.
Prop Edit window "works" again.

* Lightmasks work.
2018-01-17 14:36:03 +01:00
Silver
2eb3f234ea Add Acruid to Code Reviewers 2018-01-15 11:17:09 -07:00
Acruid
785025f23c Sandbox Gamemode (#486)
* Adds skeleton Sandbox Content projects to the solution.

* Change BuildChecker output type to Class Library so that Resharper stops complaining about the project not having a Main() function.

* Added basic player event hooks to BaseServer.
Moved Server run level from PlayerManager to BaseServer.
Added concmds to switch between run levels on server.

* Forgot to commit project file.

* Entry points got changed a bit.

* You can now join a game without a map loaded on the server.

* Moved map loading to Content.

* Adds 'tp' command.

* Added 'addmap' command. Client crashes when used.

* Teleporting between maps works.

* Added GridId and MapId types.
Removed Test concmd, it was useless.
Misc formatting/cleanup.

* Tile placement kinda works.

* Added OnPlayerStatusChanged event.

* Server now auto starts the round.

* HandlePlayerStatusChanged works better now.

* Removed PlayerJoined* events from BaseServer, PlayerStatusChanged event does the same thing.

* Changed default platform of Sandbox from AnyCPU to x86.
Added "content.dllprefix" ConVar so that the config file can specify which content dll to load.
Changed LoadContentAssembly name argument to contain the entire name of the dll being searched for.

* SS14.Shared now copies Lidgren to the output directory.
More project configuration changes to remove the AnyCPU nonsense.
2018-01-15 11:03:50 -07:00
wixoaGit
29d2320ca3 Add timers. (#485)
* Add Timer and TimerManager.

* Register ITimerManager in the unit tests.

* Replace the event with an action.
2018-01-11 22:10:44 +01:00
Acruid
c992ee4d75 Added a Configuration Directory location to the Resource manager. (#484)
Renamed FindFiles to ContentFindFiles.
2018-01-04 09:08:47 +01:00
Acruid
6247ff4eff Console Rework (#483)
* Extracted the logic from DebugConsole into a new ClientConsole class.

* ClientConsole moved to IoC system.
Verb system replaced with concmds.

* Shared Cleanup

* ClientChatConsole skeleton.

* DebugConsole and LobbyChat are now both subscribed to ClientChatConsole.

* Removed server chat commands.

* cleaned up server command sysyem.

* More chat handling, and aliasing.

* Nightly work on Say command.

* Fixes a bug in Maths.Angle.

* Chat channel colors moved to ClientChatConsole.

* Now Server commands are sent without opening DebugConsole.

* Emotes work.
Clientside chat formatting works.

* Fixed angle unit test.
2018-01-04 00:53:41 +01:00
Acruid
1570ed1242 ClientSession/BaseClient Rework (#482)
* Added BaseClient.
Moved connecting system into BaseClient.

* Added ConnectFailed event to ClientNetManager.
BaseClient properly handles failed connection attempts.

* Session Rework

* Client now knows about other clients that are connected to the server.

* Reconnecting with the client works now.

* Allow Dupe IP.

* Shared PlayerManager shell.

* More session work.

* TWO PEOPLE CAN ACTUALLY CONNECT.

* Added some event functions to BaseClient.

* Basic multiplayer works again.

* Fixed MsgPlayerList buffer overrun.

* Lobby Updates.
Simplified MsgPlayerList, and cleaned up some networking.

* Cleaned up misc dead code.
Added DocComments to IBaseClient and BaseClient.

* Fixes spelling issues and adds more Doc Comments.
2017-12-21 15:30:44 +01:00
Decappi
cc970df3ad removed a bunch of vulnerabilities (#481)
* removed a bunch of vulnerabilities

* removed a bunch of vulnerabilities

* uncommented the code

* reverted .gitignore to its previous state

* fixed the compilation bug

* and again

* Switched to autoproperties everywhere where I could. There are still 3 unsolved vulnerabilities though.
Fixed some defaults not being set.

* Re-added the default value for BlendMode.
2017-12-16 19:08:24 +01:00
Pieter-Jan Briers
b1e3885bbb Fix lighting on MacOS. (#480)
* Fix lighting on MacOS.

* Make ReRender work outside GameScreen.
2017-11-27 08:27:23 -07:00
Pieter-Jan Briers
0f2ab942e1 Fix window resizing. (#479)
Fixes #475
2017-11-17 19:28:42 +01:00
Pieter-Jan Briers
e32e23de5a Fixes bugs with the entity spawn panel. (#477)
ImageButton respects ForegroundColor again, fixing the erase button
color.
ListBox fixed to not crash reliably.

Fixes #476
2017-11-14 10:02:56 -07:00
Pieter-Jan Briers
f1eaf8a268 Re-add GetComponent methods on IUserInterfaceManager. (#473)
* Re-add GetComponent methods on IUserInterfaceManager.

* Add TryGet methods too
2017-11-13 19:28:02 +01:00
Acruid
13d9eacbb7 Removes UiDev testing code from main menu. (#472) 2017-11-05 11:32:20 -08:00
Acruid
da3a865a0a UI Rework (#463)
* Screen now controls children.

* Input works.

* Transitions work.

* Removed IState.cs.

* More MainMenu.cs cleanup.

* Cleaned up options menu code.

* Simple Image now aligns properly.

* Alignment on the main menu works.

* YOU'RE NOT PERFECT

* Oh Boy ListBoxes.

* Screens actually get laid out properly.

* Big Options.

* Done fixing for tonight.

* More Cleaning!

* More cleanup, documentation and moving things to the base Control class.

* Migrating everything to use parent class properties.

* Lobby menu is looking good!

* More State cleanup.

* Give namespaces proper names.

* More namespace work.

* The chatbox position struggle is finally finished!

* Windows kinda work now.

* Scrollable Container work.

* OH GOD the listbox finally works.

* Ingame MainWindow works.

* Move spawn panels into CustomControls.

* TileSpawnPanel pretty much lays out.

* EntitySpawnWindow layout works.

* DebugConsole shows up, but contents do not display.

* Minor cleanup.

* Scrollbars work.

* Focus system should be working now.
Removed old code.

* Focus system should work as you expect now.
GameScreen now controls KeyBindingManager, so you can block movement keys with the UI.

* Text alignment fixed.
OptionsMenu background fixed.

* Mouseover UI scrolling works again.
Listbox dropdown now shrinks to fit contents.
Minor text alignment issues in Textbox fixed.

* Chatbox input alignment fixed.

* ListPanel is a thing now.

* ChatBox work.

* RichTextPanel now wraps lines.

* RTP cleanup.

* Fixes DebugConsole, Tabs, and Chatbox.
2017-11-05 13:04:49 +01:00
Acruid
5e17f2b08f Fixes opening client console crashing server. (#470) 2017-11-02 19:39:50 +01:00
Acruid
c05a0d4d29 Wraps missing member of SFML's Font and Glyph types. (#471)
Wraps SFML.Graphics.Glyph struct, and adds the rest of the SFML.Graphics.Font functions to the existing wrapper.
2017-11-02 11:21:28 -07:00
Pieter-Jan Briers
54aa6f94dd Adds an update event for the content repo. (#469)
* Adds an update event for the content repo.

* Remove debug output
2017-10-29 19:59:54 +01:00
Pieter-Jan Briers
8ce4376a60 Make engine content more clearly separated. (#468)
All prototypes inside the engine are now clearly marked and prefixed with `__engine_`. Also renames all prototypes to be snake_case, and added [engine] to their name.

Also, the content repo can now select which prototype to spawn for humans.
2017-10-29 19:59:46 +01:00
Pieter-Jan Briers
b342d128d2 Move rendering to a proper view matrix system. (#467)
* Some work making the camera less painful.

* More work.

* Ok Views work!
2017-10-29 19:57:46 +01:00
Pieter-Jan Briers
7d94019722 Optimize PlacementManager startup.
This used to take 4% of the startup time.
2017-10-29 19:55:13 +01:00
Pieter-Jan Briers
a9e65b46b8 Improve lighting performance. (#462) 2017-10-24 19:02:03 -06:00
Pieter-Jan Briers
96e3a66e5c Adds an occluder component. Fixes #440 (#461) 2017-10-24 15:15:39 -06:00
nullarmo
bf75212034 Closes #449 (#460) 2017-10-24 17:22:53 +02:00
Matt Smith
f49a106f04 Catch port in use exception (#457)
* Catch port in use exception

Fixes #454

* Improve messaging of port inuse error
2017-10-23 15:41:35 -06:00
Pieter-Jan Briers
37bb98b1f8 Fix setting IsHardCollidable: take 2 (#455)
* Fix UpdateIsHardCollidable.

Probably should've tested that beforehand.

Also optimized collidable removal extremely to not be O(n), by reworking the way they were stored inside the collision manager.

Seriously why would you use a dictionary as a dumb list of key/value pairs. WHY

* band-aid buggy client code

* better idea

* Apparently I forgot to remove this.
2017-10-22 23:47:03 +02:00
Pieter-Jan Briers
3461766659 Allow IsHardCollidable to be set during bump events. (#453) 2017-10-22 20:48:41 +02:00
Pieter-Jan Briers
2e28361a06 Enables bumping (#452) 2017-10-22 19:28:50 +02:00
Pieter-Jan Briers
824d757771 Adds bump event and IsHardCollidable setter (#450)
* Adds bump event and IsHardCollidable setter

* Make ishardcollidable default to true again.

* Fix compile, rename event.
2017-10-22 18:00:15 +02:00
Pieter-Jan Briers
8dc25ed24d Fix crash when disconnecting from server. (#447)
* Fix crash when disconnecting from server.

For some reason the game screen sets all sprites to have a null texture. This caused Sprite's Texture setter to nullref.

* Implement spritebatch.dispose, remove gaussianblur.dispose
2017-10-22 14:05:42 +02:00
Pieter-Jan Briers
d4dfb1abe5 Improves spritecomponent rendering performance. (#444) 2017-10-22 00:13:28 +02:00
Pieter-Jan Briers
bae3141481 Hopefully fix light manager. (#445)
* Hopefully fix light manager.

* Remove debug logging
2017-10-21 22:59:52 +02:00
Pieter-Jan Briers
8a7ea5b6f0 Improves debug mode perf & look (#443)
* Improves debug mode perf & look

Debug mode no langer tanks FPS by caching the used rectangle and text shapes. The LINQ removal probably helped too.

Sprite AABB debug has been removed since sprite AABBs aren't used anymore.

Implemented text shadowing, which is now used by the debug text to make it more readable.

Implemented collidable debug color from prototypes.

* Remove stray comma.
2017-10-21 19:35:21 +02:00
Pieter-Jan Briers
65d74f53e5 Adds an FPS counter. (#438)
It can be toggled by typing "fps" into the console.
2017-10-20 11:40:53 -06:00
Pieter-Jan Briers
3c1bc4ce88 Ok let's not do that fix just yet 2017-10-20 17:11:57 +02:00
Pieter-Jan Briers
a9d06e7612 Sonar code cleanup. 2017-10-20 17:00:19 +02:00
Pieter-Jan Briers
78d5965ba5 Woo late night compiler fighting! 2017-10-20 16:54:00 +02:00
Pieter-Jan Briers
d113938736 Encapsulate SFML to reside completely inside SS14.Client.Graphics. (#437)
* WiP of making SFML encapsulate by Client.Graphics.

* Up to like 40 files changed already!

* My hands are writing words.

* More work.

* Render states

* Client Graphics compiles

* More work

* C# compiler might be bugged

* C# compiler might be bugged

* Rust has ruined me

* It works!
2017-10-20 16:49:00 +02:00
Serkket
92e9d6636d Just a Mesely Sonar Cleanup (#436)
* TODO: Do all the TODOs

Just a sonar "clean up"

* Update1
2017-10-16 22:25:23 +02:00
Acruid
7fb7838738 Lighting Performace Changes (#435)
* Flips the lighting texture in the Shader instead of on the CPU.

* Clearing a RenderImage twice is pointless.
2017-10-13 22:23:23 +02:00
Pieter-Jan Briers
a3a2210de3 Map loading basics. (#434)
* Map loading basics.

Moves the entity saving system into a map loader kinda deal. Doesn't
save grids, but it's a start.

* Fix unit tests
2017-10-09 18:48:25 +02:00
Pieter-Jan Briers
e200cab1fb Box2i additions (#433)
Size property and casts to/from OpenTK.Box2.
2017-10-09 18:41:43 +02:00
Pieter-Jan Briers
92d8ed539a IServerTransformComponent improvements. (#431)
* IServerTransformComponent improvements.

IServerTransformComponent now more closely represents the API in TransformComponent, which was lacking because ITransformComponent is client-side, and the client cannot move entities itself, for example.

* Fix compile error
2017-10-01 22:27:36 -06:00
Pieter-Jan Briers
cb9ca3cc3c Fix network replication on WearableAnimatedSprite (#430) 2017-09-30 16:56:44 +02:00
Ash Walker
1065df5efd Fix string null check (#429) 2017-09-30 16:29:20 +02:00
Pieter-Jan Briers
20012304bd Make VS not modify the sln for buildchecker. (#428)
It was fixing the config because buildchecker had no hints to what the targets were.
2017-09-30 11:59:24 +02:00
Pieter-Jan Briers
349b366143 Fix transform parenting network replication. (#427) 2017-09-30 11:59:18 +02:00
Pieter-Jan Briers
64ea01a960 Crude system for allowing content to override the default mob. (#426)
The HumanMob_Content mob is spawned instead if it's defined.
2017-09-29 18:27:53 +02:00
Pieter-Jan Briers
1ebf093713 Allows creating other components inside Initialize(). (#425) 2017-09-26 23:08:53 +02:00
Pieter-Jan Briers
34fd263625 Fix content netserializer on server (#424)
It was not being included on the server, and type mismatches here are BAD.
2017-09-26 21:56:09 +02:00
Pieter-Jan Briers
a7a8d25a17 Disable type check temporarily. (#423)
It slows down development and has issues that need solving, like solutions to System.Type.
2017-09-26 20:28:44 +02:00
Pieter-Jan Briers
7bf3f70e92 Add more whitelisted types. (#422) 2017-09-25 20:53:15 +02:00
Pieter-Jan Briers
d37cdaf78c Fix sprites fetching transform in OnAdd instead of Initialize. (#421)
This caused a crash race condition.
2017-09-23 22:09:16 +02:00
Pieter-Jan Briers
a88a1ef72d Refactor and clean up containers. (#420)
* Refactor and clean up containers.

Containers are no longer arbitrarily bound to a single component, they use string IDs instead.

The API to interact with containers has been documented with doc comments.

Container creation now uses a static method.

Containers are sealed instead of abstract. Custom logic doesn't go on containers.

Theoretically fixed various bugs:
* Makes container manager creation work, previously it'd nullref.
* Containers being deleted now correctly detaches contained entities.

Still needs unit tests before being merged, because this code is still 100% untested.

* Lots of fixes, unit tests.
2017-09-17 21:43:14 -06:00
Pieter-Jan Briers
7484fe8fba Fix git_helper.py on Python 3.5 (#419)
* Fix git_helper.py on Python 3.5

* Fix it harder

* If at first you don't succeed.
2017-09-16 12:43:46 +02:00
Pieter-Jan Briers
d5fdd9be1f x64 unit test platform target. (#418) 2017-09-15 13:44:43 -06:00
clusterfack
1bb0227ff0 Makes Coordinates more Structy (#417)
More readonly-ish and less write-ish
2017-09-14 17:38:46 -05:00
Pieter-Jan Briers
4c2632710c Fix solution file. (#416)
I n S t A m E r G e
2017-09-14 15:13:59 -06:00
Pieter-Jan Briers
518a366c7e Attempt to fix Python on Travis being too old. (#415)
* Attempt to fix Python on Travis being too old.

* Fix RUN_THIS.py too.

* Fix CI builds blocking.

* Fix BuildChecker.csproj Python versioning in Travis.
2017-09-14 14:47:00 -06:00
clusterfack
07878ad7a7 Multiple Map System (#414)
* The million error march

This commit replaces many of the vector2's with their appropriate version of either LocalCoordinates, WorldCoordinates, or ScreenCoordinates

* Change transforms to send back worldcoordinates for position instead

* Adds coordinate class file

* What the fuck is going onnnnnn

* What the fuck is goign onnnnnnnnnnnn

* Changes some shit to use multiple maps instead
Fixes the compile errors in shared first

* Compile errors mostly fixed, about to rebase

* Merge branch 'master-wizfederation' into multiplemaps

# Conflicts:
#	SS14.Client.Graphics/CluwneLib.cs
#	SS14.Client/GameObjects/ClientEntityManager.cs
#	SS14.Client/GameObjects/Components/Renderable/AnimatedSpriteComponent.cs
#	SS14.Client/GameObjects/Components/Renderable/ItemSpriteComponent.cs
#	SS14.Client/GameObjects/Components/Renderable/ParticleSystemComponent.cs
#	SS14.Client/GameObjects/Components/Renderable/SpriteComponent.cs
#	SS14.Client/GameObjects/Components/Transform/TransformComponent.cs
#	SS14.Client/Interfaces/GameObjects/IClickTargetComponent.cs
#	SS14.Client/Placement/Modes/AlignSimilar.cs
#	SS14.Client/Placement/Modes/AlignSnapgridBorder.cs
#	SS14.Client/Placement/Modes/AlignSnapgridCenter.cs
#	SS14.Client/Placement/Modes/AlignTileAny.cs
#	SS14.Client/Placement/Modes/AlignTileEmpty.cs
#	SS14.Client/Placement/Modes/AlignTileNonSolid.cs
#	SS14.Client/Placement/Modes/AlignTileSolid.cs
#	SS14.Client/Placement/Modes/AlignWall.cs
#	SS14.Client/Placement/PlacementManager.cs
#	SS14.Server/GameObjects/ServerEntityManager.cs
#	SS14.Server/Interfaces/Player/IPlayerManager.cs
#	SS14.Server/Player/PlayerManager.cs

* Whops

* Compiles, loads somewhat, lights nonfunctional, many TODOs left

* serializes states, fixes incorrect spawn

* Fix map sending to the client

* Makes things only render on the correct zlevel

* Makes entity manager wait to intiialize shit after the maps arrive

* Fixes placement net messages

* Improves some of the placement managers, others need a bit of testing and tidying up again

* Transform fix

* Polishing, make coordinates into structs

* Remove resolved comments

* Last commit before master merge

* Fix the rest of the conflicts

* Fixes super spooky bug

* Fixes cross zlevel collisions

* Fix the rendering system to render the tile system regardless of grid location
2017-09-14 07:37:31 -06:00
Acruid
a483c8c88a Sprite Clicking Rework (#413)
* Fixed AnimatedSpriteComponent clicking, SpriteComponent is still bugged.

* Added Box2.Scale helper function.
Cleaned up the WasClicked function in AnimatedSpriteComponent.

* Renamed AABB to LocalAABB in ISpriteComponent and IRenderableComponent, so it is clearer what the property contains.
Fixed more bugs in AnimatedSpriteComponent.WasClicked(), and added exceptions.

* Fixed SpriteComponent.WasClicked().
Fixed unrelated bug in EntityManager, so entities can be properly deleted again.

* Fixed issue with sprite sorting using TextRect instead of LocalAABB.
2017-09-13 07:18:35 -06:00
Dumplin
cd74d12812 Fixed Movement; Edited OSX error message; Fixed some Sonar complaints (#410)
* * CluwneLib.cs: Make _window a local variable

* BaseCollection.cs: Formatting issue

* BaseServer.cs: Removed unused parameter

* ChatManager.cs: Made public encapsulated fields

* BoundKeyEventArgs.cs: Public encapsulated parameters

* CVarFlags.cs: Explicit variable setting

* ComponentFactory.cs: unused variable

* * CluwneLib.cs: Make _window a local variable

* BaseCollection.cs: Formatting issue

* BaseServer.cs: Removed unused parameter

* ChatManager.cs: Made public encapsulated fields

* BoundKeyEventArgs.cs: Public encapsulated parameters

* CVarFlags.cs: Explicit variable setting

* ComponentFactory.cs: unused variable

* CVar fixes

* Edited the OSX error message to be a little more helpful. (You have to edit the .dylibs because they come broken).

* Fixing the sprite movement problem

* Reverted error message

* Revert Again
2017-09-11 09:43:21 -06:00
Pieter-Jan Briers
eda5ad606b Make Sonar only run on master. (#409) 2017-09-06 22:59:30 -06:00
Pieter-Jan Briers
ddefef65ae Add our own Vector2 type. (#407)
* Add our own Vector2 type.

* Fix Clamp() typo.

* I shouldn't code when tired.

* Some unit tests.
2017-09-05 17:12:14 -06:00
Pieter-Jan Briers
062db741bd Update Mac Natives error message. (#406)
Now looks for 2.4 instead of 2.2 and suggests simply copying files instead of doing complicated InstallNameGuiTool stuff.
2017-09-05 17:11:21 -06:00
Pieter-Jan Briers
d46c2da175 Adds x64 platform targets. (#405)
Note that these won't work on Windows as that's still x86 SFML natives.
2017-09-02 21:51:08 -06:00
Acruid
1c6200666f Texture Loading Performance (#404)
* ~20% speed increase for loading textures.

* clickmap was useless, it is completely removed.
2017-09-01 14:39:40 -06:00
Acruid
c9666413b2 CluwneLib Static Variables Removal (#403)
* Changed Cluwnelib.TileSize name to CluwneLib.PixelsPerMeter. I think its more descriptive of what the name is.
Removed the splash screen debug #ifdef's, and replaced with proper ConditionalAttributes.

* Window encapsulated.

* Add the RELEASE compilation symbol to Release builds of all SS14 projects.

* More CluwneLib cleanup.
2017-09-01 14:39:27 -06:00
Pieter-Jan Briers
2575786a6e Allow deletion of entities and components during iteration. (#401)
* Allow deletion of entities and components during iteration.

* Remove some cases of _entities.Values
2017-09-01 14:07:00 -06:00
Acruid
149a6280b0 Move Lighting to SS14.Client.Graphics (#400)
* Interface to Interfaces.

* Lighting moved to SS14.Client.Graphics.

* Remove more dead code.
2017-08-31 08:21:14 -06:00
clusterfack
340d75c350 Fixes Bounding/Clicking Bugs (#396)
* Fixes Bounding/Clicking Bugs

This fixes a number of bugs with the clicking system.

- Wearable animated components were fixed so that they properly report their AABB
- Wearable animated components were fixed so that they properly use their nonwornsprite or wornsprite for checkclicking
- Fixes the clicking system only choosing the player character
- Fixes the eraser only working within a 1.5 tile range

* Uses FloatMath.CloseTo()
2017-08-29 12:03:09 -06:00
clusterfack
8d9a0e5142 Creates a Snap Checking System (#389)
* Creates a Snap Checking System

Creates a system that attempts to sanitize placement of objects when attempting to spawn them on snapping grids. This checks whether an object is trying to spawn specifically on a snap grid, and if it is checks against a snapflag of the type to see if other exclusive snappable objects are on that snap grid point.

Separates the spawnentityat into tryspawnentityat which checks for snappables, and forcespawnentityat which completely ignores that.

* Fixes the yaml placement
Fixes exemption from tryspawnentityat which didn't use the bool
Snap placement managers show when canspawnat is preventing them from spawning

* Improve snap placement managers again
Fix using prototype.name instead of prototype.ID

* Nope nope

* I need to unify these two types after the next refactor

* Move to strings for snap flags.

* Check

* 「s h i t c o d e」

* Gracias appveyor now I have seen the light

* Uses FloatMath.CloseTo() to check float equality
2017-08-29 12:01:44 -06:00
clusterfack
22f0cbd8f7 Changes CloseTo again slightly (#399) 2017-08-29 07:33:17 -06:00
clusterfack
5d443b6452 Adds closeto function for checking floating point equality (#398) 2017-08-28 18:28:33 -06:00
Acruid
83f8f37dc1 Prototypes now use ResourceManager. (#394)
* "./Resources/" folder is now mounted instead of "./" in the ResourceManager.
Prototypes now use the ResourceManager.
Added FindFiles(string path) to recursively find files in the ResourceManager.
General FileHelper bug fixing and cleanup.

* Ran SS14.Shared/ContentPack* through the code cleanup again.

* Put PJB's comma back in.
2017-08-28 17:10:15 -06:00
UristMcDorf
cc886ab614 Add required registrations in whitelist for temperature, damageable, destructible. (#393) 2017-08-28 14:21:30 +02:00
clusterfack
4273266950 Adds rendering color parameter to sprite components (#388)
* Adds rendering color parameter to sprite components

* Forgot to remove this

* Sets default value to white

* Like this you mean?
2017-08-27 10:02:11 -06:00
Acruid
658a0aee7f Entity Component Shutdown Fix. (#387)
Moved various component cleanup code from OnRemove to Shutdown.
2017-08-27 09:58:04 -06:00
Acruid
9898c2cf49 Turns INetSerializableType into NetSerializableAttribute (#386)
Turns INetSerializableType into NetSerializableAttribute.
2017-08-26 22:16:27 -06:00
Acruid
ddb5d9f3a8 NetGrapher Cleanup (#385)
Fixed bug in NetManager.
2017-08-26 22:15:36 -06:00
clusterfack
f227b3abc0 Adds grid to snap grid placement manager (#384)
* Adds grid to snap grid placement manager
Fixes drawline

* Done
2017-08-26 19:21:02 +02:00
Acruid
3920da2d9f Fixes moonwalk bug and inverted up/down controls. (#380) 2017-08-26 19:20:56 +02:00
clusterfack
bfbb31aa58 Snapgrid placement (#377)
* Snapgrid placement

* REEEEEEEEEEEE world space
2017-08-26 09:33:41 +02:00
clusterfack
799be40018 Fixes scrollable containers (#381) 2017-08-26 09:33:33 +02:00
wixoaGit
152eb8dd19 Ignore outdated state update messages (#383) 2017-08-26 09:33:23 +02:00
wixoaGit
c168c0fde1 Move client GameState management (#375)
* Move client GameState management

* Remove unnecessary sequence sending

* Move resolves to dependencies, set CurrentState instead of finding it
2017-08-25 21:21:14 +02:00
clusterfack
af3c90e2a8 Removes bad shutdown (#376)
* Undoes this

* Move it to the entity manager shutdown
2017-08-25 21:20:32 +02:00
clusterfack
12e6ef88c3 Makes Walls Entities, removes tile walls (#373)
* Makes walls into entities

* Fix the align tile empty placement mode, holy shit collision bounds is fucked

* Make shadowcasting from walls work again

* Fix lights on tiles
2017-08-24 09:38:28 -06:00
clusterfack
28d74cec56 Shifts down the mobs bounding box by 0.6 tiles. (#374) 2017-08-24 14:40:28 +02:00
Pieter-Jan Briers
02efd0b41a Made the git hooks history tolerant. (#372)
If its python file doesn't exist the hooks don't run.
2017-08-23 17:13:43 -05:00
Pieter-Jan Briers
5bf337479f Fix UnknowPrototypeException typo. (#371) 2017-08-23 16:02:36 -05:00
clusterfack
3816cdb3e4 Tiles Helper Functions (#370)
* Creates a helper function for making tile indices into tile refs, and a function to get a tileref one step in any particular direction of another tileref.

* Gottem

* k
2017-08-23 11:08:42 +02:00
Pieter-Jan Briers
e54339bb5c Make null data nodes on prototypes not call LoadData() on spawned entities. (#368) 2017-08-23 07:53:31 +02:00
Pieter-Jan Briers
98d867393c Update NUnit package version. (#367)
* Update NUnit package version.

* Let's not have Travis blow up.

* And I still messed the HintPath up.
2017-08-23 07:53:16 +02:00
Pieter-Jan Briers
8dd9a3c097 Content prefixes for the reflection manager. (#369)
Allows doing class: Prototypes.DiscoBall instead of Content.Client.Prototypes.DiscoBall
2017-08-23 07:53:04 +02:00
Pieter-Jan Briers
61d30be6b3 Lighting API cleanup. (#366) 2017-08-22 07:59:13 -06:00
Pieter-Jan Briers
7aa85c0b0c ColorUtils extensions, fixes and tests. (#365)
* Color4 extensions for byte color parts, fix WithAlpha with byte.

* Unit tests and bug fix for FromHex.
2017-08-22 07:38:29 -06:00
Pieter-Jan Briers
3574395843 Fix the entity spawn panel throwing NotImplementedException, Color -> Color4 (#364)
* Fix the entity spawn panel throwing NotImplementedException.

* More rabbit hole Color conversions.
2017-08-22 07:37:04 -06:00
Pieter-Jan Briers
13b333dcf6 Fix entity initialization. (#363) 2017-08-21 15:37:04 -06:00
Pieter-Jan Briers
bead08fc7c Fix prototype class inheritance. (#362) 2017-08-21 15:36:34 -06:00
Pieter-Jan Briers
073fb20b66 Adds a per-frame virtual entity update method. (#361) 2017-08-20 19:39:42 -06:00
Pieter-Jan Briers
7adca8280c Remove some IComponent type bounds, component shutdown event. (#360)
* Remove some IComponent type bounds, component shutdown event.

Methods like GetComponent<T> don't require T to implement IComponent anymore.

Added an event to IComponent that is invoked whenever the component is shut down.

* Always at least compile your stuff kids.
2017-08-20 19:38:20 -06:00
Gilles Coremans
61183eaba3 Fixes a sonar bug. (#359) 2017-08-20 19:37:08 -06:00
wixoaGit
477b0460e8 Implement MsgEntity (#358)
* Implement MsgEntity

* Move MsgEntity registration to GameController

* Fix serializer usage
2017-08-20 19:36:33 -06:00
Pieter-Jan Briers
dd18105c92 Remove SFML from shared and server. (#355)
* Remove SFML from shared and server.

* Fix unit tests.
2017-08-20 11:07:35 -06:00
Silver
585f2467c2 Update Linux Readme (#357) 2017-08-19 23:13:12 -06:00
Pieter-Jan Briers
0c3e4ea495 Allows inputting the server port on the client. (#354) 2017-08-19 20:19:00 -06:00
Pieter-Jan Briers
afe0c95cea Fix a race condition in collidablecomponent.OnAdd (#353) 2017-08-19 20:17:11 -06:00
PJB3005
e84f072278 Update submodule to hopefully disable SFML Sonar. 2017-08-19 13:55:31 +02:00
PJB3005
ca0bbab8c0 Attempt two. 2017-08-19 13:43:46 +02:00
PJB3005
6530b8806c Attempt to ignore SFML on Sonar 2017-08-19 13:35:57 +02:00
Pieter-Jan Briers
294057e3a1 Fix resource copying on the client. (#352) 2017-08-19 11:10:55 +02:00
Pieter-Jan Briers
a57abb2ca7 Move to our own SFML.NET fork with a submodule. (#351)
* Remove SFML binaries in repo.

* Add SFML.NET submodule from our fork.

* Get build checker for submodule handling.

* Fix project references. Remove SFML from non-client.

* Make it work!

* Automatically fetch Windows CSFML natives.

* Fix project file now I'm done debugging.

* Fix project references.

* Fix CI

* Now if only I didn't typo...

* Fix Travis too

* Fix lighting.

* Move shaders over to new API.

* Fix some obsoletions.

* Improve SetUniformArray casts
2017-08-19 10:28:39 +02:00
1623 changed files with 105332 additions and 57430 deletions

View File

@@ -9,20 +9,44 @@ version: 0.1.0.{build}
pull_requests:
do_not_increment_build_number: true
image: Visual Studio 2017
clone_depth: 10
image: Visual Studio 2019
install:
- ps: if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) { cinst msbuild-sonarqube-runner }
- ps: >
if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER -And $env:APPVEYOR_REPO_BRANCH -Eq "master")
{
cinst msbuild-sonarqube-runner;
}
before_build:
- cmd: py -3.5 Resources\buildResourcePack.py --resources-dir .\Resources --out .\Resources\ResourcePack.zip --atlas-tool .\Tools\AtlasTool.exe --no-animations --to-stderr
- cmd: nuget restore SpaceStation14.sln
- ps: if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) { MSBuild.SonarQube.Runner.exe begin /k:"ss14" /d:"sonar.host.url=https://sonarqube.com" /d:"sonar.login=$env:sonarqubekey" /d:"sonar.organization=space-wizards" }
- cmd: py -3.5 -m pip install --user requests
- cmd: py -3.5 RUN_THIS.py --no-prompt
- ps: >
if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER -And $env:APPVEYOR_REPO_BRANCH -Eq "master")
{
SonarScanner.MSBuild.exe begin /k:"ss14" /d:"sonar.host.url=https://sonarcloud.io" /d:"sonar.login=$env:sonarqubekey" /o:"space-wizards" /d:sonar.cs.nunit.reportsPaths="$(Get-Location)\nunitTestResult.xml";
}
platform: x64
configuration: Debug
cache:
- packages -> **\*.csproj
- Dependencies
build:
project: SpaceStation14.sln
parallel: true
project: RobustToolbox.sln
parallel: false
verbosity: minimal
after_build:
- ps: if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) { MSBuild.SonarQube.Runner.exe end /d:"sonar.login=$env:sonarqubekey" }
build_script:
- ps: dotnet build RobustToolbox.sln /p:AppVeyor=yes
test_script:
- ps: dotnet test Robust.UnitTesting/Robust.UnitTesting.csproj
after_test:
- ps: >
if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER -And $env:APPVEYOR_REPO_BRANCH -Eq "master")
{
SonarScanner.MSBuild.exe end /d:"sonar.login=$env:sonarqubekey";
}

View File

@@ -9,3 +9,6 @@ charset = utf-8-bom
[*.{csproj,xml,yml,dll.config,targets}]
indent_size = 2
[*.gdsl]
indent_style = tab

2
.github/CODEOWNERS vendored
View File

@@ -3,7 +3,7 @@
# These owners will be the default owners for everything in the repo.
# * @defunkt
* @PJB3005 @Silvertorch5
* @Acruid @PJB3005 @Silvertorch5
# Order is important. The last matching pattern has the most precedence.
# So if a pull request only touches javascript files, only these owners

14
.gitignore vendored
View File

@@ -71,6 +71,9 @@ project.lock.json
# MacOS finder makes these.
.DS_Store
# KDE Dolphin makes these, maybe it's even XDG standard, kinda hard to Google.
# I do know it doesn't make them by merely opening the directory like some other file manager *cough* *cough*
.directory
# Created by NUnit.
TestResult.xml
@@ -79,3 +82,14 @@ NetSerializerDebug.dll
# We're not gonna ship Mac extlibs with the repo due to size. (11 MB)
Third-Party/extlibs/Mac/
# Or the automatically-fetched Windows natives, for that matter.
Third-Party/extlibs/Windows/
# Actually I'll make this folder because SS14.Shared.Bsdiff isn't third-party is it?
Dependencies/
# Python stuff
__pycache__
.mypy_cache
MSBuild/Robust.Custom.targets

View File

@@ -2,20 +2,42 @@ language: csharp
dist: trusty
sudo: false
mono: none
# dotnet: 3.1.100 # Travis is shitting itself right now and it can't locate .NET Core packages.
os:
- linux
- osx
#- osx
before_install:
- if [ $TRAVIS_OS_NAME = osx ]; then brew update && brew install python3; fi
addons:
apt:
#sources:
#- deadsnakes
packages:
- python3.5
- python3-pip
cache:
directories:
- packages/
- Dependencies/
- Robust.Client.Godot/.mono/assemblies/
install:
- curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 3.1.100
#before_install:
# - if [ $TRAVIS_OS_NAME = osx ]; then brew update && brew upgrade python; fi
before_script:
- "nuget restore SpaceStation14.sln"
#- "pyenv versions"
#- "if [ $TRAVIS_OS_NAME = linux ]; then pyenv shell 3.6; fi"
#- "python3.6 -m pip --v"
#- "python3.6 -m pip install --user --upgrade requests"
- "python3.5 -m pip install --user requests"
- "python3.5 RUN_THIS.py --no-prompt"
script:
- "python3 ./Resources/buildResourcePack.py --resources-dir ./Resources --out ./Resources/ResourcePack.zip --no-atlas --no-animations --to-stderr"
- "msbuild /p:Configuration=Release /p:HEADLESS=1 /nologo /m /p:AllowMissingMacNatives=yes SpaceStation14.sln"
- "cd packages/NUnit.ConsoleRunner.3.6.1/tools"
- "mono --debug nunit3-console.exe ../../../bin/UnitTesting/SS14.UnitTesting.dll"
- "Tools/run_travis.sh"

1
BuildChecker/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
INSTALLED_HOOKS_VERSION

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This is a dummy .csproj file to check things like submodules.
Better this than other errors.
If you want to create this kind of file yourself, you have to create an empty .NET application,
Then strip it of everything until you have the <Project> tags.
VS refuses to load the project if you make a bare project file and use Add -> Existing Project... for some reason.
You want to handle the Build, Clean and Rebuild tasks to prevent missing task errors on build.
If you want to learn more about these kinds of things, check out Microsoft's official documentation about MSBuild:
https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild
-->
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Choose>
<When Condition="'$(Python)' == ''">
<PropertyGroup>
<Python>python3</Python>
<Python Condition="'$(OS)'=='Windows_NT' Or '$(OS)'=='Windows'">py -3</Python>
</PropertyGroup>
</When>
</Choose>
<PropertyGroup>
<ProjectGuid>{D0DA124B-5580-4345-A02B-9F051F78915F}</ProjectGuid>
<OutputType>Library</OutputType>
<TargetFrameworkMoniker>.NETFramework, Version=v4.6.1</TargetFrameworkMoniker>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' " />
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<Target Name="Build">
<Exec Command="$(Python) git_helper.py" CustomErrorRegularExpression="^Error" />
</Target>
<Target Name="Rebuild" DependsOnTargets="Build" />
<Target Name="Clean">
<Message Importance="low" Text="Ignoring 'Clean' target." />
</Target>
<Target Name="Compile" />
<Target Name="CoreCompile" />
</Project>

105
BuildChecker/git_helper.py Executable file
View File

@@ -0,0 +1,105 @@
#!/usr/bin/env python3
# Installs git hooks, updates them, updates submodules, that kind of thing.
import subprocess
import sys
import os
import shutil
from pathlib import Path
from typing import List
BUILD_CHECKER_PATH = Path(Path(__file__).resolve().parent)
SS14_ROOT_PATH = Path(BUILD_CHECKER_PATH.parent)
SOLUTION_PATH = Path(SS14_ROOT_PATH/"SpaceStation14.sln")
CURRENT_HOOKS_VERSION = "2" # If this doesn't match the saved version we overwrite them all.
QUIET = "--quiet" in sys.argv
NO_HOOKS = "--nohooks" in sys.argv
def run_command(command: List[str], capture: bool = False) -> subprocess.CompletedProcess:
"""
Runs a command with pretty output.
"""
text = ' '.join(command)
if not QUIET:
print("$ {}".format(text))
sys.stdout.flush()
completed = None
if capture:
completed = subprocess.run(command, cwd=str(SS14_ROOT_PATH), stdout=subprocess.PIPE)
else:
completed = subprocess.run(command, cwd=str(SS14_ROOT_PATH))
if completed.returncode != 0:
raise RuntimeError("Error: command exited with code {}!".format(completed.returncode))
return completed
def update_submodules():
"""
Updates all submodules.
"""
status = run_command(["git", "submodule", "update", "--init", "--recursive"], capture=True)
if status.stdout.decode().strip():
print("Git submodules changed. Reloading solution.")
reset_solution()
def install_hooks():
"""
Installs the necessary git hooks into .git/hooks.
"""
# Read version file.
hooks_version_file = BUILD_CHECKER_PATH/"INSTALLED_HOOKS_VERSION"
if os.path.isfile(str(hooks_version_file)):
with open(str(hooks_version_file), "r") as f:
if f.read() == CURRENT_HOOKS_VERSION:
if not QUIET:
print("No hooks change detected.")
return
with open(str(hooks_version_file), "w") as f:
f.write(CURRENT_HOOKS_VERSION)
print("Hooks need updating.")
hooks_target_dir = SS14_ROOT_PATH/".git"/"hooks"
hooks_source_dir = BUILD_CHECKER_PATH/"hooks"
if not os.path.exists(str(hooks_target_dir)):
os.makedirs(str(hooks_target_dir))
# Clear entire tree since we need to kill deleted files too.
for filename in os.listdir(str(hooks_target_dir)):
os.remove(str(hooks_target_dir/filename))
for filename in os.listdir(str(hooks_source_dir)):
print("Copying hook {}".format(filename))
shutil.copy2(str(hooks_source_dir/filename), str(hooks_target_dir/filename))
def reset_solution():
"""
Force VS to think the solution has been changed to prompt the user to reload it,
thus fixing any load errors.
"""
with SOLUTION_PATH.open("r") as f:
content = f.read()
with SOLUTION_PATH.open("w") as f:
f.write(content)
def main():
if not NO_HOOKS:
install_hooks()
update_submodules()
if __name__ == '__main__':
main()

View File

@@ -0,0 +1,19 @@
#!/bin/bash
gitroot=`git rev-parse --show-toplevel`
cd "$gitroot/BuildChecker"
if [ -f "git_helper.py" ]
then
if [[ `uname` == MINGW* || `uname` == CYGWIN* ]]; then
# Windows
# Can't update hooks from here because we are a hook,
# and the file is read only while it's used.
# Thanks Windows.
py -3 git_helper.py --quiet --nohooks
else
# Not Windows, so probably some other Unix thing.
python3 git_helper.py --quiet
fi
fi

View File

@@ -0,0 +1,5 @@
#!/bin/bash
# Just call post-checkout since it does the same thing.
gitroot=`git rev-parse --show-toplevel`
bash "$gitroot/.git/hooks/post-checkout"

19
LICENSE-MIT.TXT Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2019 Space Station 14 Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,77 +0,0 @@
using System;
using System.IO;
using System.Security.Cryptography;
namespace Lidgren.Network
{
public abstract class NetCryptoProviderBase : NetEncryption
{
protected SymmetricAlgorithm m_algorithm;
public NetCryptoProviderBase(NetPeer peer, SymmetricAlgorithm algo)
: base(peer)
{
m_algorithm = algo;
m_algorithm.GenerateKey();
m_algorithm.GenerateIV();
}
public override void SetKey(byte[] data, int offset, int count)
{
int len = m_algorithm.Key.Length;
var key = new byte[len];
for (int i = 0; i < len; i++)
key[i] = data[offset + (i % count)];
m_algorithm.Key = key;
len = m_algorithm.IV.Length;
key = new byte[len];
for (int i = 0; i < len; i++)
key[len - 1 - i] = data[offset + (i % count)];
m_algorithm.IV = key;
}
public override bool Encrypt(NetOutgoingMessage msg)
{
int unEncLenBits = msg.LengthBits;
var ms = new MemoryStream();
var cs = new CryptoStream(ms, m_algorithm.CreateEncryptor(), CryptoStreamMode.Write);
cs.Write(msg.m_data, 0, msg.LengthBytes);
cs.Close();
// get results
var arr = ms.ToArray();
ms.Close();
msg.EnsureBufferSize((arr.Length + 4) * 8);
msg.LengthBits = 0; // reset write pointer
msg.Write((uint)unEncLenBits);
msg.Write(arr);
msg.LengthBits = (arr.Length + 4) * 8;
return true;
}
public override bool Decrypt(NetIncomingMessage msg)
{
int unEncLenBits = (int)msg.ReadUInt32();
var ms = new MemoryStream(msg.m_data, 4, msg.LengthBytes - 4);
var cs = new CryptoStream(ms, m_algorithm.CreateDecryptor(), CryptoStreamMode.Read);
var byteLen = NetUtility.BytesToHoldBits(unEncLenBits);
var result = m_peer.GetStorage(byteLen);
cs.Read(result, 0, byteLen);
cs.Close();
// TODO: recycle existing msg
msg.m_data = result;
msg.m_bitLength = unEncLenBits;
msg.m_readPosition = 0;
return true;
}
}
}

View File

@@ -1,59 +0,0 @@
using System;
using System.IO;
using System.Security.Cryptography;
namespace Lidgren.Network
{
public abstract class NetCryptoProviderEncryption : NetEncryption
{
public NetCryptoProviderEncryption(NetPeer peer)
: base(peer)
{
}
protected abstract CryptoStream GetEncryptStream(MemoryStream ms);
protected abstract CryptoStream GetDecryptStream(MemoryStream ms);
public override bool Encrypt(NetOutgoingMessage msg)
{
int unEncLenBits = msg.LengthBits;
var ms = new MemoryStream();
var cs = GetEncryptStream(ms);
cs.Write(msg.m_data, 0, msg.LengthBytes);
cs.Close();
// get results
var arr = ms.ToArray();
ms.Close();
msg.EnsureBufferSize((arr.Length + 4) * 8);
msg.LengthBits = 0; // reset write pointer
msg.Write((uint)unEncLenBits);
msg.Write(arr);
msg.LengthBits = (arr.Length + 4) * 8;
return true;
}
public override bool Decrypt(NetIncomingMessage msg)
{
int unEncLenBits = (int)msg.ReadUInt32();
var ms = new MemoryStream(msg.m_data, 4, msg.LengthBytes - 4);
var cs = GetDecryptStream(ms);
var result = m_peer.GetStorage(unEncLenBits);
cs.Read(result, 0, NetUtility.BytesToHoldBits(unEncLenBits));
cs.Close();
// TODO: recycle existing msg
msg.m_data = result;
msg.m_bitLength = unEncLenBits;
return true;
}
}
}

View File

@@ -1,295 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>12.0.31101.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{59250BAF-0000-0000-0000-000000000000}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>Lidgren.Network</AssemblyName>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<OutputType>Library</OutputType>
<AppDesignerFolder>
</AppDesignerFolder>
<RootNamespace>Lidgren.Network</RootNamespace>
<StartupObject>
</StartupObject>
<StartArguments>
</StartArguments>
<FileUpgradeFlags>
</FileUpgradeFlags>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize>
<OutputPath>$(SolutionDir)bin\Lidgren\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoStdLib>False</NoStdLib>
<NoWarn>
</NoWarn>
<PlatformTarget>x86</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>False</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize>
<OutputPath>$(SolutionDir)bin\Lidgren\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<NoStdLib>False</NoStdLib>
<NoWarn>
</NoWarn>
<PlatformTarget>x86</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp">
<Name>Microsoft.CSharp</Name>
<Private>False</Private>
</Reference>
<Reference Include="System">
<Name>System</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Core">
<Name>System.Core</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml">
<Name>System.Xml</Name>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
<Compile Include="Encryption\INetEncryption.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Encryption\NetAESEncryption.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Encryption\NetBlockEncryptionBase.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Encryption\NetXteaEncryption.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NamespaceDoc.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetBigInteger.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetBitVector.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetBitWriter.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetBuffer.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetBuffer.Peek.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetBuffer.Read.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetBuffer.Read.Reflection.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetBuffer.Write.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetBuffer.Write.Reflection.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetClient.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetConnection.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetConnection.Handshake.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetConnection.Latency.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetConnection.MTU.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetConnectionStatistics.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetConnectionStatus.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetConstants.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetDeliveryMethod.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetException.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetFragmentationHelper.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetIncomingMessage.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetIncomingMessageType.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetMessageType.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetNatIntroduction.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetOutgoingMessage.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetPeer.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetPeer.Discovery.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetPeer.Fragmentation.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetPeer.Internal.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetPeer.LatencySimulation.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetPeer.Logging.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetPeer.MessagePools.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetPeer.Send.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetPeerConfiguration.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetPeerStatistics.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetPeerStatus.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetQueue.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetRandom.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetReceiverChannelBase.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetReliableOrderedReceiver.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetReliableSenderChannel.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetReliableSequencedReceiver.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetReliableUnorderedReceiver.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetSenderChannelBase.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetSendResult.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetServer.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetSRP.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetStoredReliableMessage.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetTime.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetTuple.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetUnreliableSenderChannel.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetUnreliableSequencedReceiver.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetUnreliableUnorderedReceiver.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetUPnP.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="NetUtility.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="SenderChannelBase.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>false</IsPackable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Configurations>Debug;Release</Configurations>
<Platforms>AnyCPU</Platforms>
<SonarQubeExclude>true</SonarQubeExclude>
</PropertyGroup>
</Project>

View File

@@ -130,7 +130,7 @@ namespace Lidgren.Network
om.Write(now);
WriteLocalHail(om);
m_peer.SendLibrary(om, m_remoteEndPoint);
m_connectRequested = false;
@@ -285,7 +285,7 @@ namespace Lidgren.Network
}
else
{
m_remoteHailMessage = null;
m_remoteHailMessage = null;
}
if (m_peerConfiguration.IsMessageTypeEnabled(NetIncomingMessageType.ConnectionApproval))
@@ -376,7 +376,7 @@ namespace Lidgren.Network
break;
case NetConnectionStatus.RespondedConnect:
// awesome
NetIncomingMessage msg = m_peer.SetupReadHelperMessage(ptr, payloadLength);
InitializeRemoteTimeOffset(msg.ReadSingle());
@@ -453,7 +453,7 @@ namespace Lidgren.Network
}
return true;
}
/// <summary>
/// Disconnect from the remote peer
/// </summary>

View File

@@ -1,314 +0,0 @@
/* Copyright (c) 2010 Michael Lidgren
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System;
using System.Diagnostics;
using System.Net;
namespace Lidgren.Network
{
public partial class NetIncomingMessage
{
/// <summary>
/// Returns the internal data buffer, don't modify
/// </summary>
public byte[] PeekDataBuffer()
{
return m_data;
}
//
// 1 bit
//
/// <summary>
/// Reads a 1-bit Boolean without advancing the read pointer
/// </summary>
public bool PeekBoolean()
{
NetException.Assert(m_bitLength - m_readPosition >= 1, c_readOverflowError);
byte retval = NetBitWriter.ReadByte(m_data, 1, m_readPosition);
return (retval > 0 ? true : false);
}
//
// 8 bit
//
/// <summary>
/// Reads a Byte without advancing the read pointer
/// </summary>
public byte PeekByte()
{
NetException.Assert(m_bitLength - m_readPosition >= 8, c_readOverflowError);
byte retval = NetBitWriter.ReadByte(m_data, 8, m_readPosition);
return retval;
}
/// <summary>
/// Reads an SByte without advancing the read pointer
/// </summary>
[CLSCompliant(false)]
public sbyte PeekSByte()
{
NetException.Assert(m_bitLength - m_readPosition >= 8, c_readOverflowError);
byte retval = NetBitWriter.ReadByte(m_data, 8, m_readPosition);
return (sbyte)retval;
}
/// <summary>
/// Reads the specified number of bits into a Byte without advancing the read pointer
/// </summary>
public byte PeekByte(int numberOfBits)
{
byte retval = NetBitWriter.ReadByte(m_data, numberOfBits, m_readPosition);
return retval;
}
/// <summary>
/// Reads the specified number of bytes without advancing the read pointer
/// </summary>
public byte[] PeekBytes(int numberOfBytes)
{
NetException.Assert(m_bitLength - m_readPosition >= (numberOfBytes * 8), c_readOverflowError);
byte[] retval = new byte[numberOfBytes];
NetBitWriter.ReadBytes(m_data, numberOfBytes, m_readPosition, retval, 0);
return retval;
}
/// <summary>
/// Reads the specified number of bytes without advancing the read pointer
/// </summary>
public void PeekBytes(byte[] into, int offset, int numberOfBytes)
{
NetException.Assert(m_bitLength - m_readPosition >= (numberOfBytes * 8), c_readOverflowError);
NetException.Assert(offset + numberOfBytes <= into.Length);
NetBitWriter.ReadBytes(m_data, numberOfBytes, m_readPosition, into, offset);
return;
}
//
// 16 bit
//
/// <summary>
/// Reads an Int16 without advancing the read pointer
/// </summary>
public Int16 PeekInt16()
{
NetException.Assert(m_bitLength - m_readPosition >= 16, c_readOverflowError);
uint retval = NetBitWriter.ReadUInt32(m_data, 16, m_readPosition);
return (short)retval;
}
/// <summary>
/// Reads a UInt16 without advancing the read pointer
/// </summary>
[CLSCompliant(false)]
public UInt16 PeekUInt16()
{
NetException.Assert(m_bitLength - m_readPosition >= 16, c_readOverflowError);
uint retval = NetBitWriter.ReadUInt32(m_data, 16, m_readPosition);
return (ushort)retval;
}
//
// 32 bit
//
/// <summary>
/// Reads an Int32 without advancing the read pointer
/// </summary>
public Int32 PeekInt32()
{
NetException.Assert(m_bitLength - m_readPosition >= 32, c_readOverflowError);
uint retval = NetBitWriter.ReadUInt32(m_data, 32, m_readPosition);
return (Int32)retval;
}
/// <summary>
/// Reads the specified number of bits into an Int32 without advancing the read pointer
/// </summary>
public Int32 PeekInt32(int numberOfBits)
{
NetException.Assert((numberOfBits > 0 && numberOfBits <= 32), "ReadInt() can only read between 1 and 32 bits");
NetException.Assert(m_bitLength - m_readPosition >= numberOfBits, c_readOverflowError);
uint retval = NetBitWriter.ReadUInt32(m_data, numberOfBits, m_readPosition);
if (numberOfBits == 32)
return (int)retval;
int signBit = 1 << (numberOfBits - 1);
if ((retval & signBit) == 0)
return (int)retval; // positive
// negative
unchecked
{
uint mask = ((uint)-1) >> (33 - numberOfBits);
uint tmp = (retval & mask) + 1;
return -((int)tmp);
}
}
/// <summary>
/// Reads a UInt32 without advancing the read pointer
/// </summary>
[CLSCompliant(false)]
public UInt32 PeekUInt32()
{
NetException.Assert(m_bitLength - m_readPosition >= 32, c_readOverflowError);
uint retval = NetBitWriter.ReadUInt32(m_data, 32, m_readPosition);
return retval;
}
/// <summary>
/// Reads the specified number of bits into a UInt32 without advancing the read pointer
/// </summary>
[CLSCompliant(false)]
public UInt32 PeekUInt32(int numberOfBits)
{
NetException.Assert((numberOfBits > 0 && numberOfBits <= 32), "ReadUInt() can only read between 1 and 32 bits");
//NetException.Assert(m_bitLength - m_readBitPtr >= numberOfBits, "tried to read past buffer size");
UInt32 retval = NetBitWriter.ReadUInt32(m_data, numberOfBits, m_readPosition);
return retval;
}
//
// 64 bit
//
/// <summary>
/// Reads a UInt64 without advancing the read pointer
/// </summary>
[CLSCompliant(false)]
public UInt64 PeekUInt64()
{
NetException.Assert(m_bitLength - m_readPosition >= 64, c_readOverflowError);
ulong low = NetBitWriter.ReadUInt32(m_data, 32, m_readPosition);
ulong high = NetBitWriter.ReadUInt32(m_data, 32, m_readPosition + 32);
ulong retval = low + (high << 32);
return retval;
}
/// <summary>
/// Reads an Int64 without advancing the read pointer
/// </summary>
public Int64 PeekInt64()
{
NetException.Assert(m_bitLength - m_readPosition >= 64, c_readOverflowError);
unchecked
{
ulong retval = PeekUInt64();
long longRetval = (long)retval;
return longRetval;
}
}
/// <summary>
/// Reads the specified number of bits into an UInt64 without advancing the read pointer
/// </summary>
[CLSCompliant(false)]
public UInt64 PeekUInt64(int numberOfBits)
{
NetException.Assert((numberOfBits > 0 && numberOfBits <= 64), "ReadUInt() can only read between 1 and 64 bits");
NetException.Assert(m_bitLength - m_readPosition >= numberOfBits, c_readOverflowError);
ulong retval;
if (numberOfBits <= 32)
{
retval = (ulong)NetBitWriter.ReadUInt32(m_data, numberOfBits, m_readPosition);
}
else
{
retval = NetBitWriter.ReadUInt32(m_data, 32, m_readPosition);
retval |= NetBitWriter.ReadUInt32(m_data, numberOfBits - 32, m_readPosition) << 32;
}
return retval;
}
/// <summary>
/// Reads the specified number of bits into an Int64 without advancing the read pointer
/// </summary>
public Int64 PeekInt64(int numberOfBits)
{
NetException.Assert(((numberOfBits > 0) && (numberOfBits < 65)), "ReadInt64(bits) can only read between 1 and 64 bits");
return (long)PeekUInt64(numberOfBits);
}
//
// Floating point
//
/// <summary>
/// Reads a 32-bit Single without advancing the read pointer
/// </summary>
public float PeekFloat()
{
return PeekSingle();
}
/// <summary>
/// Reads a 32-bit Single without advancing the read pointer
/// </summary>
public float PeekSingle()
{
NetException.Assert(m_bitLength - m_readPosition >= 32, c_readOverflowError);
if ((m_readPosition & 7) == 0) // read directly
{
float retval = BitConverter.ToSingle(m_data, m_readPosition >> 3);
return retval;
}
byte[] bytes = PeekBytes(4);
return BitConverter.ToSingle(bytes, 0);
}
/// <summary>
/// Reads a 64-bit Double without advancing the read pointer
/// </summary>
public double PeekDouble()
{
NetException.Assert(m_bitLength - m_readPosition >= 64, c_readOverflowError);
if ((m_readPosition & 7) == 0) // read directly
{
// read directly
double retval = BitConverter.ToDouble(m_data, m_readPosition >> 3);
return retval;
}
byte[] bytes = PeekBytes(8);
return BitConverter.ToDouble(bytes, 0);
}
/// <summary>
/// Reads a string without advancing the read pointer
/// </summary>
public string PeekString()
{
int wasReadPosition = m_readPosition;
string retval = ReadString();
m_readPosition = wasReadPosition;
return retval;
}
}
}

View File

@@ -1,103 +0,0 @@
/* Copyright (c) 2010 Michael Lidgren
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System;
using System.Reflection;
namespace Lidgren.Network
{
public partial class NetIncomingMessage
{
/// <summary>
/// Reads all public and private declared instance fields of the object in alphabetical order using reflection
/// </summary>
public void ReadAllFields(object target)
{
ReadAllFields(target, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
}
/// <summary>
/// Reads all fields with the specified binding of the object in alphabetical order using reflection
/// </summary>
public void ReadAllFields(object target, BindingFlags flags)
{
if (target == null)
return;
Type tp = target.GetType();
FieldInfo[] fields = tp.GetFields(flags);
NetUtility.SortMembersList(fields);
foreach (FieldInfo fi in fields)
{
object value;
// find read method
MethodInfo readMethod;
if (s_readMethods.TryGetValue(fi.FieldType, out readMethod))
{
// read value
value = readMethod.Invoke(this, null);
// set the value
fi.SetValue(target, value);
}
}
}
/// <summary>
/// Reads all public and private declared instance fields of the object in alphabetical order using reflection
/// </summary>
public void ReadAllProperties(object target)
{
ReadAllProperties(target, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
}
/// <summary>
/// Reads all fields with the specified binding of the object in alphabetical order using reflection
/// </summary>
public void ReadAllProperties(object target, BindingFlags flags)
{
if (target == null)
throw new ArgumentNullException("target");
if (target == null)
return;
Type tp = target.GetType();
PropertyInfo[] fields = tp.GetProperties(flags);
NetUtility.SortMembersList(fields);
foreach (PropertyInfo fi in fields)
{
object value;
// find read method
MethodInfo readMethod;
if (s_readMethods.TryGetValue(fi.PropertyType, out readMethod))
{
// read value
value = readMethod.Invoke(this, null);
// set the value
MethodInfo setMethod = fi.GetSetMethod((flags & BindingFlags.NonPublic) == BindingFlags.NonPublic);
setMethod.Invoke(target, new object[] { value });
}
}
}
}
}

View File

@@ -1,714 +0,0 @@
/* Copyright (c) 2010 Michael Lidgren
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.Net;
using System.Reflection;
namespace Lidgren.Network
{
public partial class NetIncomingMessage
{
private const string c_readOverflowError = "Trying to read past the buffer size - likely caused by mismatching Write/Reads, different size or order.";
private static readonly Dictionary<Type, MethodInfo> s_readMethods;
internal int m_readPosition;
/// <summary>
/// Gets or sets the read position in the buffer, in bits (not bytes)
/// </summary>
public long Position
{
get { return (long)m_readPosition; }
set { m_readPosition = (int)value; }
}
/// <summary>
/// Gets the position in the buffer in bytes; note that the bits of the first returned byte may already have been read - check the Position property to make sure.
/// </summary>
public int PositionInBytes
{
get { return (int)(m_readPosition / 8); }
}
static NetIncomingMessage()
{
Type[] integralTypes = typeof(Byte).Assembly.GetTypes();
s_readMethods = new Dictionary<Type, MethodInfo>();
MethodInfo[] methods = typeof(NetIncomingMessage).GetMethods(BindingFlags.Instance | BindingFlags.Public);
foreach (MethodInfo mi in methods)
{
if (mi.GetParameters().Length == 0 && mi.Name.StartsWith("Read", StringComparison.InvariantCulture))
{
string n = mi.Name.Substring(4);
foreach (Type it in integralTypes)
{
if (it.Name == n)
s_readMethods[it] = mi;
}
}
}
}
/// <summary>
/// Reads a boolean value (stored as a single bit) written using Write(bool)
/// </summary>
public bool ReadBoolean()
{
NetException.Assert(m_bitLength - m_readPosition >= 1, c_readOverflowError);
byte retval = NetBitWriter.ReadByte(m_data, 1, m_readPosition);
m_readPosition += 1;
return (retval > 0 ? true : false);
}
/// <summary>
/// Reads a byte
/// </summary>
public byte ReadByte()
{
NetException.Assert(m_bitLength - m_readPosition >= 8, c_readOverflowError);
byte retval = NetBitWriter.ReadByte(m_data, 8, m_readPosition);
m_readPosition += 8;
return retval;
}
/// <summary>
/// Reads a byte and returns true or false for success
/// </summary>
public bool ReadByte(out byte result)
{
if (m_bitLength - m_readPosition < 8)
{
result = 0;
return false;
}
result = NetBitWriter.ReadByte(m_data, 8, m_readPosition);
m_readPosition += 8;
return true;
}
/// <summary>
/// Reads a signed byte
/// </summary>
[CLSCompliant(false)]
public sbyte ReadSByte()
{
NetException.Assert(m_bitLength - m_readPosition >= 8, c_readOverflowError);
byte retval = NetBitWriter.ReadByte(m_data, 8, m_readPosition);
m_readPosition += 8;
return (sbyte)retval;
}
/// <summary>
/// Reads 1 to 8 bits into a byte
/// </summary>
public byte ReadByte(int numberOfBits)
{
NetException.Assert(numberOfBits > 0 && numberOfBits <= 8, "ReadByte(bits) can only read between 1 and 8 bits");
byte retval = NetBitWriter.ReadByte(m_data, numberOfBits, m_readPosition);
m_readPosition += numberOfBits;
return retval;
}
/// <summary>
/// Reads the specified number of bytes
/// </summary>
public byte[] ReadBytes(int numberOfBytes)
{
NetException.Assert(m_bitLength - m_readPosition + 7 >= (numberOfBytes * 8), c_readOverflowError);
byte[] retval = new byte[numberOfBytes];
NetBitWriter.ReadBytes(m_data, numberOfBytes, m_readPosition, retval, 0);
m_readPosition += (8 * numberOfBytes);
return retval;
}
/// <summary>
/// Reads the specified number of bytes and returns true for success
/// </summary>
public bool ReadBytes(int numberOfBytes, out byte[] result)
{
if (m_bitLength - m_readPosition + 7 < (numberOfBytes * 8))
{
result = null;
return false;
}
result = new byte[numberOfBytes];
NetBitWriter.ReadBytes(m_data, numberOfBytes, m_readPosition, result, 0);
m_readPosition += (8 * numberOfBytes);
return true;
}
/// <summary>
/// Reads the specified number of bytes into a preallocated array
/// </summary>
/// <param name="into">The destination array</param>
/// <param name="offset">The offset where to start writing in the destination array</param>
/// <param name="numberOfBytes">The number of bytes to read</param>
public void ReadBytes(byte[] into, int offset, int numberOfBytes)
{
NetException.Assert(m_bitLength - m_readPosition + 7 >= (numberOfBytes * 8), c_readOverflowError);
NetException.Assert(offset + numberOfBytes <= into.Length);
NetBitWriter.ReadBytes(m_data, numberOfBytes, m_readPosition, into, offset);
m_readPosition += (8 * numberOfBytes);
return;
}
/// <summary>
/// Reads the specified number of bits into a preallocated array
/// </summary>
/// <param name="into">The destination array</param>
/// <param name="offset">The offset where to start writing in the destination array</param>
/// <param name="numberOfBits">The number of bits to read</param>
public void ReadBits(byte[] into, int offset, int numberOfBits)
{
NetException.Assert(m_bitLength - m_readPosition >= numberOfBits, c_readOverflowError);
NetException.Assert(offset + NetUtility.BytesToHoldBits(numberOfBits) <= into.Length);
int numberOfWholeBytes = numberOfBits / 8;
int extraBits = numberOfBits - (numberOfWholeBytes * 8);
NetBitWriter.ReadBytes(m_data, numberOfWholeBytes, m_readPosition, into, offset);
m_readPosition += (8 * numberOfWholeBytes);
if (extraBits > 0)
into[offset + numberOfWholeBytes] = ReadByte(extraBits);
return;
}
/// <summary>
/// Reads a 16 bit signed integer written using Write(Int16)
/// </summary>
public Int16 ReadInt16()
{
NetException.Assert(m_bitLength - m_readPosition >= 16, c_readOverflowError);
uint retval = NetBitWriter.ReadUInt32(m_data, 16, m_readPosition);
m_readPosition += 16;
return (short)retval;
}
/// <summary>
/// Reads a 16 bit unsigned integer written using Write(UInt16)
/// </summary>
[CLSCompliant(false)]
public UInt16 ReadUInt16()
{
NetException.Assert(m_bitLength - m_readPosition >= 16, c_readOverflowError);
uint retval = NetBitWriter.ReadUInt32(m_data, 16, m_readPosition);
m_readPosition += 16;
return (ushort)retval;
}
/// <summary>
/// Reads a 32 bit signed integer written using Write(Int32)
/// </summary>
public Int32 ReadInt32()
{
NetException.Assert(m_bitLength - m_readPosition >= 32, c_readOverflowError);
uint retval = NetBitWriter.ReadUInt32(m_data, 32, m_readPosition);
m_readPosition += 32;
return (Int32)retval;
}
/// <summary>
/// Reads a 32 bit signed integer written using Write(Int32)
/// </summary>
[CLSCompliant(false)]
public bool ReadInt32(out Int32 result)
{
if (m_bitLength - m_readPosition < 32)
{
result = 0;
return false;
}
result = (Int32)NetBitWriter.ReadUInt32(m_data, 32, m_readPosition);
m_readPosition += 32;
return true;
}
/// <summary>
/// Reads a signed integer stored in 1 to 32 bits, written using Write(Int32, Int32)
/// </summary>
public Int32 ReadInt32(int numberOfBits)
{
NetException.Assert(numberOfBits > 0 && numberOfBits <= 32, "ReadInt32(bits) can only read between 1 and 32 bits");
NetException.Assert(m_bitLength - m_readPosition >= numberOfBits, c_readOverflowError);
uint retval = NetBitWriter.ReadUInt32(m_data, numberOfBits, m_readPosition);
m_readPosition += numberOfBits;
if (numberOfBits == 32)
return (int)retval;
int signBit = 1 << (numberOfBits - 1);
if ((retval & signBit) == 0)
return (int)retval; // positive
// negative
unchecked
{
uint mask = ((uint)-1) >> (33 - numberOfBits);
uint tmp = (retval & mask) + 1;
return -((int)tmp);
}
}
/// <summary>
/// Reads an 32 bit unsigned integer written using Write(UInt32)
/// </summary>
[CLSCompliant(false)]
public UInt32 ReadUInt32()
{
NetException.Assert(m_bitLength - m_readPosition >= 32, c_readOverflowError);
uint retval = NetBitWriter.ReadUInt32(m_data, 32, m_readPosition);
m_readPosition += 32;
return retval;
}
/// <summary>
/// Reads an 32 bit unsigned integer written using Write(UInt32) and returns true for success
/// </summary>
[CLSCompliant(false)]
public bool ReadUInt32(out UInt32 result)
{
if (m_bitLength - m_readPosition < 32)
{
result = 0;
return false;
}
result = NetBitWriter.ReadUInt32(m_data, 32, m_readPosition);
m_readPosition += 32;
return true;
}
/// <summary>
/// Reads an unsigned integer stored in 1 to 32 bits, written using Write(UInt32, Int32)
/// </summary>
[CLSCompliant(false)]
public UInt32 ReadUInt32(int numberOfBits)
{
NetException.Assert(numberOfBits > 0 && numberOfBits <= 32, "ReadUInt32(bits) can only read between 1 and 32 bits");
//NetException.Assert(m_bitLength - m_readBitPtr >= numberOfBits, "tried to read past buffer size");
UInt32 retval = NetBitWriter.ReadUInt32(m_data, numberOfBits, m_readPosition);
m_readPosition += numberOfBits;
return retval;
}
/// <summary>
/// Reads a 64 bit unsigned integer written using Write(UInt64)
/// </summary>
[CLSCompliant(false)]
public UInt64 ReadUInt64()
{
NetException.Assert(m_bitLength - m_readPosition >= 64, c_readOverflowError);
ulong low = NetBitWriter.ReadUInt32(m_data, 32, m_readPosition);
m_readPosition += 32;
ulong high = NetBitWriter.ReadUInt32(m_data, 32, m_readPosition);
ulong retval = low + (high << 32);
m_readPosition += 32;
return retval;
}
/// <summary>
/// Reads a 64 bit signed integer written using Write(Int64)
/// </summary>
public Int64 ReadInt64()
{
NetException.Assert(m_bitLength - m_readPosition >= 64, c_readOverflowError);
unchecked
{
ulong retval = ReadUInt64();
long longRetval = (long)retval;
return longRetval;
}
}
/// <summary>
/// Reads an unsigned integer stored in 1 to 64 bits, written using Write(UInt64, Int32)
/// </summary>
[CLSCompliant(false)]
public UInt64 ReadUInt64(int numberOfBits)
{
NetException.Assert(numberOfBits > 0 && numberOfBits <= 64, "ReadUInt64(bits) can only read between 1 and 64 bits");
NetException.Assert(m_bitLength - m_readPosition >= numberOfBits, c_readOverflowError);
ulong retval;
if (numberOfBits <= 32)
{
retval = (ulong)NetBitWriter.ReadUInt32(m_data, numberOfBits, m_readPosition);
}
else
{
retval = NetBitWriter.ReadUInt32(m_data, 32, m_readPosition);
retval |= NetBitWriter.ReadUInt32(m_data, numberOfBits - 32, m_readPosition) << 32;
}
m_readPosition += numberOfBits;
return retval;
}
/// <summary>
/// Reads a signed integer stored in 1 to 64 bits, written using Write(Int64, Int32)
/// </summary>
public Int64 ReadInt64(int numberOfBits)
{
NetException.Assert(((numberOfBits > 0) && (numberOfBits <= 64)), "ReadInt64(bits) can only read between 1 and 64 bits");
return (long)ReadUInt64(numberOfBits);
}
/// <summary>
/// Reads a 32 bit floating point value written using Write(Single)
/// </summary>
public float ReadFloat()
{
return ReadSingle();
}
/// <summary>
/// Reads a 32 bit floating point value written using Write(Single)
/// </summary>
public float ReadSingle()
{
NetException.Assert(m_bitLength - m_readPosition >= 32, c_readOverflowError);
if ((m_readPosition & 7) == 0) // read directly
{
float retval = BitConverter.ToSingle(m_data, m_readPosition >> 3);
m_readPosition += 32;
return retval;
}
byte[] bytes = ReadBytes(4);
return BitConverter.ToSingle(bytes, 0);
}
/// <summary>
/// Reads a 32 bit floating point value written using Write(Single)
/// </summary>
public bool ReadSingle(out float result)
{
if (m_bitLength - m_readPosition < 32)
{
result = 0.0f;
return false;
}
if ((m_readPosition & 7) == 0) // read directly
{
result = BitConverter.ToSingle(m_data, m_readPosition >> 3);
m_readPosition += 32;
return true;
}
byte[] bytes = ReadBytes(4);
result = BitConverter.ToSingle(bytes, 0);
return true;
}
/// <summary>
/// Reads a 64 bit floating point value written using Write(Double)
/// </summary>
public double ReadDouble()
{
NetException.Assert(m_bitLength - m_readPosition >= 64, c_readOverflowError);
if ((m_readPosition & 7) == 0) // read directly
{
// read directly
double retval = BitConverter.ToDouble(m_data, m_readPosition >> 3);
m_readPosition += 64;
return retval;
}
byte[] bytes = ReadBytes(8);
return BitConverter.ToDouble(bytes, 0);
}
//
// Variable bit count
//
/// <summary>
/// Reads a variable sized UInt32 written using WriteVariableUInt32()
/// </summary>
[CLSCompliant(false)]
public uint ReadVariableUInt32()
{
int num1 = 0;
int num2 = 0;
while (true)
{
byte num3 = this.ReadByte();
num1 |= (num3 & 0x7f) << num2;
num2 += 7;
if ((num3 & 0x80) == 0)
return (uint)num1;
}
}
/// <summary>
/// Reads a variable sized UInt32 written using WriteVariableUInt32() and returns true for success
/// </summary>
[CLSCompliant(false)]
public bool ReadVariableUInt32(out uint result)
{
int num1 = 0;
int num2 = 0;
while (true)
{
byte num3;
if (ReadByte(out num3) == false)
{
result = 0;
return false;
}
num1 |= (num3 & 0x7f) << num2;
num2 += 7;
if ((num3 & 0x80) == 0)
{
result = (uint)num1;
return true;
}
}
}
/// <summary>
/// Reads a variable sized Int32 written using WriteVariableInt32()
/// </summary>
public int ReadVariableInt32()
{
uint n = ReadVariableUInt32();
return (int)(n >> 1) ^ -(int)(n & 1); // decode zigzag
}
/// <summary>
/// Reads a variable sized Int64 written using WriteVariableInt64()
/// </summary>
public Int64 ReadVariableInt64()
{
UInt64 n = ReadVariableUInt64();
return (Int64)(n >> 1) ^ -(long)(n & 1); // decode zigzag
}
/// <summary>
/// Reads a variable sized UInt32 written using WriteVariableInt64()
/// </summary>
[CLSCompliant(false)]
public UInt64 ReadVariableUInt64()
{
UInt64 num1 = 0;
int num2 = 0;
while (true)
{
//if (num2 == 0x23)
// throw new FormatException("Bad 7-bit encoded integer");
byte num3 = this.ReadByte();
num1 |= ((UInt64)num3 & 0x7f) << num2;
num2 += 7;
if ((num3 & 0x80) == 0)
return num1;
}
}
/// <summary>
/// Reads a 32 bit floating point value written using WriteSignedSingle()
/// </summary>
/// <param name="numberOfBits">The number of bits used when writing the value</param>
/// <returns>A floating point value larger or equal to -1 and smaller or equal to 1</returns>
public float ReadSignedSingle(int numberOfBits)
{
uint encodedVal = ReadUInt32(numberOfBits);
int maxVal = (1 << numberOfBits) - 1;
return ((float)(encodedVal + 1) / (float)(maxVal + 1) - 0.5f) * 2.0f;
}
/// <summary>
/// Reads a 32 bit floating point value written using WriteUnitSingle()
/// </summary>
/// <param name="numberOfBits">The number of bits used when writing the value</param>
/// <returns>A floating point value larger or equal to 0 and smaller or equal to 1</returns>
public float ReadUnitSingle(int numberOfBits)
{
uint encodedVal = ReadUInt32(numberOfBits);
int maxVal = (1 << numberOfBits) - 1;
return (float)(encodedVal + 1) / (float)(maxVal + 1);
}
/// <summary>
/// Reads a 32 bit floating point value written using WriteRangedSingle()
/// </summary>
/// <param name="min">The minimum value used when writing the value</param>
/// <param name="max">The maximum value used when writing the value</param>
/// <param name="numberOfBits">The number of bits used when writing the value</param>
/// <returns>A floating point value larger or equal to MIN and smaller or equal to MAX</returns>
public float ReadRangedSingle(float min, float max, int numberOfBits)
{
float range = max - min;
int maxVal = (1 << numberOfBits) - 1;
float encodedVal = (float)ReadUInt32(numberOfBits);
float unit = encodedVal / (float)maxVal;
return min + (unit * range);
}
/// <summary>
/// Reads a 32 bit integer value written using WriteRangedInteger()
/// </summary>
/// <param name="min">The minimum value used when writing the value</param>
/// <param name="max">The maximum value used when writing the value</param>
/// <returns>A signed integer value larger or equal to MIN and smaller or equal to MAX</returns>
public int ReadRangedInteger(int min, int max)
{
uint range = (uint)(max - min);
int numBits = NetUtility.BitsToHoldUInt(range);
uint rvalue = ReadUInt32(numBits);
return (int)(min + rvalue);
}
/// <summary>
/// Reads a string written using Write(string)
/// </summary>
public string ReadString()
{
int byteLen = (int)ReadVariableUInt32();
if (byteLen == 0)
return String.Empty;
NetException.Assert(m_bitLength - m_readPosition >= (byteLen * 8), c_readOverflowError);
if ((m_readPosition & 7) == 0)
{
// read directly
string retval = System.Text.Encoding.UTF8.GetString(m_data, m_readPosition >> 3, byteLen);
m_readPosition += (8 * byteLen);
return retval;
}
byte[] bytes = ReadBytes(byteLen);
return System.Text.Encoding.UTF8.GetString(bytes, 0, bytes.Length);
}
/// <summary>
/// Reads a string written using Write(string) and returns true for success
/// </summary>
public bool ReadString(out string result)
{
uint byteLen;
if (ReadVariableUInt32(out byteLen) == false)
{
result = String.Empty;
return false;
}
if (byteLen == 0)
{
result = String.Empty;
return true;
}
if (m_bitLength - m_readPosition < (byteLen * 8))
{
result = String.Empty;
return false;
}
if ((m_readPosition & 7) == 0)
{
// read directly
result = System.Text.Encoding.UTF8.GetString(m_data, m_readPosition >> 3, (int)byteLen);
m_readPosition += (8 * (int)byteLen);
return true;
}
byte[] bytes;
if (ReadBytes((int)byteLen, out bytes) == false)
{
result = String.Empty;
return false;
}
result = System.Text.Encoding.UTF8.GetString(bytes, 0, bytes.Length);
return true;
}
/// <summary>
/// Reads a stored IPv4 endpoint description
/// </summary>
public IPEndPoint ReadIPEndpoint()
{
byte len = ReadByte();
byte[] addressBytes = ReadBytes(len);
int port = (int)ReadUInt16();
IPAddress address = new IPAddress(addressBytes);
return new IPEndPoint(address, port);
}
/// <summary>
/// Reads a value, in local time comparable to NetTime.Now, written using WriteTime()
/// Must have a connected sender
/// </summary>
public double ReadTime(bool highPrecision)
{
double remoteTime = (highPrecision ? ReadDouble() : (double)ReadSingle());
if (m_senderConnection == null)
throw new NetException("Cannot call ReadTime() on message without a connected sender (ie. unconnected messages)");
// lets bypass NetConnection.GetLocalTime for speed
return remoteTime - m_senderConnection.m_remoteTimeOffset;
}
/// <summary>
/// Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes.
/// </summary>
public void SkipPadBits()
{
m_readPosition = ((m_readPosition + 7) >> 3) * 8;
}
/// <summary>
/// Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes.
/// </summary>
public void ReadPadBits()
{
m_readPosition = ((m_readPosition + 7) >> 3) * 8;
}
/// <summary>
/// Pads data with the specified number of bits.
/// </summary>
public void SkipPadBits(int numberOfBits)
{
m_readPosition += numberOfBits;
}
}
}

View File

@@ -1,475 +0,0 @@
/* Copyright (c) 2010 Michael Lidgren
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.Net;
using System.Diagnostics;
using System.Text;
namespace Lidgren.Network
{
public partial class NetIncomingMessage
{
/// <summary>
/// Ensures the buffer can hold this number of bits
/// </summary>
private void InternalEnsureBufferSize(int numberOfBits)
{
int byteLen = ((numberOfBits + 7) >> 3);
if (m_data == null)
{
m_data = new byte[byteLen];
return;
}
if (m_data.Length < byteLen)
Array.Resize<byte>(ref m_data, byteLen);
return;
}
//
// 1 bit
//
internal void Write(bool value)
{
InternalEnsureBufferSize(m_bitLength + 1);
NetBitWriter.WriteByte((value ? (byte)1 : (byte)0), 1, m_data, m_bitLength);
m_bitLength += 1;
}
//
// 8 bit
//
internal void Write(byte source)
{
InternalEnsureBufferSize(m_bitLength + 8);
NetBitWriter.WriteByte(source, 8, m_data, m_bitLength);
m_bitLength += 8;
}
internal void Write(sbyte source)
{
InternalEnsureBufferSize(m_bitLength + 8);
NetBitWriter.WriteByte((byte)source, 8, m_data, m_bitLength);
m_bitLength += 8;
}
internal void Write(byte source, int numberOfBits)
{
NetException.Assert((numberOfBits > 0 && numberOfBits <= 8), "Write(byte, numberOfBits) can only write between 1 and 8 bits");
InternalEnsureBufferSize(m_bitLength + numberOfBits);
NetBitWriter.WriteByte(source, numberOfBits, m_data, m_bitLength);
m_bitLength += numberOfBits;
}
internal void Write(byte[] source)
{
if (source == null)
throw new ArgumentNullException("source");
int bits = source.Length * 8;
InternalEnsureBufferSize(m_bitLength + bits);
NetBitWriter.WriteBytes(source, 0, source.Length, m_data, m_bitLength);
m_bitLength += bits;
}
internal void Write(byte[] source, int offsetInBytes, int numberOfBytes)
{
if (source == null)
throw new ArgumentNullException("source");
int bits = numberOfBytes * 8;
InternalEnsureBufferSize(m_bitLength + bits);
NetBitWriter.WriteBytes(source, offsetInBytes, numberOfBytes, m_data, m_bitLength);
m_bitLength += bits;
}
//
// 16 bit
//
internal void Write(UInt16 source)
{
InternalEnsureBufferSize(m_bitLength + 16);
NetBitWriter.WriteUInt32((uint)source, 16, m_data, m_bitLength);
m_bitLength += 16;
}
internal void Write(UInt16 source, int numberOfBits)
{
NetException.Assert((numberOfBits > 0 && numberOfBits <= 16), "Write(ushort, numberOfBits) can only write between 1 and 16 bits");
InternalEnsureBufferSize(m_bitLength + numberOfBits);
NetBitWriter.WriteUInt32((uint)source, numberOfBits, m_data, m_bitLength);
m_bitLength += numberOfBits;
}
internal void Write(Int16 source)
{
InternalEnsureBufferSize(m_bitLength + 16);
NetBitWriter.WriteUInt32((uint)source, 16, m_data, m_bitLength);
m_bitLength += 16;
}
//
// 32 bit
//
#if UNSAFE
internal unsafe void Write(Int32 source)
{
EnsureBufferSize(m_bitLength + 32);
// can write fast?
if (m_bitLength % 8 == 0)
{
fixed (byte* numRef = &Data[m_bitLength / 8])
{
*((int*)numRef) = source;
}
}
else
{
NetBitWriter.WriteUInt32((UInt32)source, 32, Data, m_bitLength);
}
m_bitLength += 32;
}
#else
internal void Write(Int32 source)
{
InternalEnsureBufferSize(m_bitLength + 32);
NetBitWriter.WriteUInt32((UInt32)source, 32, m_data, m_bitLength);
m_bitLength += 32;
}
#endif
#if UNSAFE
internal unsafe void Write(UInt32 source)
{
EnsureBufferSize(m_bitLength + 32);
// can write fast?
if (m_bitLength % 8 == 0)
{
fixed (byte* numRef = &Data[m_bitLength / 8])
{
*((uint*)numRef) = source;
}
}
else
{
NetBitWriter.WriteUInt32(source, 32, Data, m_bitLength);
}
m_bitLength += 32;
}
#else
internal void Write(UInt32 source)
{
InternalEnsureBufferSize(m_bitLength + 32);
NetBitWriter.WriteUInt32(source, 32, m_data, m_bitLength);
m_bitLength += 32;
}
#endif
internal void Write(UInt32 source, int numberOfBits)
{
NetException.Assert((numberOfBits > 0 && numberOfBits <= 32), "Write(uint, numberOfBits) can only write between 1 and 32 bits");
InternalEnsureBufferSize(m_bitLength + numberOfBits);
NetBitWriter.WriteUInt32(source, numberOfBits, m_data, m_bitLength);
m_bitLength += numberOfBits;
}
internal void Write(Int32 source, int numberOfBits)
{
NetException.Assert((numberOfBits > 0 && numberOfBits <= 32), "Write(int, numberOfBits) can only write between 1 and 32 bits");
InternalEnsureBufferSize(m_bitLength + numberOfBits);
if (numberOfBits != 32)
{
// make first bit sign
int signBit = 1 << (numberOfBits - 1);
if (source < 0)
source = (-source - 1) | signBit;
else
source &= (~signBit);
}
NetBitWriter.WriteUInt32((uint)source, numberOfBits, m_data, m_bitLength);
m_bitLength += numberOfBits;
}
//
// 64 bit
//
internal void Write(UInt64 source)
{
InternalEnsureBufferSize(m_bitLength + 64);
NetBitWriter.WriteUInt64(source, 64, m_data, m_bitLength);
m_bitLength += 64;
}
internal void Write(UInt64 source, int numberOfBits)
{
InternalEnsureBufferSize(m_bitLength + numberOfBits);
NetBitWriter.WriteUInt64(source, numberOfBits, m_data, m_bitLength);
m_bitLength += numberOfBits;
}
internal void Write(Int64 source)
{
InternalEnsureBufferSize(m_bitLength + 64);
ulong usource = (ulong)source;
NetBitWriter.WriteUInt64(usource, 64, m_data, m_bitLength);
m_bitLength += 64;
}
internal void Write(Int64 source, int numberOfBits)
{
InternalEnsureBufferSize(m_bitLength + numberOfBits);
ulong usource = (ulong)source;
NetBitWriter.WriteUInt64(usource, numberOfBits, m_data, m_bitLength);
m_bitLength += numberOfBits;
}
//
// Floating point
//
#if UNSAFE
internal unsafe void Write(float source)
{
uint val = *((uint*)&source);
#if BIGENDIAN
val = NetUtility.SwapByteOrder(val);
#endif
Write(val);
}
#else
internal void Write(float source)
{
byte[] val = BitConverter.GetBytes(source);
#if BIGENDIAN
// swap byte order
byte tmp = val[3];
val[3] = val[0];
val[0] = tmp;
tmp = val[2];
val[2] = val[1];
val[1] = tmp;
#endif
Write(val);
}
#endif
#if UNSAFE
internal unsafe void Write(double source)
{
ulong val = *((ulong*)&source);
#if BIGENDIAN
val = NetUtility.SwapByteOrder(val);
#endif
Write(val);
}
#else
internal void Write(double source)
{
byte[] val = BitConverter.GetBytes(source);
#if BIGENDIAN
// 0 1 2 3 4 5 6 7
// swap byte order
byte tmp = val[7];
val[7] = val[0];
val[0] = tmp;
tmp = val[6];
val[6] = val[1];
val[1] = tmp;
tmp = val[5];
val[5] = val[2];
val[2] = tmp;
tmp = val[4];
val[4] = val[3];
val[3] = tmp;
#endif
Write(val);
}
#endif
//
// Variable bits
//
/// <summary>
/// Write Base128 encoded variable sized unsigned integer
/// </summary>
/// <returns>number of bytes written</returns>
internal int WriteVariableUInt32(uint value)
{
int retval = 1;
uint num1 = (uint)value;
while (num1 >= 0x80)
{
this.Write((byte)(num1 | 0x80));
num1 = num1 >> 7;
retval++;
}
this.Write((byte)num1);
return retval;
}
/// <summary>
/// Write Base128 encoded variable sized signed integer
/// </summary>
/// <returns>number of bytes written</returns>
internal int WriteVariableInt32(int value)
{
int retval = 1;
uint num1 = (uint)((value << 1) ^ (value >> 31));
while (num1 >= 0x80)
{
this.Write((byte)(num1 | 0x80));
num1 = num1 >> 7;
retval++;
}
this.Write((byte)num1);
return retval;
}
/// <summary>
/// Write Base128 encoded variable sized unsigned integer
/// </summary>
/// <returns>number of bytes written</returns>
internal int WriteVariableUInt64(UInt64 value)
{
int retval = 1;
UInt64 num1 = (UInt64)value;
while (num1 >= 0x80)
{
this.Write((byte)(num1 | 0x80));
num1 = num1 >> 7;
retval++;
}
this.Write((byte)num1);
return retval;
}
/// <summary>
/// Compress (lossy) a float in the range -1..1 using numberOfBits bits
/// </summary>
internal void WriteSignedSingle(float value, int numberOfBits)
{
NetException.Assert(((value >= -1.0) && (value <= 1.0)), " WriteSignedSingle() must be passed a float in the range -1 to 1; val is " + value);
float unit = (value + 1.0f) * 0.5f;
int maxVal = (1 << numberOfBits) - 1;
uint writeVal = (uint)(unit * (float)maxVal);
Write(writeVal, numberOfBits);
}
/// <summary>
/// Compress (lossy) a float in the range 0..1 using numberOfBits bits
/// </summary>
internal void WriteUnitSingle(float value, int numberOfBits)
{
NetException.Assert(((value >= 0.0) && (value <= 1.0)), " WriteUnitSingle() must be passed a float in the range 0 to 1; val is " + value);
int maxValue = (1 << numberOfBits) - 1;
uint writeVal = (uint)(value * (float)maxValue);
Write(writeVal, numberOfBits);
}
/// <summary>
/// Compress a float within a specified range using a certain number of bits
/// </summary>
internal void WriteRangedSingle(float value, float min, float max, int numberOfBits)
{
NetException.Assert(((value >= min) && (value <= max)), " WriteRangedSingle() must be passed a float in the range MIN to MAX; val is " + value);
float range = max - min;
float unit = ((value - min) / range);
int maxVal = (1 << numberOfBits) - 1;
Write((UInt32)((float)maxVal * unit), numberOfBits);
}
/// <summary>
/// Writes an integer with the least amount of bits need for the specified range
/// Returns number of bits written
/// </summary>
internal int WriteRangedInteger(int min, int max, int value)
{
NetException.Assert(value >= min && value <= max, "Value not within min/max range!");
uint range = (uint)(max - min);
int numBits = NetUtility.BitsToHoldUInt(range);
uint rvalue = (uint)(value - min);
Write(rvalue, numBits);
return numBits;
}
/// <summary>
/// Write a string
/// </summary>
internal void Write(string source)
{
if (string.IsNullOrEmpty(source))
{
InternalEnsureBufferSize(m_bitLength + 8);
WriteVariableUInt32(0);
return;
}
byte[] bytes = Encoding.UTF8.GetBytes(source);
InternalEnsureBufferSize(m_bitLength + ((bytes.Length + 2) * 8));
WriteVariableUInt32((uint)bytes.Length);
Write(bytes);
}
/// <summary>
/// Writes an endpoint description
/// </summary>
internal void Write(IPEndPoint endPoint)
{
byte[] bytes = endPoint.Address.GetAddressBytes();
Write((byte)bytes.Length);
Write(bytes);
Write((ushort)endPoint.Port);
}
/// <summary>
/// Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes.
/// </summary>
internal void WritePadBits()
{
m_bitLength = ((m_bitLength + 7) / 8) * 8;
InternalEnsureBufferSize(m_bitLength);
}
/// <summary>
/// Pads data with the specified number of bits.
/// </summary>
internal void WritePadBits(int numberOfBits)
{
m_bitLength += numberOfBits;
InternalEnsureBufferSize(m_bitLength);
}
}
}

View File

@@ -1,91 +0,0 @@
/* Copyright (c) 2010 Michael Lidgren
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System;
using System.Reflection;
namespace Lidgren.Network
{
public partial class NetOutgoingMessage
{
/// <summary>
/// Writes all public and private declared instance fields of the object in alphabetical order using reflection
/// </summary>
public void WriteAllFields(object ob)
{
WriteAllFields(ob, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
}
/// <summary>
/// Writes all fields with specified binding in alphabetical order using reflection
/// </summary>
public void WriteAllFields(object ob, BindingFlags flags)
{
if (ob == null)
return;
Type tp = ob.GetType();
FieldInfo[] fields = tp.GetFields(flags);
NetUtility.SortMembersList(fields);
foreach (FieldInfo fi in fields)
{
object value = fi.GetValue(ob);
// find the appropriate Write method
MethodInfo writeMethod;
if (s_writeMethods.TryGetValue(fi.FieldType, out writeMethod))
writeMethod.Invoke(this, new object[] { value });
else
throw new NetException("Failed to find write method for type " + fi.FieldType);
}
}
/// <summary>
/// Writes all public and private declared instance properties of the object in alphabetical order using reflection
/// </summary>
public void WriteAllProperties(object ob)
{
WriteAllProperties(ob, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
}
/// <summary>
/// Writes all properties with specified binding in alphabetical order using reflection
/// </summary>
public void WriteAllProperties(object ob, BindingFlags flags)
{
if (ob == null)
return;
Type tp = ob.GetType();
PropertyInfo[] fields = tp.GetProperties(flags);
NetUtility.SortMembersList(fields);
foreach (PropertyInfo fi in fields)
{
MethodInfo getMethod = fi.GetGetMethod((flags & BindingFlags.NonPublic) == BindingFlags.NonPublic);
object value = getMethod.Invoke(ob, null);
// find the appropriate Write method
MethodInfo writeMethod;
if (s_writeMethods.TryGetValue(fi.PropertyType, out writeMethod))
writeMethod.Invoke(this, new object[] { value });
}
}
}
}

View File

@@ -1,659 +0,0 @@
/* Copyright (c) 2010 Michael Lidgren
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.Net;
using System.Reflection;
using System.Text;
using System.Runtime.InteropServices;
namespace Lidgren.Network
{
public sealed partial class NetOutgoingMessage
{
private const int c_overAllocateAmount = 4;
private static Dictionary<Type, MethodInfo> s_writeMethods;
internal byte[] m_data;
internal int m_bitLength;
static NetOutgoingMessage()
{
s_writeMethods = new Dictionary<Type, MethodInfo>();
MethodInfo[] methods = typeof(NetOutgoingMessage).GetMethods(BindingFlags.Instance | BindingFlags.Public);
foreach (MethodInfo mi in methods)
{
if (mi.Name.Equals("Write", StringComparison.InvariantCulture))
{
ParameterInfo[] pis = mi.GetParameters();
if (pis.Length == 1)
s_writeMethods[pis[0].ParameterType] = mi;
}
}
}
/// <summary>
/// Returns the internal data buffer, don't modify
/// </summary>
public byte[] PeekDataBuffer()
{
return m_data;
}
/// <summary>
/// Gets or sets the length of the buffer in bytes
/// </summary>
public int LengthBytes
{
get { return ((m_bitLength + 7) >> 3); }
set
{
m_bitLength = value * 8;
InternalEnsureBufferSize(m_bitLength);
}
}
/// <summary>
/// Gets or sets the length of the buffer in bits
/// </summary>
public int LengthBits
{
get { return m_bitLength; }
set
{
m_bitLength = value;
InternalEnsureBufferSize(m_bitLength);
}
}
/// <summary>
/// Ensures the buffer can hold this number of bits
/// </summary>
public void EnsureBufferSize(int numberOfBits)
{
int byteLen = ((numberOfBits + 7) >> 3);
if (m_data == null)
{
m_data = new byte[byteLen + c_overAllocateAmount];
return;
}
if (m_data.Length < byteLen)
Array.Resize<byte>(ref m_data, byteLen + c_overAllocateAmount);
return;
}
/// <summary>
/// Ensures the buffer can hold this number of bits
/// </summary>
public void InternalEnsureBufferSize(int numberOfBits)
{
int byteLen = ((numberOfBits + 7) >> 3);
if (m_data == null)
{
m_data = new byte[byteLen];
return;
}
if (m_data.Length < byteLen)
Array.Resize<byte>(ref m_data, byteLen);
return;
}
/// <summary>
/// Writes a boolean value using 1 bit
/// </summary>
public void Write(bool value)
{
EnsureBufferSize(m_bitLength + 1);
NetBitWriter.WriteByte((value ? (byte)1 : (byte)0), 1, m_data, m_bitLength);
m_bitLength += 1;
}
/// <summary>
/// Write a byte
/// </summary>
public void Write(byte source)
{
EnsureBufferSize(m_bitLength + 8);
NetBitWriter.WriteByte(source, 8, m_data, m_bitLength);
m_bitLength += 8;
}
/// <summary>
/// Writes a signed byte
/// </summary>
[CLSCompliant(false)]
public void Write(sbyte source)
{
EnsureBufferSize(m_bitLength + 8);
NetBitWriter.WriteByte((byte)source, 8, m_data, m_bitLength);
m_bitLength += 8;
}
/// <summary>
/// Writes 1 to 8 bits of a byte
/// </summary>
public void Write(byte source, int numberOfBits)
{
NetException.Assert((numberOfBits > 0 && numberOfBits <= 8), "Write(byte, numberOfBits) can only write between 1 and 8 bits");
EnsureBufferSize(m_bitLength + numberOfBits);
NetBitWriter.WriteByte(source, numberOfBits, m_data, m_bitLength);
m_bitLength += numberOfBits;
}
/// <summary>
/// Writes all bytes in an array
/// </summary>
public void Write(byte[] source)
{
if (source == null)
throw new ArgumentNullException("source");
int bits = source.Length * 8;
EnsureBufferSize(m_bitLength + bits);
NetBitWriter.WriteBytes(source, 0, source.Length, m_data, m_bitLength);
m_bitLength += bits;
}
/// <summary>
/// Writes the specified number of bytes from an array
/// </summary>
public void Write(byte[] source, int offsetInBytes, int numberOfBytes)
{
if (source == null)
throw new ArgumentNullException("source");
int bits = numberOfBytes * 8;
EnsureBufferSize(m_bitLength + bits);
NetBitWriter.WriteBytes(source, offsetInBytes, numberOfBytes, m_data, m_bitLength);
m_bitLength += bits;
}
/// <summary>
/// Writes an unsigned 16 bit integer
/// </summary>
/// <param name="source"></param>
[CLSCompliant(false)]
public void Write(UInt16 source)
{
EnsureBufferSize(m_bitLength + 16);
NetBitWriter.WriteUInt32((uint)source, 16, m_data, m_bitLength);
m_bitLength += 16;
}
/// <summary>
/// Writes an unsigned integer using 1 to 16 bits
/// </summary>
[CLSCompliant(false)]
public void Write(UInt16 source, int numberOfBits)
{
NetException.Assert((numberOfBits > 0 && numberOfBits <= 16), "Write(ushort, numberOfBits) can only write between 1 and 16 bits");
EnsureBufferSize(m_bitLength + numberOfBits);
NetBitWriter.WriteUInt32((uint)source, numberOfBits, m_data, m_bitLength);
m_bitLength += numberOfBits;
}
/// <summary>
/// Writes a signed 16 bit integer
/// </summary>
public void Write(Int16 source)
{
EnsureBufferSize(m_bitLength + 16);
NetBitWriter.WriteUInt32((uint)source, 16, m_data, m_bitLength);
m_bitLength += 16;
}
#if UNSAFE
/// <summary>
/// Writes a 32 bit signed integer
/// </summary>
public unsafe void Write(Int32 source)
{
EnsureBufferSize(m_bitLength + 32);
// can write fast?
if (m_bitLength % 8 == 0)
{
fixed (byte* numRef = &Data[m_bitLength / 8])
{
*((int*)numRef) = source;
}
}
else
{
NetBitWriter.WriteUInt32((UInt32)source, 32, Data, m_bitLength);
}
m_bitLength += 32;
}
#else
/// <summary>
/// Writes a 32 bit signed integer
/// </summary>
public void Write(Int32 source)
{
EnsureBufferSize(m_bitLength + 32);
NetBitWriter.WriteUInt32((UInt32)source, 32, m_data, m_bitLength);
m_bitLength += 32;
}
#endif
#if UNSAFE
/// <summary>
/// Writes a 32 bit unsigned integer
/// </summary>
public unsafe void Write(UInt32 source)
{
EnsureBufferSize(m_bitLength + 32);
// can write fast?
if (m_bitLength % 8 == 0)
{
fixed (byte* numRef = &Data[m_bitLength / 8])
{
*((uint*)numRef) = source;
}
}
else
{
NetBitWriter.WriteUInt32(source, 32, Data, m_bitLength);
}
m_bitLength += 32;
}
#else
/// <summary>
/// Writes a 32 bit unsigned integer
/// </summary>
[CLSCompliant(false)]
public void Write(UInt32 source)
{
EnsureBufferSize(m_bitLength + 32);
NetBitWriter.WriteUInt32(source, 32, m_data, m_bitLength);
m_bitLength += 32;
}
#endif
/// <summary>
/// Writes a 32 bit signed integer
/// </summary>
[CLSCompliant(false)]
public void Write(UInt32 source, int numberOfBits)
{
NetException.Assert((numberOfBits > 0 && numberOfBits <= 32), "Write(uint, numberOfBits) can only write between 1 and 32 bits");
EnsureBufferSize(m_bitLength + numberOfBits);
NetBitWriter.WriteUInt32(source, numberOfBits, m_data, m_bitLength);
m_bitLength += numberOfBits;
}
/// <summary>
/// Writes a signed integer using 1 to 32 bits
/// </summary>
public void Write(Int32 source, int numberOfBits)
{
NetException.Assert((numberOfBits > 0 && numberOfBits <= 32), "Write(int, numberOfBits) can only write between 1 and 32 bits");
EnsureBufferSize(m_bitLength + numberOfBits);
if (numberOfBits != 32)
{
// make first bit sign
int signBit = 1 << (numberOfBits - 1);
if (source < 0)
source = (-source - 1) | signBit;
else
source &= (~signBit);
}
NetBitWriter.WriteUInt32((uint)source, numberOfBits, m_data, m_bitLength);
m_bitLength += numberOfBits;
}
/// <summary>
/// Writes a 64 bit unsigned integer
/// </summary>
[CLSCompliant(false)]
public void Write(UInt64 source)
{
EnsureBufferSize(m_bitLength + 64);
NetBitWriter.WriteUInt64(source, 64, m_data, m_bitLength);
m_bitLength += 64;
}
/// <summary>
/// Writes an unsigned integer using 1 to 64 bits
/// </summary>
[CLSCompliant(false)]
public void Write(UInt64 source, int numberOfBits)
{
EnsureBufferSize(m_bitLength + numberOfBits);
NetBitWriter.WriteUInt64(source, numberOfBits, m_data, m_bitLength);
m_bitLength += numberOfBits;
}
/// <summary>
/// Writes a 64 bit signed integer
/// </summary>
public void Write(Int64 source)
{
EnsureBufferSize(m_bitLength + 64);
ulong usource = (ulong)source;
NetBitWriter.WriteUInt64(usource, 64, m_data, m_bitLength);
m_bitLength += 64;
}
/// <summary>
/// Writes a signed integer using 1 to 64 bits
/// </summary>
public void Write(Int64 source, int numberOfBits)
{
EnsureBufferSize(m_bitLength + numberOfBits);
ulong usource = (ulong)source;
NetBitWriter.WriteUInt64(usource, numberOfBits, m_data, m_bitLength);
m_bitLength += numberOfBits;
}
//
// Floating point
//
#if UNSAFE
/// <summary>
/// Writes a 32 bit floating point value
/// </summary>
public unsafe void Write(float source)
{
uint val = *((uint*)&source);
#if BIGENDIAN
val = NetUtility.SwapByteOrder(val);
#endif
Write(val);
}
#else
/// <summary>
/// Writes a 32 bit floating point value
/// </summary>
public void Write(float source)
{
// Use union to avoid BitConverter.GetBytes() which allocates memory on the heap
SingleUIntUnion su;
su.UIntValue = 0; // must initialize every member of the union to avoid warning
su.SingleValue = source;
#if BIGENDIAN
// swap byte order
su.UIntValue = NetUtility.SwapByteOrder(su.UIntValue);
#endif
Write(su.UIntValue);
}
#endif
#if UNSAFE
/// <summary>
/// Writes a 64 bit floating point value
/// </summary>
public unsafe void Write(double source)
{
ulong val = *((ulong*)&source);
#if BIGENDIAN
val = NetUtility.SwapByteOrder(val);
#endif
Write(val);
}
#else
/// <summary>
/// Writes a 64 bit floating point value
/// </summary>
public void Write(double source)
{
byte[] val = BitConverter.GetBytes(source);
#if BIGENDIAN
// 0 1 2 3 4 5 6 7
// swap byte order
byte tmp = val[7];
val[7] = val[0];
val[0] = tmp;
tmp = val[6];
val[6] = val[1];
val[1] = tmp;
tmp = val[5];
val[5] = val[2];
val[2] = tmp;
tmp = val[4];
val[4] = val[3];
val[3] = tmp;
#endif
Write(val);
}
#endif
//
// Variable bits
//
/// <summary>
/// Write Base128 encoded variable sized unsigned integer of up to 32 bits
/// </summary>
/// <returns>number of bytes written</returns>
[CLSCompliant(false)]
public int WriteVariableUInt32(uint value)
{
int retval = 1;
uint num1 = (uint)value;
while (num1 >= 0x80)
{
this.Write((byte)(num1 | 0x80));
num1 = num1 >> 7;
retval++;
}
this.Write((byte)num1);
return retval;
}
/// <summary>
/// Write Base128 encoded variable sized signed integer of up to 32 bits
/// </summary>
/// <returns>number of bytes written</returns>
public int WriteVariableInt32(int value)
{
uint zigzag = (uint)(value << 1) ^ (uint)(value >> 31);
return WriteVariableUInt32(zigzag);
}
/// <summary>
/// Write Base128 encoded variable sized signed integer of up to 64 bits
/// </summary>
/// <returns>number of bytes written</returns>
public int WriteVariableInt64(Int64 value)
{
ulong zigzag = (ulong)(value << 1) ^ (ulong)(value >> 63);
return WriteVariableUInt64(zigzag);
}
/// <summary>
/// Write Base128 encoded variable sized unsigned integer of up to 64 bits
/// </summary>
/// <returns>number of bytes written</returns>
[CLSCompliant(false)]
public int WriteVariableUInt64(UInt64 value)
{
int retval = 1;
UInt64 num1 = (UInt64)value;
while (num1 >= 0x80)
{
this.Write((byte)(num1 | 0x80));
num1 = num1 >> 7;
retval++;
}
this.Write((byte)num1);
return retval;
}
/// <summary>
/// Compress (lossy) a float in the range -1..1 using numberOfBits bits
/// </summary>
public void WriteSignedSingle(float value, int numberOfBits)
{
NetException.Assert(((value >= -1.0) && (value <= 1.0)), " WriteSignedSingle() must be passed a float in the range -1 to 1; val is " + value);
float unit = (value + 1.0f) * 0.5f;
int maxVal = (1 << numberOfBits) - 1;
uint writeVal = (uint)(unit * (float)maxVal);
Write(writeVal, numberOfBits);
}
/// <summary>
/// Compress (lossy) a float in the range 0..1 using numberOfBits bits
/// </summary>
public void WriteUnitSingle(float value, int numberOfBits)
{
NetException.Assert(((value >= 0.0) && (value <= 1.0)), " WriteUnitSingle() must be passed a float in the range 0 to 1; val is " + value);
int maxValue = (1 << numberOfBits) - 1;
uint writeVal = (uint)(value * (float)maxValue);
Write(writeVal, numberOfBits);
}
/// <summary>
/// Compress a float within a specified range using a certain number of bits
/// </summary>
public void WriteRangedSingle(float value, float min, float max, int numberOfBits)
{
NetException.Assert(((value >= min) && (value <= max)), " WriteRangedSingle() must be passed a float in the range MIN to MAX; val is " + value);
float range = max - min;
float unit = ((value - min) / range);
int maxVal = (1 << numberOfBits) - 1;
Write((UInt32)((float)maxVal * unit), numberOfBits);
}
/// <summary>
/// Writes an integer with the least amount of bits need for the specified range
/// Returns number of bits written
/// </summary>
public int WriteRangedInteger(int min, int max, int value)
{
NetException.Assert(value >= min && value <= max, "Value not within min/max range!");
uint range = (uint)(max - min);
int numBits = NetUtility.BitsToHoldUInt(range);
uint rvalue = (uint)(value - min);
Write(rvalue, numBits);
return numBits;
}
/// <summary>
/// Write a string
/// </summary>
public void Write(string source)
{
if (string.IsNullOrEmpty(source))
{
EnsureBufferSize(m_bitLength + 8);
WriteVariableUInt32(0);
return;
}
byte[] bytes = Encoding.UTF8.GetBytes(source);
EnsureBufferSize(m_bitLength + 8 + (bytes.Length * 8));
WriteVariableUInt32((uint)bytes.Length);
Write(bytes);
}
/// <summary>
/// Writes an endpoint description
/// </summary>
public void Write(IPEndPoint endPoint)
{
byte[] bytes = endPoint.Address.GetAddressBytes();
Write((byte)bytes.Length);
Write(bytes);
Write((ushort)endPoint.Port);
}
/// <summary>
/// Writes the local time to a message; readable (and convertable to local time) by the remote host using ReadTime()
/// </summary>
public void WriteTime(double localTime, bool highPrecision)
{
if (highPrecision)
Write(localTime);
else
Write((float)localTime);
}
/// <summary>
/// Pads data with enough bits to reach a full byte. Decreases cpu usage for subsequent byte writes.
/// </summary>
public void WritePadBits()
{
m_bitLength = ((m_bitLength + 7) >> 3) * 8;
EnsureBufferSize(m_bitLength);
}
/// <summary>
/// Pads data with the specified number of bits.
/// </summary>
public void WritePadBits(int numberOfBits)
{
m_bitLength += numberOfBits;
EnsureBufferSize(m_bitLength);
}
/// <summary>
/// Append all the bits of message to this message
/// </summary>
public void Write(NetOutgoingMessage message)
{
EnsureBufferSize(m_bitLength + (message.LengthBytes * 8));
Write(message.m_data, 0, message.LengthBytes);
// did we write excessive bits?
int bitsInLastByte = (message.m_bitLength % 8);
if (bitsInLastByte != 0)
{
int excessBits = 8 - bitsInLastByte;
m_bitLength -= excessBits;
}
}
/// <summary>
/// Append all the bits of message to this message
/// </summary>
public void Write(NetIncomingMessage message)
{
EnsureBufferSize(m_bitLength + (message.LengthBytes * 8));
Write(message.m_data, 0, message.LengthBytes);
// did we write excessive bits?
int bitsInLastByte = (message.m_bitLength % 8);
if (bitsInLastByte != 0)
{
int excessBits = 8 - bitsInLastByte;
m_bitLength -= excessBits;
}
}
}
}

View File

@@ -114,7 +114,13 @@ namespace Lidgren.Network
iep = new IPEndPoint(m_configuration.LocalAddress, m_configuration.Port);
EndPoint ep = (EndPoint)iep;
m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
m_socket = new Socket(ep.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
if (ep.AddressFamily == AddressFamily.InterNetworkV6)
{
// Disable IPv4 -> IPv6 mapping.
// SS14 handles IPv6 & IPv4 concurrently with a different net peer.
m_socket.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, true);
}
m_socket.ReceiveBufferSize = m_configuration.ReceiveBufferSize;
m_socket.SendBufferSize = m_configuration.SendBufferSize;
m_socket.Blocking = false;
@@ -252,9 +258,20 @@ namespace Lidgren.Network
}
if (m_messageReceivedEvent != null)
{
m_messageReceivedEvent.Set();
m_messageReceivedEvent.Close();
m_messageReceivedEvent = null;
try
{
m_messageReceivedEvent.Set();
m_messageReceivedEvent.Close();
}
catch (ObjectDisposedException)
{
// For some reason, inside Godot this seems to throw ObjectDisposedExceptions on client shutdown.
// If it's already disposed then I guess this is fine?
}
finally
{
m_messageReceivedEvent = null;
}
}
}
finally

View File

@@ -2,6 +2,7 @@ using System;
using System.Threading;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
namespace Lidgren.Network
{
@@ -27,8 +28,8 @@ namespace Lidgren.Network
/// <summary>
/// Signalling event which can be waited on to determine when a message is queued for reading.
/// Note that there is no guarantee that after the event is signaled the blocked thread will
/// find the message in the queue. Other user created threads could be preempted and dequeue
/// Note that there is no guarantee that after the event is signaled the blocked thread will
/// find the message in the queue. Other user created threads could be preempted and dequeue
/// the message before the waiting thread wakes up.
/// </summary>
public AutoResetEvent MessageReceivedEvent { get { return m_messageReceivedEvent; } }
@@ -102,9 +103,16 @@ namespace Lidgren.Network
m_connections = new List<NetConnection>();
m_connectionLookup = new Dictionary<IPEndPoint, NetConnection>();
m_handshakes = new Dictionary<IPEndPoint, NetConnection>();
m_senderRemote = (EndPoint)new IPEndPoint(IPAddress.Any, 0);
if (m_configuration.LocalAddress.AddressFamily == AddressFamily.InterNetworkV6)
{
m_senderRemote = (EndPoint)new IPEndPoint(IPAddress.IPv6Any, 0);
}
else
{
m_senderRemote = (EndPoint)new IPEndPoint(IPAddress.Any, 0);
}
m_status = NetPeerStatus.NotRunning;
m_receivedFragmentGroups = new Dictionary<NetConnection, Dictionary<int, ReceivedFragmentGroup>>();
m_receivedFragmentGroups = new Dictionary<NetConnection, Dictionary<int, ReceivedFragmentGroup>>();
}
/// <summary>
@@ -129,7 +137,7 @@ namespace Lidgren.Network
}
InitializeNetwork();
// start network thread
m_networkThread = new Thread(new ThreadStart(NetworkLoop));
m_networkThread.Name = m_configuration.NetworkThreadName;

View File

@@ -1,281 +0,0 @@
using System;
using System.Security.Cryptography;
namespace Lidgren.Network
{
/// <summary>
/// Multiply With Carry random
/// </summary>
public class MWCRandom : NetRandom
{
/// <summary>
/// Get global instance of MWCRandom
/// </summary>
public static new readonly MWCRandom Instance = new MWCRandom();
private uint m_w, m_z;
/// <summary>
/// Constructor with randomized seed
/// </summary>
public MWCRandom()
{
Initialize(NetRandomSeed.GetUInt64());
}
/// <summary>
/// (Re)initialize this instance with provided 32 bit seed
/// </summary>
[CLSCompliant(false)]
public override void Initialize(uint seed)
{
m_w = seed;
m_z = seed * 16777619;
}
/// <summary>
/// (Re)initialize this instance with provided 64 bit seed
/// </summary>
[CLSCompliant(false)]
public void Initialize(ulong seed)
{
m_w = (uint)seed;
m_z = (uint)(seed >> 32);
}
/// <summary>
/// Generates a random value from UInt32.MinValue to UInt32.MaxValue, inclusively
/// </summary>
[CLSCompliant(false)]
public override uint NextUInt32()
{
m_z = 36969 * (m_z & 65535) + (m_z >> 16);
m_w = 18000 * (m_w & 65535) + (m_w >> 16);
return ((m_z << 16) + m_w);
}
}
/// <summary>
/// Xor Shift based random
/// </summary>
public sealed class XorShiftRandom : NetRandom
{
/// <summary>
/// Get global instance of XorShiftRandom
/// </summary>
public static new readonly XorShiftRandom Instance = new XorShiftRandom();
private const uint c_x = 123456789;
private const uint c_y = 362436069;
private const uint c_z = 521288629;
private const uint c_w = 88675123;
private uint m_x, m_y, m_z, m_w;
/// <summary>
/// Constructor with randomized seed
/// </summary>
public XorShiftRandom()
{
Initialize(NetRandomSeed.GetUInt64());
}
/// <summary>
/// Constructor with provided 64 bit seed
/// </summary>
[CLSCompliant(false)]
public XorShiftRandom(ulong seed)
{
Initialize(seed);
}
/// <summary>
/// (Re)initialize this instance with provided 32 bit seed
/// </summary>
[CLSCompliant(false)]
public override void Initialize(uint seed)
{
m_x = (uint)seed;
m_y = c_y;
m_z = c_z;
m_w = c_w;
}
/// <summary>
/// (Re)initialize this instance with provided 64 bit seed
/// </summary>
[CLSCompliant(false)]
public void Initialize(ulong seed)
{
m_x = (uint)seed;
m_y = c_y;
m_z = (uint)(seed << 32);
m_w = c_w;
}
/// <summary>
/// Generates a random value from UInt32.MinValue to UInt32.MaxValue, inclusively
/// </summary>
[CLSCompliant(false)]
public override uint NextUInt32()
{
uint t = (m_x ^ (m_x << 11));
m_x = m_y; m_y = m_z; m_z = m_w;
return (m_w = (m_w ^ (m_w >> 19)) ^ (t ^ (t >> 8)));
}
}
/// <summary>
/// Mersenne Twister based random
/// </summary>
public sealed class MersenneTwisterRandom : NetRandom
{
/// <summary>
/// Get global instance of MersenneTwisterRandom
/// </summary>
public static new readonly MersenneTwisterRandom Instance = new MersenneTwisterRandom();
private const int N = 624;
private const int M = 397;
private const uint MATRIX_A = 0x9908b0dfU;
private const uint UPPER_MASK = 0x80000000U;
private const uint LOWER_MASK = 0x7fffffffU;
private const uint TEMPER1 = 0x9d2c5680U;
private const uint TEMPER2 = 0xefc60000U;
private const int TEMPER3 = 11;
private const int TEMPER4 = 7;
private const int TEMPER5 = 15;
private const int TEMPER6 = 18;
private UInt32[] mt;
private int mti;
private UInt32[] mag01;
private const double c_realUnitInt = 1.0 / ((double)int.MaxValue + 1.0);
/// <summary>
/// Constructor with randomized seed
/// </summary>
public MersenneTwisterRandom()
{
Initialize(NetRandomSeed.GetUInt32());
}
/// <summary>
/// Constructor with provided 32 bit seed
/// </summary>
[CLSCompliant(false)]
public MersenneTwisterRandom(uint seed)
{
Initialize(seed);
}
/// <summary>
/// (Re)initialize this instance with provided 32 bit seed
/// </summary>
[CLSCompliant(false)]
public override void Initialize(uint seed)
{
mt = new UInt32[N];
mti = N + 1;
mag01 = new UInt32[] { 0x0U, MATRIX_A };
mt[0] = seed;
for (int i = 1; i < N; i++)
mt[i] = (UInt32)(1812433253 * (mt[i - 1] ^ (mt[i - 1] >> 30)) + i);
}
/// <summary>
/// Generates a random value from UInt32.MinValue to UInt32.MaxValue, inclusively
/// </summary>
[CLSCompliant(false)]
public override uint NextUInt32()
{
UInt32 y;
if (mti >= N)
{
GenRandAll();
mti = 0;
}
y = mt[mti++];
y ^= (y >> TEMPER3);
y ^= (y << TEMPER4) & TEMPER1;
y ^= (y << TEMPER5) & TEMPER2;
y ^= (y >> TEMPER6);
return y;
}
private void GenRandAll()
{
int kk = 1;
UInt32 y;
UInt32 p;
y = mt[0] & UPPER_MASK;
do
{
p = mt[kk];
mt[kk - 1] = mt[kk + (M - 1)] ^ ((y | (p & LOWER_MASK)) >> 1) ^ mag01[p & 1];
y = p & UPPER_MASK;
} while (++kk < N - M + 1);
do
{
p = mt[kk];
mt[kk - 1] = mt[kk + (M - N - 1)] ^ ((y | (p & LOWER_MASK)) >> 1) ^ mag01[p & 1];
y = p & UPPER_MASK;
} while (++kk < N);
p = mt[0];
mt[N - 1] = mt[M - 1] ^ ((y | (p & LOWER_MASK)) >> 1) ^ mag01[p & 1];
}
}
/// <summary>
/// RNGCryptoServiceProvider based random; very slow but cryptographically safe
/// </summary>
public class CryptoRandom : NetRandom
{
/// <summary>
/// Global instance of CryptoRandom
/// </summary>
public static new readonly CryptoRandom Instance = new CryptoRandom();
private RandomNumberGenerator m_rnd = new RNGCryptoServiceProvider();
/// <summary>
/// Seed in CryptoRandom does not create deterministic sequences
/// </summary>
[CLSCompliant(false)]
public override void Initialize(uint seed)
{
byte[] tmp = new byte[seed % 16];
m_rnd.GetBytes(tmp); // just prime it
}
/// <summary>
/// Generates a random value from UInt32.MinValue to UInt32.MaxValue, inclusively
/// </summary>
[CLSCompliant(false)]
public override uint NextUInt32()
{
var bytes = new byte[4];
m_rnd.GetBytes(bytes);
return (uint)bytes[0] | (((uint)bytes[1]) << 8) | (((uint)bytes[2]) << 16) | (((uint)bytes[3]) << 24);
}
/// <summary>
/// Fill the specified buffer with random values
/// </summary>
public override void NextBytes(byte[] buffer)
{
m_rnd.GetBytes(buffer);
}
/// <summary>
/// Fills all bytes from offset to offset + length in buffer with random values
/// </summary>
public override void NextBytes(byte[] buffer, int offset, int length)
{
var bytes = new byte[length];
m_rnd.GetBytes(bytes);
Array.Copy(bytes, 0, buffer, offset, length);
}
}
}

View File

@@ -1,45 +0,0 @@
using System;
using System.Threading;
namespace Lidgren.Network
{
/// <summary>
/// Class for generating random seeds
/// </summary>
public static class NetRandomSeed
{
private static int m_seedIncrement = -1640531527;
/// <summary>
/// Generates a 32 bit random seed
/// </summary>
[CLSCompliant(false)]
public static uint GetUInt32()
{
ulong seed = GetUInt64();
uint low = (uint)seed;
uint high = (uint)(seed >> 32);
return low ^ high;
}
/// <summary>
/// Generates a 64 bit random seed
/// </summary>
[CLSCompliant(false)]
public static ulong GetUInt64()
{
var guidBytes = Guid.NewGuid().ToByteArray();
ulong seed =
((ulong)guidBytes[0] << (8 * 0)) |
((ulong)guidBytes[1] << (8 * 1)) |
((ulong)guidBytes[2] << (8 * 2)) |
((ulong)guidBytes[3] << (8 * 3)) |
((ulong)guidBytes[4] << (8 * 4)) |
((ulong)guidBytes[5] << (8 * 5)) |
((ulong)guidBytes[6] << (8 * 6)) |
((ulong)guidBytes[7] << (8 * 7));
return seed ^ NetUtility.GetPlatformSeed(m_seedIncrement);
}
}
}

View File

@@ -27,6 +27,7 @@ using System.Net.Sockets;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Lidgren.Network
{
@@ -85,7 +86,8 @@ namespace Lidgren.Network
IPAddress ipAddress = null;
if (IPAddress.TryParse(ipOrHost, out ipAddress))
{
if (ipAddress.AddressFamily == AddressFamily.InterNetwork)
if (ipAddress.AddressFamily == AddressFamily.InterNetwork
|| ipAddress.AddressFamily == AddressFamily.InterNetworkV6)
{
callback(ipAddress);
return;
@@ -123,16 +125,23 @@ namespace Lidgren.Network
}
// check each entry for a valid IP address
IPAddress bestAddress = null;
foreach (IPAddress ipCurrent in entry.AddressList)
{
if (ipCurrent.AddressFamily == AddressFamily.InterNetwork)
// Prefer IPv6 addresses.
if (ipCurrent.AddressFamily == AddressFamily.InterNetworkV6)
{
callback(ipCurrent);
return;
}
if (ipCurrent.AddressFamily == AddressFamily.InterNetwork)
{
bestAddress = ipCurrent;
}
}
callback(null);
callback(bestAddress);
}, null);
}
catch (SocketException ex)
@@ -148,6 +157,34 @@ namespace Lidgren.Network
}
}
public static async Task<IPAddress[]> ResolveAsync(string ipOrHost)
{
if (string.IsNullOrEmpty(ipOrHost))
throw new ArgumentException("Supplied string must not be empty", "ipOrHost");
ipOrHost = ipOrHost.Trim();
if (IPAddress.TryParse(ipOrHost, out var ipAddress))
{
if (ipAddress.AddressFamily == AddressFamily.InterNetwork
|| ipAddress.AddressFamily == AddressFamily.InterNetworkV6)
{
return new[] {ipAddress};
}
throw new ArgumentException("This method will not currently resolve other than IPv4 or IPv6 addresses");
}
try
{
var entry = await Dns.GetHostEntryAsync(ipOrHost);
return entry.AddressList;
}
catch (SocketException)
{
return null;
}
}
/// <summary>
/// Get IPv4 address from notation (xxx.xxx.xxx.xxx) or hostname
/// </summary>
@@ -161,7 +198,8 @@ namespace Lidgren.Network
IPAddress ipAddress = null;
if (IPAddress.TryParse(ipOrHost, out ipAddress))
{
if (ipAddress.AddressFamily == AddressFamily.InterNetwork)
if (ipAddress.AddressFamily == AddressFamily.InterNetwork
|| ipAddress.AddressFamily == AddressFamily.InterNetworkV6)
return ipAddress;
throw new ArgumentException("This method will not currently resolve other than ipv4 addresses");
}
@@ -175,13 +213,22 @@ namespace Lidgren.Network
return null;
// check each entry for a valid IP address
IPAddress bestAddress = null;
foreach (IPAddress ipCurrent in entry.AddressList)
{
if (ipCurrent.AddressFamily == AddressFamily.InterNetwork)
if (ipCurrent.AddressFamily == AddressFamily.InterNetworkV6)
{
return ipCurrent;
}
// Prefer IPv6 addresses.
if (ipCurrent.AddressFamily == AddressFamily.InterNetwork)
{
bestAddress = ipCurrent;
}
}
return null;
return bestAddress;
}
catch (SocketException ex)
{
@@ -263,7 +310,7 @@ namespace Lidgren.Network
}
return new string(c);
}
/// <summary>
/// Gets the local broadcast address
/// </summary>
@@ -275,7 +322,7 @@ namespace Lidgren.Network
if (wifi.IsWifiEnabled)
{
var dhcp = wifi.DhcpInfo;
int broadcast = (dhcp.IpAddress & dhcp.Netmask) | ~dhcp.Netmask;
byte[] quads = new byte[4];
for (int k = 0; k < 4; k++)
@@ -289,7 +336,7 @@ namespace Lidgren.Network
{
return IPAddress.Broadcast;
}
#endif
#endif
#if IS_FULL_NET_AVAILABLE
try
{
@@ -298,7 +345,7 @@ namespace Lidgren.Network
{
return null;
}
IPInterfaceProperties properties = ni.GetIPProperties();
foreach (UnicastIPAddressInformation unicastAddress in properties.UnicastAddresses)
{
@@ -307,24 +354,24 @@ namespace Lidgren.Network
var mask = unicastAddress.IPv4Mask;
byte[] ipAdressBytes = unicastAddress.Address.GetAddressBytes();
byte[] subnetMaskBytes = mask.GetAddressBytes();
if (ipAdressBytes.Length != subnetMaskBytes.Length)
throw new ArgumentException("Lengths of IP address and subnet mask do not match.");
byte[] broadcastAddress = new byte[ipAdressBytes.Length];
for (int i = 0; i < broadcastAddress.Length; i++)
{
broadcastAddress[i] = (byte)(ipAdressBytes[i] | (subnetMaskBytes[i] ^ 255));
}
return new IPAddress(broadcastAddress);
return new IPAddress(broadcastAddress);
}
}
}
catch // Catch any errors
catch // Catch any errors
{
return IPAddress.Broadcast;
}
#endif
#endif
return IPAddress.Broadcast;
}
@@ -340,21 +387,21 @@ namespace Lidgren.Network
Android.Net.Wifi.WifiManager wifi = (Android.Net.Wifi.WifiManager)Android.App.Application.Context.GetSystemService(Android.App.Activity.WifiService);
if (!wifi.IsWifiEnabled) return null;
var dhcp = wifi.DhcpInfo;
int addr = dhcp.IpAddress;
byte[] quads = new byte[4];
for (int k = 0; k < 4; k++)
{
quads[k] = (byte) ((addr >> k * 8) & 0xFF);
}
}
return new IPAddress(quads);
}
catch // Catch Access Denied errors
{
return null;
}
#endif
#endif
#if IS_FULL_NET_AVAILABLE
NetworkInterface ni = GetNetworkInterface();
if (ni == null)
@@ -391,6 +438,11 @@ namespace Lidgren.Network
/// </summary>
public static bool IsLocal(IPAddress remote)
{
if (remote.AddressFamily == AddressFamily.InterNetworkV6)
{
// TODO: Can this be made to work? Do we even care for SS14?
return false;
}
IPAddress mask;
IPAddress local = GetMyAddress(out mask);
@@ -577,4 +629,4 @@ namespace Lidgren.Network
return bdr.ToString();
}
}
}
}

View File

@@ -1,87 +0,0 @@
#if __ANDROID__
using System;
using System.Collections.Generic;
using System.Net;
namespace Lidgren.Network
{
public static partial class NetUtility
{
private static byte[] s_randomMacBytes;
static NetUtility()
{
s_randomMacBytes = new byte[8];
MWCRandom.Instance.NextBytes(s_randomMacBytes);
}
[CLSCompliant(false)]
public static ulong GetPlatformSeed(int seedInc)
{
ulong seed = (ulong)Environment.TickCount + (ulong)seedInc;
return seed ^ ((ulong)(new object().GetHashCode()) << 32);
}
/// <summary>
/// Gets my local IPv4 address (not necessarily external) and subnet mask
/// </summary>
public static IPAddress GetMyAddress(out IPAddress mask)
{
mask = null;
try
{
Android.Net.Wifi.WifiManager wifi = (Android.Net.Wifi.WifiManager)Android.App.Application.Context.GetSystemService(Android.App.Activity.WifiService);
if (!wifi.IsWifiEnabled)
return null;
var dhcp = wifi.DhcpInfo;
int addr = dhcp.IpAddress;
byte[] quads = new byte[4];
for (int k = 0; k < 4; k++)
quads[k] = (byte)((addr >> k * 8) & 0xFF);
return new IPAddress(quads);
}
catch // Catch Access Denied errors
{
return null;
}
}
public static byte[] GetMacAddressBytes()
{
return s_randomMacBytes;
}
public static void Sleep(int milliseconds)
{
System.Threading.Thread.Sleep(milliseconds);
}
public static IPAddress GetBroadcastAddress()
{
return IPAddress.Broadcast;
}
public static IPAddress CreateAddressFromBytes(byte[] bytes)
{
return new IPAddress(bytes);
}
private static readonly SHA1 s_sha = SHA1.Create();
public static byte[] ComputeSHAHash(byte[] bytes, int offset, int count)
{
return s_sha.ComputeHash(bytes, offset, count);
}
}
public static partial class NetTime
{
private static readonly long s_timeInitialized = Environment.TickCount;
/// <summary>
/// Get number of seconds since the application started
/// </summary>
public static double Now { get { return (double)((uint)Environment.TickCount - s_timeInitialized) / 1000.0; } }
}
}
#endif

View File

@@ -1,86 +0,0 @@
#if __CONSTRAINED__ || UNITY_STANDALONE_LINUX
using System;
using System.Collections.Generic;
using System.Net;
using System.Security.Cryptography;
namespace Lidgren.Network
{
public static partial class NetUtility
{
private static byte[] s_randomMacBytes;
static NetUtility()
{
s_randomMacBytes = new byte[8];
MWCRandom.Instance.NextBytes(s_randomMacBytes);
}
[CLSCompliant(false)]
public static ulong GetPlatformSeed(int seedInc)
{
ulong seed = (ulong)Environment.TickCount + (ulong)seedInc;
return seed ^ ((ulong)(new object().GetHashCode()) << 32);
}
/// <summary>
/// Gets my local IPv4 address (not necessarily external) and subnet mask
/// </summary>
public static IPAddress GetMyAddress(out IPAddress mask)
{
mask = null;
#if UNITY_ANDROID || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX || UNITY_IOS
try
{
if (!(UnityEngine.Application.internetReachability == UnityEngine.NetworkReachability.NotReachable))
{
return null;
}
return IPAddress.Parse(UnityEngine.Network.player.externalIP);
}
catch // Catch Access Denied errors
{
return null;
}
#endif
return null;
}
public static byte[] GetMacAddressBytes()
{
return s_randomMacBytes;
}
public static IPAddress GetBroadcastAddress()
{
return IPAddress.Broadcast;
}
public static void Sleep(int milliseconds)
{
System.Threading.Thread.Sleep(milliseconds);
}
public static IPAddress CreateAddressFromBytes(byte[] bytes)
{
return new IPAddress(bytes);
}
private static readonly SHA1 s_sha = SHA1.Create();
public static byte[] ComputeSHAHash(byte[] bytes, int offset, int count)
{
return s_sha.ComputeHash(bytes, offset, count);
}
}
public static partial class NetTime
{
private static readonly long s_timeInitialized = Environment.TickCount;
/// <summary>
/// Get number of seconds since the application started
/// </summary>
public static double Now { get { return (double)((uint)Environment.TickCount - s_timeInitialized) / 1000.0; } }
}
}
#endif

View File

@@ -1,156 +0,0 @@
#if !__ANDROID__ && !__CONSTRAINED__ && !WINDOWS_RUNTIME && !UNITY_STANDALONE_LINUX
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Security.Cryptography;
namespace Lidgren.Network
{
public static partial class NetUtility
{
private static readonly long s_timeInitialized = Stopwatch.GetTimestamp();
private static readonly double s_dInvFreq = 1.0 / (double)Stopwatch.Frequency;
[CLSCompliant(false)]
public static ulong GetPlatformSeed(int seedInc)
{
ulong seed = (ulong)System.Diagnostics.Stopwatch.GetTimestamp();
return seed ^ ((ulong)Environment.WorkingSet + (ulong)seedInc);
}
public static double Now { get { return (double)(Stopwatch.GetTimestamp() - s_timeInitialized) * s_dInvFreq; } }
private static NetworkInterface GetNetworkInterface()
{
var computerProperties = IPGlobalProperties.GetIPGlobalProperties();
if (computerProperties == null)
return null;
var nics = NetworkInterface.GetAllNetworkInterfaces();
if (nics == null || nics.Length < 1)
return null;
NetworkInterface best = null;
foreach (NetworkInterface adapter in nics)
{
if (adapter.NetworkInterfaceType == NetworkInterfaceType.Loopback || adapter.NetworkInterfaceType == NetworkInterfaceType.Unknown)
continue;
if (!adapter.Supports(NetworkInterfaceComponent.IPv4))
continue;
if (best == null)
best = adapter;
if (adapter.OperationalStatus != OperationalStatus.Up)
continue;
// make sure this adapter has any ipv4 addresses
IPInterfaceProperties properties = adapter.GetIPProperties();
foreach (UnicastIPAddressInformation unicastAddress in properties.UnicastAddresses)
{
if (unicastAddress != null && unicastAddress.Address != null && unicastAddress.Address.AddressFamily == AddressFamily.InterNetwork)
{
// Yes it does, return this network interface.
return adapter;
}
}
}
return best;
}
/// <summary>
/// If available, returns the bytes of the physical (MAC) address for the first usable network interface
/// </summary>
public static byte[] GetMacAddressBytes()
{
var ni = GetNetworkInterface();
if (ni == null)
return null;
return ni.GetPhysicalAddress().GetAddressBytes();
}
public static IPAddress GetBroadcastAddress()
{
var ni = GetNetworkInterface();
if (ni == null)
return null;
var properties = ni.GetIPProperties();
foreach (UnicastIPAddressInformation unicastAddress in properties.UnicastAddresses)
{
if (unicastAddress != null && unicastAddress.Address != null && unicastAddress.Address.AddressFamily == AddressFamily.InterNetwork)
{
var mask = unicastAddress.IPv4Mask;
byte[] ipAdressBytes = unicastAddress.Address.GetAddressBytes();
byte[] subnetMaskBytes = mask.GetAddressBytes();
if (ipAdressBytes.Length != subnetMaskBytes.Length)
throw new ArgumentException("Lengths of IP address and subnet mask do not match.");
byte[] broadcastAddress = new byte[ipAdressBytes.Length];
for (int i = 0; i < broadcastAddress.Length; i++)
{
broadcastAddress[i] = (byte)(ipAdressBytes[i] | (subnetMaskBytes[i] ^ 255));
}
return new IPAddress(broadcastAddress);
}
}
return IPAddress.Broadcast;
}
/// <summary>
/// Gets my local IPv4 address (not necessarily external) and subnet mask
/// </summary>
public static IPAddress GetMyAddress(out IPAddress mask)
{
var ni = GetNetworkInterface();
if (ni == null)
{
mask = null;
return null;
}
IPInterfaceProperties properties = ni.GetIPProperties();
foreach (UnicastIPAddressInformation unicastAddress in properties.UnicastAddresses)
{
if (unicastAddress != null && unicastAddress.Address != null && unicastAddress.Address.AddressFamily == AddressFamily.InterNetwork)
{
mask = unicastAddress.IPv4Mask;
return unicastAddress.Address;
}
}
mask = null;
return null;
}
public static void Sleep(int milliseconds)
{
System.Threading.Thread.Sleep(milliseconds);
}
public static IPAddress CreateAddressFromBytes(byte[] bytes)
{
return new IPAddress(bytes);
}
private static readonly SHA256 s_sha = SHA256.Create();
public static byte[] ComputeSHAHash(byte[] bytes, int offset, int count)
{
return s_sha.ComputeHash(bytes, offset, count);
}
}
public static partial class NetTime
{
private static readonly long s_timeInitialized = Stopwatch.GetTimestamp();
private static readonly double s_dInvFreq = 1.0 / (double)Stopwatch.Frequency;
/// <summary>
/// Get number of seconds since the application started
/// </summary>
public static double Now { get { return (double)(Stopwatch.GetTimestamp() - s_timeInitialized) * s_dInvFreq; } }
}
}
#endif

View File

@@ -1,102 +0,0 @@
#if WINDOWS_RUNTIME
//
//
//
// Completely broken right now
//
//
//
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Security.Cryptography;
using System.Threading.Tasks;
namespace Lidgren.Network
{
public class NetAddress
{
public static readonly HostName Any = null;
}
public class NetEndPoint
{
public NetEndPoint(HostName hostname, int port) { HostName = hostname; Port = port; }
public NetEndPoint(HostName hostname, string port) { HostName = hostname; Port = int.Parse(port); }
public NetEndPoint(string hostname, int port) { HostName = (hostname == null) ? null : new HostName(hostname); Port = port; }
public HostName HostName;
public int Port;
public override string ToString() { return string.Format("{0}:{1}", HostName, Port); }
public override int GetHashCode()
{
return HostName.RawName.GetHashCode() + Port;
}
public override bool Equals(object obj)
{
var ep = obj as NetEndPoint;
if (ep == null) return false;
if (Port != ep.Port) return false;
return HostName.RawName.Equals(ep.HostName.RawName);
}
};
public static partial class NetUtility
{
[CLSCompliant(false)]
public static ulong GetPlatformSeed(int seedInc)
{
ulong seed = (ulong)Environment.TickCount + (ulong)seedInc;
return seed ^ ((ulong)(new object().GetHashCode()) << 32);
}
/// <summary>
/// Returns the physical (MAC) address for the first usable network interface
/// </summary>
public static PhysicalAddress GetMacAddress()
{
throw new NotImplementedException();
}
public static IPAddress GetBroadcastAddress()
{
throw new NotImplementedException();
}
/// <summary>
/// Gets my local IPv4 address (not necessarily external) and subnet mask
/// </summary>
public static IPAddress GetMyAddress(out IPAddress mask)
{
throw new NotImplementedException();
}
public static void Sleep(int milliseconds)
{
Task.Delay(50).Wait();
}
public static NetAddress CreateAddressFromBytes(byte[] bytes)
{
throw new NotImplementedException();
}
private static readonly SHA1CryptoServiceProvider s_sha = new SHA1CryptoServiceProvider();
public static byte[] ComputeSHAHash(byte[] bytes, int offset, int count)
{
return s_sha.ComputeHash(bytes, offset, count);
}
}
public static partial class NetTime
{
private static readonly long s_timeInitialized = Environment.TickCount;
/// <summary>
/// Get number of seconds since the application started
/// </summary>
public static double Now { get { return (double)((uint)Environment.TickCount - s_timeInitialized) / 1000.0; } }
}
}
#endif

View File

@@ -0,0 +1,23 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<!-- Adds to the DefineConstants to provide things such as platform-specific defines. -->
<Choose>
<When Condition="'$(TargetOS)' == 'Windows'">
<PropertyGroup>
<DefineConstants>$(DefineConstants);WINDOWS</DefineConstants>
</PropertyGroup>
</When>
<When Condition="'$(TargetOS)' == 'MacOS'" >
<PropertyGroup>
<DefineConstants>$(DefineConstants);MACOS;UNIX</DefineConstants>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<DefineConstants>$(DefineConstants);LINUX;UNIX</DefineConstants>
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup Condition="'$(FullRelease)' == 'True'">
<DefineConstants>$(DefineConstants);FULL_RELEASE</DefineConstants>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,27 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<PropertyGroup>
<RobustToolsPath>$(MSBuildThisFileDirectory)/../Tools/</RobustToolsPath>
</PropertyGroup>
<Target Name="CopySwnfd">
<CombinePath BasePath="$(RobustToolsPath)" Paths="download_swnfd.py">
<Output TaskParameter="CombinedPaths" PropertyName="ScriptPath" />
</CombinePath>
<Exec Condition="'$(Platform)' == 'x64'" Command="$(Python) &quot;$(ScriptPath)&quot; $(Platform) $(TargetOS) $(OutputPath)" CustomErrorRegularExpression="^Error" />
<Warning Condition="'$(Platform)' != 'x64'" Text="Did not download swnfd because the platform is not set to x64. Only use this build for unit testing!" />
</Target>
<Target Name="CopyGlfw">
<CombinePath BasePath="$(RobustToolsPath)" Paths="download_glfw.py">
<Output TaskParameter="CombinedPaths" PropertyName="ScriptPath" />
</CombinePath>
<Exec Condition="'$(Platform)' == 'x64'" Command="$(Python) &quot;$(ScriptPath)&quot; $(Platform) $(TargetOS) $(OutputPath)" CustomErrorRegularExpression="^Error" />
<Warning Condition="'$(Platform)' != 'x64'" Text="Did not download GLFW because the platform is not set to x64. Only use this build for unit testing!" />
</Target>
<Target Name="CopyMiscDependencies">
<CombinePath BasePath="$(RobustToolsPath)" Paths="download_misc_dependencies.py">
<Output TaskParameter="CombinedPaths" PropertyName="ScriptPath" />
</CombinePath>
<Exec Condition="'$(Platform)' == 'x64'" Command="$(Python) &quot;$(ScriptPath)&quot; $(Platform) $(TargetOS) $(OutputPath)" CustomErrorRegularExpression="^Error" />
<Warning Condition="'$(Platform)' != 'x64'" Text="Did not download misc dependencies because the platform is not set to x64. Only use this build for unit testing!" />
</Target>
<Target Name="ClientAfterBuild" DependsOnTargets="CopyMiscDependencies;CopySwnfd;CopyGlfw" />
</Project>

View File

@@ -1,4 +1,5 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<Import Project="Robust.Custom.targets" Condition="Exists('Robust.Custom.targets')"/>
<!-- MSBuild hurts and I can't find a foolproof way to detect platform. -->
<PropertyGroup>
<OS Condition="'$(OS)' == ''">Windows_NT</OS>
@@ -23,5 +24,8 @@
</Choose>
<PropertyGroup>
<TargetOS Condition="'$(TargetOS)' == ''">$(ActualOS)</TargetOS>
<Python>python3</Python>
<Python Condition="'$(ActualOS)' == 'Windows'">py -3</Python>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
</Project>

View File

@@ -1,9 +0,0 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<Target Name="CopyResourcesFromShared">
<ItemGroup>
<_ResourceFiles Include="$(SolutionDir)bin\Shared\Resources\**\*.*" />
</ItemGroup>
<RemoveDir Directories="$(OutputPath)Resources" />
<Copy SourceFiles="@(_ResourceFiles)" DestinationFolder="$(OutputPath)Resources\%(RecursiveDir)" />
</Target>
</Project>

View File

@@ -0,0 +1,18 @@
//
// Cursor.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Opaque handle to a GLFW cursor.
/// </summary>
public struct Cursor
{
}
}

View File

@@ -0,0 +1,33 @@
//
// ClientApi.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// The context client APIs.
/// </summary>
/// <seealso cref="GLFW.WindowHint(WindowHintClientApi,ClientApi)"/>
public enum ClientApi
{
/// <summary>
/// No context API is created.
/// </summary>
NoApi = 0,
/// <summary>
/// OpenGL context is created.
/// </summary>
OpenGlApi = 0x00030001,
/// <summary>
/// OpenGL ES context is created.
/// </summary>
OpenGlEsApi = 0x00030002
}
}

View File

@@ -0,0 +1,27 @@
//
// ConnectedState.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Specifies connected state of devices.
/// </summary>
public enum ConnectedState
{
/// <summary>
/// Indicates that a device is connected.
/// </summary>
Connected = 0x00040001,
/// <summary>
/// Indicates that a device is disconnected.
/// </summary>
Disconnected = 0x00040002
}
}

View File

@@ -0,0 +1,27 @@
//
// ContextApi.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// The context API used to create the window context.
/// </summary>
public enum ContextApi
{
/// <summary>
/// Uses the native context API to create the window context.
/// </summary>
NativeContextApi = 0x00036001,
/// <summary>
/// Uses Egl to create the window context.
/// </summary>
EglContextApi = 0x00036002
}
}

View File

@@ -0,0 +1,37 @@
//
// CursorModeValue.cs
//
// Copyright (C) 2018 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// The GLFW cursor modes.
/// See <a href="https://www.glfw.org/docs/latest/input_guide.html#cursor_mode">cursor modes</a>.
/// </summary>
public enum CursorModeValue
{
/// <summary>
/// The regular arrow cursor (or another cursor set with <see cref="GLFW.SetCursor"/>) is used
/// and cursor motion is not limited.
/// </summary>
CursorNormal = 0x00034001,
/// <summary>
/// Hides the arrow cursor when over a window.
/// </summary>
CursorHidden = 0x00034002,
/// <summary>
/// Will hide the cursor and lock it to the specified window.
/// GLFW will then take care of all the details of cursor re-centering and offset calculation
/// and providing the application with a virtual cursor position.
/// This virtual position is provided normally via both the cursor position callback and through polling.
/// </summary>
CursorDisabled = 0x00034003
}
}

View File

@@ -0,0 +1,47 @@
//
// CursorShape.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Standard cursor shapes.
/// </summary>
public enum CursorShape
{
/// <summary>
/// The standard arrow shape. Used in almost all situations.
/// </summary>
Arrow = 0x00036001,
/// <summary>
/// The I-Beam shape. Used when mousing over a place where text can be entered.
/// </summary>
IBeam = 0x00036002,
/// <summary>
/// The crosshair shape. Used when dragging and dropping.
/// </summary>
Crosshair = 0x00036003,
/// <summary>
/// The hand shape. Used when mousing over something that can be dragged around.
/// </summary>
Hand = 0x00036004,
/// <summary>
/// The horizontal resize shape. Used when mousing over something that can be horizontally resized.
/// </summary>
HResize = 0x00036005,
/// <summary>
/// The vertical resize shape. Used when mousing over something that can be vertically resized.
/// </summary>
VResize = 0x00036006
}
}

View File

@@ -0,0 +1,24 @@
//
// CursorStateAttribute.cs
//
// Copyright (C) 2018 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Attribute for setting <see cref="CursorModeValue"/> of the cursor.
/// </summary>
/// <seealso cref="GLFW.SetInputMode(Window*,CursorStateAttribute,CursorModeValue)"/>
/// <seealso cref="GLFW.GetInputMode(Window*,CursorStateAttribute)"/>
public enum CursorStateAttribute
{
/// <summary>
/// Attribute for setting <see cref="CursorModeValue"/> of the cursor.
/// </summary>
Cursor = 0x00033001,
}
}

View File

@@ -0,0 +1,103 @@
//
// ErrorCode.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Error codes, used in the error callback.
/// </summary>
public enum ErrorCode
{
/// <summary>
/// Everything is running as intended. Yay!
/// </summary>
NoError = 0,
/// <summary>
/// Called a function before calling <see cref="GLFW.Init"/>. Initialize GLFW and then try again.
/// </summary>
NotInitialized = 0x00010001,
/// <summary>
/// No OpenGL/OpenGL ES context on this thread.
/// </summary>
NoContext = 0x00010002,
/// <summary>
/// Used an invalid enum value on a function.
/// </summary>
/// <remarks>
/// <para>
/// This should hopefully never happen in the bindings, due to the added type safety of C# enums VS. GLFW's native #defines
/// </para>
/// </remarks>
InvalidEnum = 0x00010003,
/// <summary>
/// Called a function with an invalid argument.
/// </summary>
/// <remarks>
/// <para>
/// This can happen if you request an OpenGL version that doesn't exist, like 2.7.
/// </para>
/// <para>
/// If you request a version of OpenGL that exists, but isn't supported by this graphics card, it will return VersionUnavailable instead.
/// </para>
/// </remarks>
InvalidValue = 0x00010004,
/// <summary>
/// A memory allocation failed on GLFW's end.
/// </summary>
/// <remarks>
/// <para>
/// Report this to the GLFW issue tracker if encountered.
/// </para>
/// </remarks>
OutOfMemory = 0x00010005,
/// <summary>
/// The requested API is not available on the system.
/// </summary>
ApiUnavailable = 0x00010006,
/// <summary>
/// The requested OpenGL version is not available on the system.
/// </summary>
VersionUnavailable = 0x00010007,
/// <summary>
/// A platform-specific error occurred that doesn't fit into any more specific category.
/// </summary>
/// <remarks>
/// <para>
/// Report this to the GLFW issue tracker if encountered.
/// </para>
/// </remarks>
PlatformError = 0x00010008,
/// <summary>
/// The requested format is unavailable.
/// </summary>
/// <remarks>
/// <para>
/// If emitted during window creation, the requested pixel format isn't available.
/// </para>
/// <para>
/// If emitted when using the clipboard, the contents of the clipboard couldn't be converted to the requested format.
/// </para>
/// </remarks>
FormatUnavailable = 0x00010009,
/// <summary>
/// There is no OpenGL/OpenGL ES context attached to this window.
/// </summary>
NoWindowContext = 0x0001000A
}
}

View File

@@ -0,0 +1,46 @@
//
// InitHint.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Initialization hints are set before <see cref="GLFW.Init"/> and affect how the library behaves until termination.
/// Hints are set with <see cref="GLFW.InitHint(InitHintBool, bool)"/>.
/// </summary>
public enum InitHintBool
{
/// <summary>
/// Used to specify whether to also expose joystick hats as buttons,
/// for compatibility with earlier versions of GLFW that did not have
/// <see cref="GLFW.GetJoystickHats"/>.
/// Set this with <see cref="GLFW.InitHint(InitHintBool, bool)"/>.
/// </summary>
JoystickHatButtons = 0x00050001,
/// <summary>
/// Used to specify whether to set the current directory to the application to the Contents/Resources
/// subdirectory of the application's bundle, if present.
/// Set this with <see cref="GLFW.InitHint(InitHintBool, bool)"/>.
/// </summary>
/// <remarks>
/// Only affects macOS; no effect on other platforms.
/// </remarks>
CocoaChdirResources = 0x00051001,
/// <summary>
/// Used to specify whether to create a basic menu bar, either from a nib or manually,
/// when the first window is created, which is when AppKit is initialized.
/// Set this with <see cref="GLFW.InitHint(InitHintBool, bool)"/>.
/// </summary>
/// <remarks>
/// Only affects macOS; no effect on other platforms.
/// </remarks>
CocoaMenubar = 0x00051002
}
}

View File

@@ -0,0 +1,15 @@
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Initialization hints are set before <see cref="GLFW.Init"/> and affect how the library behaves until termination.
/// Hints are set with <see cref="GLFW.InitHint(InitHintInt, int)"/>.
/// </summary>
/// <remarks>
/// While this enum has no members,
/// it can still be useful because it allows you to access the direct <c>glfwInitHint(int, int)</c> API.
/// In case a future version of GLFW adds an int-taking int hint and we don't handle it.
/// </remarks>
public enum InitHintInt
{
}
}

View File

@@ -0,0 +1,33 @@
//
// InputAction.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Defines event information for <see cref="GLFWCallbacks.KeyCallback"/>
/// or <see cref="GLFWCallbacks.MouseButtonCallback"/>.
/// </summary>
public enum InputAction
{
/// <summary>
/// The key or mouse button was released.
/// </summary>
Release = 0,
/// <summary>
/// The key or mouse button was pressed.
/// </summary>
Press = 1,
/// <summary>
/// The key was held down until it repeated.
/// </summary>
Repeat = 2
}
}

View File

@@ -0,0 +1,53 @@
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Status of a joystick hat.
/// </summary>
public enum JoystickHats : byte
{
/// <summary>
/// Hat is centered.
/// </summary>
Centered = 0,
/// <summary>
/// Hat is pointing up.
/// </summary>
Up = 1,
/// <summary>
/// Hat is pointing right.
/// </summary>
Right = 2,
/// <summary>
/// Hat is pointing down.
/// </summary>
Down = 4,
/// <summary>
/// Hat is pointing left.
/// </summary>
Left = 8,
/// <summary>
/// Hat is pointing up and to the right.
/// </summary>
RightUp = Right | Up,
/// <summary>
/// Hat is pointing down and to the right.
/// </summary>
RightDown = Right | Down,
/// <summary>
/// Hat is pointing up and to the left.
/// </summary>
LeftUp = Left | Up,
/// <summary>
/// Hat is pointing down and to the left.
/// </summary>
LeftDown = Left | Down,
}
}

View File

@@ -0,0 +1,50 @@
//
// KeyModifiers.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
using System;
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Key modifiers, such as Shift or CTRL.
/// </summary>
[Flags]
public enum KeyModifiers
{
/// <summary>
/// if one or more Shift keys were held down.
/// </summary>
Shift = 0x0001,
/// <summary>
/// If one or more Control keys were held down.
/// </summary>
Control = 0x0002,
/// <summary>
/// If one or more Alt keys were held down.
/// </summary>
Alt = 0x0004,
/// <summary>
/// If one or more Super keys were held down.
/// </summary>
Super = 0x0008,
/// <summary>
/// If caps lock is enabled.
/// </summary>
CapsLock = 0x0010,
/// <summary>
/// If num lock is enabled.
/// </summary>
NumLock = 0x0020,
}
}

View File

@@ -0,0 +1,627 @@
//
// Keys.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Specifies key codes and modifiers in US keyboard layout.
/// </summary>
public enum Keys
{
/// <summary>
/// An unknown key.
/// </summary>
Unknown = -1,
/// <summary>
/// The spacebar key.
/// </summary>
Space = 32,
/// <summary>
/// The apostrophe key.
/// </summary>
Apostrophe = 39 /* ' */,
/// <summary>
/// The comma key.
/// </summary>
Comma = 44 /* , */,
/// <summary>
/// The minus key.
/// </summary>
Minus = 45 /* - */,
/// <summary>
/// The period key.
/// </summary>
Period = 46 /* . */,
/// <summary>
/// The slash key.
/// </summary>
Slash = 47 /* / */,
/// <summary>
/// The 0 key.
/// </summary>
D0 = 48,
/// <summary>
/// The 1 key.
/// </summary>
D1 = 49,
/// <summary>
/// The 2 key.
/// </summary>
D2 = 50,
/// <summary>
/// The 3 key.
/// </summary>
D3 = 51,
/// <summary>
/// The 4 key.
/// </summary>
D4 = 52,
/// <summary>
/// The 5 key.
/// </summary>
D5 = 53,
/// <summary>
/// The 6 key.
/// </summary>
D6 = 54,
/// <summary>
/// The 7 key.
/// </summary>
D7 = 55,
/// <summary>
/// The 8 key.
/// </summary>
D8 = 56,
/// <summary>
/// The 9 key.
/// </summary>
D9 = 57,
/// <summary>
/// The semicolon key.
/// </summary>
Semicolon = 59 /* ; */,
/// <summary>
/// The equal key.
/// </summary>
Equal = 61 /* = */,
/// <summary>
/// The A key.
/// </summary>
A = 65,
/// <summary>
/// The B key.
/// </summary>
B = 66,
/// <summary>
/// The C key.
/// </summary>
C = 67,
/// <summary>
/// The D key.
/// </summary>
D = 68,
/// <summary>
/// The E key.
/// </summary>
E = 69,
/// <summary>
/// The F key.
/// </summary>
F = 70,
/// <summary>
/// The G key.
/// </summary>
G = 71,
/// <summary>
/// The H key.
/// </summary>
H = 72,
/// <summary>
/// The I key.
/// </summary>
I = 73,
/// <summary>
/// The J key.
/// </summary>
J = 74,
/// <summary>
/// The K key.
/// </summary>
K = 75,
/// <summary>
/// The L key.
/// </summary>
L = 76,
/// <summary>
/// The M key.
/// </summary>
M = 77,
/// <summary>
/// The N key.
/// </summary>
N = 78,
/// <summary>
/// The O key.
/// </summary>
O = 79,
/// <summary>
/// The P key.
/// </summary>
P = 80,
/// <summary>
/// The Q key.
/// </summary>
Q = 81,
/// <summary>
/// The R key.
/// </summary>
R = 82,
/// <summary>
/// The S key.
/// </summary>
S = 83,
/// <summary>
/// The T key.
/// </summary>
T = 84,
/// <summary>
/// The U key.
/// </summary>
U = 85,
/// <summary>
/// The V key.
/// </summary>
V = 86,
/// <summary>
/// The W key.
/// </summary>
W = 87,
/// <summary>
/// The X key.
/// </summary>
X = 88,
/// <summary>
/// The Y key.
/// </summary>
Y = 89,
/// <summary>
/// The Z key.
/// </summary>
Z = 90,
/// <summary>
/// The left bracket(opening bracket) key.
/// </summary>
LeftBracket = 91 /* [ */,
/// <summary>
/// The backslash.
/// </summary>
Backslash = 92 /* \ */,
/// <summary>
/// The right bracket(closing bracket) key.
/// </summary>
RightBracket = 93 /* ] */,
/// <summary>
/// The grave accent key.
/// </summary>
GraveAccent = 96 /* ` */,
/// <summary>
/// Non US keyboard layout key 1.
/// </summary>
World1 = 161 /* non-US #1 */,
/// <summary>
/// Non US keyboard layout key 2.
/// </summary>
World2 = 162 /* non-US #2 */,
/// <summary>
/// The escape key.
/// </summary>
Escape = 256,
/// <summary>
/// The enter key.
/// </summary>
Enter = 257,
/// <summary>
/// The tab key.
/// </summary>
Tab = 258,
/// <summary>
/// The backspace key.
/// </summary>
Backspace = 259,
/// <summary>
/// The insert key.
/// </summary>
Insert = 260,
/// <summary>
/// The delete key.
/// </summary>
Delete = 261,
/// <summary>
/// The right arrow key.
/// </summary>
Right = 262,
/// <summary>
/// The left arrow key.
/// </summary>
Left = 263,
/// <summary>
/// The down arrow key.
/// </summary>
Down = 264,
/// <summary>
/// The up arrow key.
/// </summary>
Up = 265,
/// <summary>
/// The page up key.
/// </summary>
PageUp = 266,
/// <summary>
/// The page down key.
/// </summary>
PageDown = 267,
/// <summary>
/// The home key.
/// </summary>
Home = 268,
/// <summary>
/// The end key.
/// </summary>
End = 269,
/// <summary>
/// The caps lock key.
/// </summary>
CapsLock = 280,
/// <summary>
/// The scroll lock key.
/// </summary>
ScrollLock = 281,
/// <summary>
/// The num lock key.
/// </summary>
NumLock = 282,
/// <summary>
/// The print screen key.
/// </summary>
PrintScreen = 283,
/// <summary>
/// The pause key.
/// </summary>
Pause = 284,
/// <summary>
/// The F1 key.
/// </summary>
F1 = 290,
/// <summary>
/// The F2 key.
/// </summary>
F2 = 291,
/// <summary>
/// The F3 key.
/// </summary>
F3 = 292,
/// <summary>
/// The F4 key.
/// </summary>
F4 = 293,
/// <summary>
/// The F5 key.
/// </summary>
F5 = 294,
/// <summary>
/// The F6 key.
/// </summary>
F6 = 295,
/// <summary>
/// The F7 key.
/// </summary>
F7 = 296,
/// <summary>
/// The F8 key.
/// </summary>
F8 = 297,
/// <summary>
/// The F9 key.
/// </summary>
F9 = 298,
/// <summary>
/// The F10 key.
/// </summary>
F10 = 299,
/// <summary>
/// The F11 key.
/// </summary>
F11 = 300,
/// <summary>
/// The F12 key.
/// </summary>
F12 = 301,
/// <summary>
/// The F13 key.
/// </summary>
F13 = 302,
/// <summary>
/// The F14 key.
/// </summary>
F14 = 303,
/// <summary>
/// The F15 key.
/// </summary>
F15 = 304,
/// <summary>
/// The F16 key.
/// </summary>
F16 = 305,
/// <summary>
/// The F17 key.
/// </summary>
F17 = 306,
/// <summary>
/// The F18 key.
/// </summary>
F18 = 307,
/// <summary>
/// The F19 key.
/// </summary>
F19 = 308,
/// <summary>
/// The F20 key.
/// </summary>
F20 = 309,
/// <summary>
/// The F21 key.
/// </summary>
F21 = 310,
/// <summary>
/// The F22 key.
/// </summary>
F22 = 311,
/// <summary>
/// The F23 key.
/// </summary>
F23 = 312,
/// <summary>
/// The F24 key.
/// </summary>
F24 = 313,
/// <summary>
/// The F25 key.
/// </summary>
F25 = 314,
/// <summary>
/// The 0 key on the key pad.
/// </summary>
KeyPad0 = 320,
/// <summary>
/// The 1 key on the key pad.
/// </summary>
KeyPad1 = 321,
/// <summary>
/// The 2 key on the key pad.
/// </summary>
KeyPad2 = 322,
/// <summary>
/// The 3 key on the key pad.
/// </summary>
KeyPad3 = 323,
/// <summary>
/// The 4 key on the key pad.
/// </summary>
KeyPad4 = 324,
/// <summary>
/// The 5 key on the key pad.
/// </summary>
KeyPad5 = 325,
/// <summary>
/// The 6 key on the key pad.
/// </summary>
KeyPad6 = 326,
/// <summary>
/// The 7 key on the key pad.
/// </summary>
KeyPad7 = 327,
/// <summary>
/// The 8 key on the key pad.
/// </summary>
KeyPad8 = 328,
/// <summary>
/// The 9 key on the key pad.
/// </summary>
KeyPad9 = 329,
/// <summary>
/// The decimal key on the key pad.
/// </summary>
KeyPadDecimal = 330,
/// <summary>
/// The divide key on the key pad.
/// </summary>
KeyPadDivide = 331,
/// <summary>
/// The multiply key on the key pad.
/// </summary>
KeyPadMultiply = 332,
/// <summary>
/// The subtract key on the key pad.
/// </summary>
KeyPadSubtract = 333,
/// <summary>
/// The add key on the key pad.
/// </summary>
KeyPadAdd = 334,
/// <summary>
/// The enter key on the key pad.
/// </summary>
KeyPadEnter = 335,
/// <summary>
/// The equal key on the key pad.
/// </summary>
KeyPadEqual = 336,
/// <summary>
/// The left shift key.
/// </summary>
LeftShift = 340,
/// <summary>
/// The left control key.
/// </summary>
LeftControl = 341,
/// <summary>
/// The left alt key.
/// </summary>
LeftAlt = 342,
/// <summary>
/// The left super key.
/// </summary>
LeftSuper = 343,
/// <summary>
/// The right shift key.
/// </summary>
RightShift = 344,
/// <summary>
/// The right control key.
/// </summary>
RightControl = 345,
/// <summary>
/// The right alt key.
/// </summary>
RightAlt = 346,
/// <summary>
/// The right super key.
/// </summary>
RightSuper = 347,
/// <summary>
/// The menu key.
/// </summary>
Menu = 348,
/// <summary>
/// The last valid key in this enum.
/// </summary>
LastKey = Menu
}
}

View File

@@ -0,0 +1,68 @@
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Specifies the buttons of a mouse.
/// </summary>
public enum MouseButton
{
/// <summary>
/// The first button.
/// </summary>
Button1 = 0,
/// <summary>
/// The second button.
/// </summary>
Button2 = 1,
/// <summary>
/// The third button.
/// </summary>
Button3 = 2,
/// <summary>
/// The fourth button.
/// </summary>
Button4 = 3,
/// <summary>
/// The fifth button.
/// </summary>
Button5 = 4,
/// <summary>
/// The sixth button.
/// </summary>
Button6 = 5,
/// <summary>
/// The seventh button.
/// </summary>
Button7 = 6,
/// <summary>
/// The eighth button.
/// </summary>
Button8 = 7,
/// <summary>
/// The left mouse button. This corresponds to <see cref="Button1"/>.
/// </summary>
Left = Button1,
/// <summary>
/// The right mouse button. This corresponds to <see cref="Button2"/>.
/// </summary>
Right = Button2,
/// <summary>
/// The middle mouse button. This corresponds to <see cref="Button3"/>.
/// </summary>
Middle = Button3,
/// <summary>
/// The highest mouse button available.
/// </summary>
Last = Button8,
}
}

View File

@@ -0,0 +1,32 @@
//
// OpenGlProfile.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// The OpenGL context profiles.
/// </summary>
public enum OpenGlProfile
{
/// <summary>
/// Used for unknown OpenGL profile or OpenGL ES.
/// </summary>
Any = 0,
/// <summary>
/// Known OpenGL Core profile.
/// </summary>
Core = 0x00032001,
/// <summary>
/// Known OpenGL compatibility profile.
/// </summary>
Compat = 0x00032002
}
}

View File

@@ -0,0 +1,33 @@
//
// ReleaseBehavior.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// The context release behaviors.
/// </summary>
/// <seealso cref="GLFW.WindowHint(WindowHintReleaseBehavior,ReleaseBehavior)"/>
public enum ReleaseBehavior
{
/// <summary>
/// Use the default release behavior of the platform.
/// </summary>
Any = 0,
/// <summary>
/// The pipeline will be flushed whenever the context is released from being the current one.
/// </summary>
Flush = 0x00035001,
/// <summary>
/// The pipeline will not be flushed on release.
/// </summary>
None = 0x00035002
}
}

View File

@@ -0,0 +1,32 @@
//
// Robustness.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// OpenGL context robustness strategy.
/// </summary>
public enum Robustness
{
/// <summary>
/// No context robustness strategy.
/// </summary>
NoRobustness = 0,
/// <summary>
/// Robust context without a reset notification.
/// </summary>
NoResetNotification = 0x00031001,
/// <summary>
/// Lose context on reset.
/// </summary>
LoseContextOnReset = 0x00031002
}
}

View File

@@ -0,0 +1,29 @@
//
// StickyAttributes.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Attributes related to sticky keys and buttons.
/// </summary>
/// <seealso cref="GLFW.SetInputMode(Window*,StickyAttributes,bool)"/>
/// <seealso cref="GLFW.GetInputMode(Window*,StickyAttributes)"/>
public enum StickyAttributes
{
/// <summary>
/// Specify whether keyboard input should be sticky or not.
/// </summary>
StickyKeys = 0x00033002,
/// <summary>
/// Specify whether mouse button input should be sticky or not.
/// </summary>
StickyMouseButtons = 0x00033003
}
}

View File

@@ -0,0 +1,96 @@
//
// WindowAttributeSetter.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Used to get window related attributes.
/// </summary>
/// <seealso cref="GLFW.GetWindowAttrib"/>
public enum WindowAttributeGetter
{
/// <summary>
/// Indicates whether the specified window has input focus.
/// Initial input focus is controlled by the window hint with the same name
/// </summary>
Focused = WindowHintBool.Focused,
/// <summary>
/// Indicates whether the specified window is iconified,
/// whether by the user or with <see cref="GLFW.IconifyWindow"/>.
/// </summary>
Iconified = WindowHintBool.Iconified,
/// <summary>
/// Indicates whether the specified window is resizable by the user.
/// This is set on creation with the window hint with the same name.
/// </summary>
Resizable = WindowHintBool.Resizable,
/// <summary>
/// Indicates whether the specified window is visible.
/// Window visibility can be controlled with <see cref="GLFW.ShowWindow"/> and <see cref="GLFW.HideWindow"/>
/// and initial visibility is controlled by the window hint with the same name.
/// </summary>
Visible = WindowHintBool.Visible,
/// <summary>
/// Indicates whether the specified window has decorations such as a border,a close widget, etc.
/// This is set on creation with the window hint with the same name.
/// </summary>
Decorated = WindowHintBool.Decorated,
/// <summary>
/// Specifies whether the full screen window will automatically iconify and restore
/// the previous video mode on input focus loss.
/// Possible values are <c>true</c> and <c>false</c>. This hint is ignored for windowed mode windows.
/// </summary>
AutoIconify = WindowHintBool.AutoIconify,
/// <summary>
/// Indicates whether the specified window is floating, also called topmost or always-on-top.
/// This is controlled by the window hint with the same name.
/// </summary>
Floating = WindowHintBool.Floating,
/// <summary>
/// Indicates whether the specified window is maximized,
/// whether by the user or with <see cref="GLFW.MaximizeWindow"/>.
/// </summary>
Maximized = WindowHintBool.Maximized,
/// <summary>
/// Specifies whether the cursor should be centered over newly created full screen windows.
/// Possible values are <c>true</c> and <c>false</c>. This hint is ignored for windowed mode windows.
/// </summary>
CenterCursor = WindowHintBool.CenterCursor,
/// <summary>
/// Specifies whether the window framebuffer will be transparent.
/// If enabled and supported by the system, the window framebuffer alpha channel will be used
/// to combine the framebuffer with the background.
/// This does not affect window decorations. Possible values are <c>true</c> and <c>false</c>.
/// </summary>
TransparentFramebuffer = WindowHintBool.TransparentFramebuffer,
/// <summary>
/// indicates whether the cursor is currently directly over the client area of the window,
/// with no other windows between.
/// See <a href="https://www.glfw.org/docs/3.3/input_guide.html#cursor_enter">Cursor enter/leave events</a>
/// for details.
/// </summary>
Hovered = WindowHintBool.Hovered,
/// <summary>
/// Specifies whether the window will be given input focus when <see cref="GLFW.ShowWindow"/> is called.
/// Possible values are <c>true</c> and <c>false</c>.
/// </summary>
FocusOnShow = WindowHintBool.FocusOnShow,
}
}

View File

@@ -0,0 +1,49 @@
//
// WindowAttributeSetter.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Used to set window related attributes.
/// </summary>
/// <seealso cref="GLFW.SetWindowAttrib"/>
public enum WindowAttributeSetter
{
/// <summary>
/// Indicates whether the specified window is resizable by the user.
/// This is set on creation with the window hint with the same name.
/// </summary>
Resizable = WindowHintBool.Resizable,
/// <summary>
/// Indicates whether the specified window has decorations such as a border,a close widget, etc.
/// This is set on creation with the window hint with the same name.
/// </summary>
Decorated = WindowHintBool.Decorated,
/// <summary>
/// Specifies whether the full screen window will automatically iconify and restore
/// the previous video mode on input focus loss.
/// Possible values are <c>true</c> and <c>false</c>. This hint is ignored for windowed mode windows.
/// </summary>
AutoIconify = WindowHintBool.AutoIconify,
/// <summary>
/// Indicates whether the specified window is floating, also called topmost or always-on-top.
/// This is controlled by the window hint with the same name.
/// </summary>
Floating = WindowHintBool.Floating,
/// <summary>
/// Specifies whether the window will be given input focus when <see cref="GLFW.ShowWindow"/> is called.
/// Possible values are <c>true</c> and <c>false</c>.
/// </summary>
FocusOnShow = WindowHintBool.FocusOnShow
}
}

View File

@@ -0,0 +1,133 @@
//
// WindowHintBool.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Context related boolean attributes.
/// </summary>
/// <seealso cref="GLFW.WindowHint(WindowHintBool,bool)"/>
public enum WindowHintBool
{
/// <summary>
/// Indicates whether the specified window has input focus.
/// Initial input focus is controlled by the window hint with the same name
/// </summary>
Focused = 0x00020001,
/// <summary>
/// Indicates whether the specified window is iconified,
/// whether by the user or with <see cref="GLFW.IconifyWindow"/>.
/// </summary>
Iconified = 0x00020002,
/// <summary>
/// Indicates whether the specified window is resizable by the user.
/// This is set on creation with the window hint with the same name.
/// </summary>
Resizable = 0x00020003,
/// <summary>
/// Indicates whether the specified window is visible.
/// Window visibility can be controlled with <see cref="GLFW.ShowWindow"/> and <see cref="GLFW.HideWindow"/>
/// and initial visibility is controlled by the window hint with the same name.
/// </summary>
Visible = 0x00020004,
/// <summary>
/// Indicates whether the specified window has decorations such as a border,a close widget, etc.
/// This is set on creation with the window hint with the same name.
/// </summary>
Decorated = 0x00020005,
/// <summary>
/// Specifies whether the full screen window will automatically iconify and restore
/// the previous video mode on input focus loss.
/// Possible values are <c>true</c> and <c>false</c>. This hint is ignored for windowed mode windows.
/// </summary>
AutoIconify = 0x00020006,
/// <summary>
/// Indicates whether the specified window is floating, also called topmost or always-on-top.
/// This is controlled by the window hint with the same name.
/// </summary>
Floating = 0x00020007,
/// <summary>
/// Indicates whether the specified window is maximized,
/// whether by the user or with <see cref="GLFW.MaximizeWindow"/>.
/// </summary>
Maximized = 0x00020008,
/// <summary>
/// Specifies whether the cursor should be centered over newly created full screen windows.
/// Possible values are <c>true</c> and <c>false</c>. This hint is ignored for windowed mode windows.
/// </summary>
CenterCursor = 0x00020009,
/// <summary>
/// Specifies whether the window framebuffer will be transparent.
/// If enabled and supported by the system, the window framebuffer alpha channel will be used
/// to combine the framebuffer with the background.
/// This does not affect window decorations. Possible values are <c>true</c> and <c>false</c>.
/// </summary>
TransparentFramebuffer = 0x0002000A,
/// <summary>
/// Indicates whether the cursor is currently directly over the client area of the window,
/// with no other windows between.
/// See <a href="https://www.glfw.org/docs/3.3/input_guide.html#cursor_enter">Cursor enter/leave events</a>
/// for details.
/// </summary>
Hovered = 0x0002000B,
/// <summary>
/// Specifies whether the window will be given input focus when <see cref="GLFW.ShowWindow"/> is called.
/// Possible values are <c>true</c> and <c>false</c>.
/// </summary>
FocusOnShow = 0x0002000C,
/// <summary>
/// Specifies whether the window's context is an OpenGL forward-compatible one.
/// Possible values are <c>true</c> and <c>false</c>.
/// </summary>
OpenGLForwardCompat = 0x00022006,
/// <summary>
/// Specifies whether the window's context is an OpenGL debug context.
/// Possible values are <c>true</c> and <c>false</c>.
/// </summary>
OpenGLDebugContext = 0x00022007,
/// <summary>
/// Specifies whether errors should be generated by the context.
/// If enabled, situations that would have generated errors instead cause undefined behavior.
/// </summary>
ContextNoError = 0x0002200A,
/// <summary>
/// Specifies whether to use stereoscopic rendering. This is a hard constraint.
/// </summary>
Stereo = 0x0002100C,
/// <summary>
/// Specifies whether the framebuffer should be double buffered.
/// You nearly always want to use double buffering. This is a hard constraint.
/// </summary>
DoubleBuffer = 0x00021010,
/// <summary>
/// Specifies whether the framebuffer should be sRGB capable.
/// If supported, a created OpenGL context will support the
/// <c>GL_FRAMEBUFFER_SRGB</c> enable( also called <c>GL_FRAMEBUFFER_SRGB_EXT</c>)
/// for controlling sRGB rendering and a created OpenGL ES context will always have sRGB rendering enabled.
/// </summary>
SrgbCapable = 0x0002100E,
}
}

View File

@@ -0,0 +1,26 @@
//
// WindowHintClientApi.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Context related client API attribute.
/// </summary>
/// <seealso cref="GLFW.WindowHint(WindowHintClientApi,ClientApi)"/>
public enum WindowHintClientApi
{
/// <summary>
/// Indicates the client API provided by the window's context;
/// either <see cref="GraphicsLibraryFramework.ClientApi.OpenGlApi"/>,
/// <see cref="GraphicsLibraryFramework.ClientApi.OpenGlEsApi"/> or
/// <see cref="GraphicsLibraryFramework.ClientApi.NoApi"/>.
/// </summary>
ClientApi = 0x00022001,
}
}

View File

@@ -0,0 +1,24 @@
//
// WindowHintContextApi.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Used to specify the context creation API.
/// </summary>
/// <seealso cref="GLFW.WindowHint(WindowHintContextApi,ContextApi)"/>
public enum WindowHintContextApi
{
/// <summary>
/// Indicates the context creation API used to create the window's context;
/// either <see cref="ContextApi.NativeContextApi"/> or <see cref="ContextApi.EglContextApi"/>.
/// </summary>
ContextCreationApi = 0x0002200B,
}
}

View File

@@ -0,0 +1,117 @@
//
// WindowHintInt.cs
//
// Copyright (C) 2018 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Context related attributes.
/// </summary>
/// <seealso cref="GLFW.WindowHint(WindowHintInt,int)"/>
public enum WindowHintInt
{
/// <summary>
/// Indicate the client API version(major part) of the window's context.
/// </summary>
ContextVersionMajor = 0x00022002,
/// <summary>
/// Indicate the client API version(minor part) of the window's context.
/// </summary>
ContextVersionMinor = 0x00022003,
/// <summary>
/// Indicate the client API version(revision part) of the window's context.
/// </summary>
ContextRevision = 0x00022004,
/// <summary>
/// Specify the desired bit depths of the red component of the default framebuffer.
/// <see cref="GLFW.DontCare"/> means the application has no preference.
/// </summary>
RedBits = 0x00021001,
/// <summary>
/// Specify the desired bit depths of the green component of the default framebuffer.
/// <see cref="GLFW.DontCare"/> means the application has no preference.
/// </summary>
GreenBits = 0x00021002,
/// <summary>
/// Specify the desired bit depths of the blue component of the default framebuffer.
/// <see cref="GLFW.DontCare"/> means the application has no preference.
/// </summary>
BlueBits = 0x00021003,
/// <summary>
/// Specify the desired bit depths of the alpha component of the default framebuffer.
/// <see cref="GLFW.DontCare"/> means the application has no preference.
/// </summary>
AlphaBits = 0x00021004,
/// <summary>
/// Specify the desired bit depths of the depth component of the default framebuffer.
/// <see cref="GLFW.DontCare"/> means the application has no preference.
/// </summary>
DepthBits = 0x00021005,
/// <summary>
/// Specify the desired bit depths of the stencil component of the default framebuffer.
/// <see cref="GLFW.DontCare"/> means the application has no preference.
/// </summary>
StencilBits = 0x00021006,
/// <summary>
/// Specify the desired bit depths of the red component of the accumulation buffer.
/// <see cref="GLFW.DontCare"/> means the application has no preference.
/// </summary>
/// <remarks>Accumulation buffers are a legacy OpenGL feature and should not be used in new code.</remarks>
AccumRedBits = 0x00021007,
/// <summary>
/// Specify the desired bit depths of the green component of the accumulation buffer.
/// <see cref="GLFW.DontCare"/> means the application has no preference.
/// </summary>
/// <remarks>Accumulation buffers are a legacy OpenGL feature and should not be used in new code.</remarks>
AccumGreenBits = 0x00021008,
/// <summary>
/// Specify the desired bit depths of the blue component of the accumulation buffer.
/// <see cref="GLFW.DontCare"/> means the application has no preference.
/// </summary>
/// <remarks>Accumulation buffers are a legacy OpenGL feature and should not be used in new code.</remarks>
AccumBlueBits = 0x00021009,
/// <summary>
/// Specify the desired bit depths of the alpha component of the accumulation buffer.
/// <see cref="GLFW.DontCare"/> means the application has no preference.
/// </summary>
/// <remarks>Accumulation buffers are a legacy OpenGL feature and should not be used in new code.</remarks>
AccumAlphaBits = 0x0002100A,
/// <summary>
/// Specifies the desired number of auxiliary buffers.
/// <see cref="GLFW.DontCare"/> means the application has no preference.
/// </summary>
/// <remarks>Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.</remarks>
AuxBuffers = 0x0002100B,
/// <summary>
/// Specifies the desired number of samples to use for multisampling. Zero disables multisampling.
/// <see cref="GLFW.DontCare"/> means the application has no preference.
/// </summary>
Samples = 0x0002100D,
/// <summary>
/// Specifies the desired refresh rate for full screen windows.
/// If set to <see cref="GLFW.DontCare"/>,
/// the highest available refresh rate will be used. This hint is ignored for windowed mode windows.
/// </summary>
RefreshRate = 0x0002100F,
}
}

View File

@@ -0,0 +1,29 @@
//
// WindowHintOpenGlProfile.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Used to set the OpenGlProfile attribute.
/// </summary>
/// <seealso cref="GLFW.WindowHint(WindowHintOpenGlProfile,OpenGlProfile)"/>
public enum WindowHintOpenGlProfile
{
/// <summary>
/// Indicates the OpenGL profile used by the context.
/// This is <see cref="GraphicsLibraryFramework.OpenGlProfile.Core"/>
/// or <see cref="GraphicsLibraryFramework.OpenGlProfile.Compat"/>
/// if the context uses a known profile, or <see cref="GraphicsLibraryFramework.OpenGlProfile.Any"/>
/// if the OpenGL profile is unknown or the context is an OpenGL ES context.
/// Note that the returned profile may not match the profile bits of the context flags,
/// as GLFW will try other means of detecting the profile when no bits are set. TODO: enum for missing crefs
/// </summary>
OpenGlProfile = 0x00022008,
}
}

View File

@@ -0,0 +1,30 @@
//
// WindowHintReleaseBehavior.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Used to specify the release behavior used by the local context.
/// </summary>
/// <seealso cref="GLFW.WindowHint(WindowHintReleaseBehavior,ReleaseBehavior)"/>
public enum WindowHintReleaseBehavior
{
/// <summary>
/// Specifies the release behavior to be used by the context.
/// Possible values are one of <see cref="ReleaseBehavior.Any"/>,
/// <see cref="ReleaseBehavior.Flush"/> or <see cref="ReleaseBehavior.None"/>.
/// If the behavior is <see cref="ReleaseBehavior"/>, the default behavior
/// of the context creation API will be used.
/// If the behavior is <see cref="ReleaseBehavior.Flush"/>, the pipeline will be flushed
/// whenever the context is released from being the current one.
/// If the behavior is <see cref="ReleaseBehavior.None"/>, the pipeline will not be flushed on release.
/// </summary>
ContextReleaseBehavior = 0x00022009,
}
}

View File

@@ -0,0 +1,25 @@
//
// WindowHintRobustness.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Used to set context robustness attribute.
/// </summary>
/// <seealso cref="GLFW.WindowHint(WindowHintRobustness,Robustness)"/>
public enum WindowHintRobustness
{
/// <summary>
/// Indicates the robustness strategy used by the context.
/// This is <see cref="Robustness.LoseContextOnReset"/> or <see cref="Robustness.NoResetNotification"/>
/// if the window's context supports robustness, or <see cref="Robustness.NoRobustness"/> otherwise.
/// </summary>
ContextRobustness = 0x00022005,
}
}

View File

@@ -0,0 +1,23 @@
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Window hints for the WindowHintString function.
/// </summary>
public enum WindowHintString
{
/// <summary>
/// Sets the frame name on Cocoa. On any other platform, this does nothing.
/// </summary>
CocoaFrameName = 0x00023002,
/// <summary>
/// Sets the class name on X11. On any other platform, this does nothing.
/// </summary>
X11ClassName = 0x00024001,
/// <summary>
/// Sets the instance name on X11. on any other platform, this does nothing.
/// </summary>
X11InstanceName = 0x00024002,
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,180 @@
//
// GLFWCallbacks.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
using System;
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Class containing GLFW related callbacks.
/// </summary>
public static unsafe class GLFWCallbacks
{
/// <summary>
/// The function signature for Unicode character callback functions.
/// </summary>
/// <param name="window">The window that received the event.</param>
/// <param name="codepoint">The Unicode code point of the character.</param>
/// <seealso cref="GLFW.SetCharCallback"/>
public delegate void CharCallback(Window* window, uint codepoint);
/// <summary>
/// The function signature for Unicode character with modifiers callback functions.
/// It is called for each input character, regardless of what modifier keys are held down.
/// </summary>
/// <param name="window">The window that received the event.</param>
/// <param name="codepoint">The Unicode code point of the character.</param>
/// <param name="modifiers">Bit field describing which modifier keys were held down.</param>
/// <seealso cref="GLFW.SetCharModsCallback"/>
public delegate void CharModsCallback(Window* window, uint codepoint, KeyModifiers modifiers);
/// <summary>
/// The function signature for cursor enter/leave callback functions.
/// </summary>
/// <param name="window">The window that received the event.</param>
/// <param name="entered"><c>true</c> if the cursor entered the window's client area, or <c>false</c> if it left it.</param>
/// <seealso cref="GLFW.SetCursorEnterCallback"/>
public delegate void CursorEnterCallback(Window* window, bool entered);
/// <summary>
/// The function signature for cursor position callback functions.
/// </summary>
/// <param name="window">The window that received the event.</param>
/// <param name="x">The new cursor x-coordinate, relative to the left edge of the client area.</param>
/// <param name="y">The new cursor y-coordinate, relative to the top edge of the client area.</param>
/// <seealso cref="GLFW.SetCursorPosCallback"/>
public delegate void CursorPosCallback(Window* window, double x, double y);
/// <summary>
/// The function signature for file drop callbacks.
/// </summary>
/// <param name="window">The window that received the event.</param>
/// <param name="count">The number of dropped files.</param>
/// <param name="paths">The UTF-8 encoded file and/or directory path names.</param>
/// <seealso cref="GLFW.SetDropCallback"/>
public delegate void DropCallback(Window* window, int count, byte** paths);
/// <summary>
/// The function signature for joystick configuration callback functions.
/// </summary>
/// <param name="joystick">The joystick that was connected or disconnected.</param>
/// <param name="state">
/// One of <see cref="ConnectedState.Connected"/> or <see cref="ConnectedState.Disconnected"/>.
/// </param>
/// <seealso cref="GLFW.SetJoystickCallback"/>
public delegate void JoystickCallback(int joystick, ConnectedState state);
/// <summary>
/// The function signature for keyboard key callback functions.
/// </summary>
/// <param name="window">The window that received the event.</param>
/// <param name="key">The keyboard key that was pressed or released.</param>
/// <param name="scanCode">The system-specific scancode of the key.</param>
/// <param name="action">The <see cref="InputAction"/> for that <paramref name="key"/>.</param>
/// <param name="mods">Bit field describing which modifier keys were held down.</param>
/// <seealso cref="GLFW.SetKeyCallback"/>
public delegate void KeyCallback(Window* window, Keys key, int scanCode, InputAction action, KeyModifiers mods);
/// <summary>
/// The function signature for mouse button callback functions.
/// </summary>
/// <param name="window">The window that received the event.</param>
/// <param name="button">The mouse button that was pressed or released.</param>
/// <param name="action">One of <see cref="InputAction.Press"/> or <see cref="InputAction.Release"/>.</param>
/// <param name="mods">Bit field describing which modifier keys were held down.</param>
/// <seealso cref="GLFW.SetMouseButtonCallback"/>
public delegate void MouseButtonCallback(Window* window, MouseButton button, InputAction action, KeyModifiers mods); // TODO: Make enums for int params in callback
/// <summary>
/// The function signature for scroll callback functions.
/// </summary>
/// <param name="window">The window that received the event.</param>
/// <param name="offsetX">The scroll offset along the x-axis.</param>
/// <param name="offsetY">The scroll offset along the y-axis.</param>
/// <seealso cref="GLFW.SetScrollCallback"/>
public delegate void ScrollCallback(Window* window, double offsetX, double offsetY);
/// <summary>
/// The function signature for monitor configuration callback functions.
/// </summary>
/// <param name="monitor">The monitor that was connected or disconnected.</param>
/// <param name="state">
/// One <see cref="ConnectedState.Connected"/> of or <see cref="ConnectedState.Disconnected"/>.
/// </param>
/// <seealso cref="GLFW.SetMonitorCallback"/>
public delegate void MonitorCallback(Monitor* monitor, ConnectedState state);
/// <summary>
/// The function signature for window close callback functions.
/// </summary>
/// <param name="window">The window that the user attempted to close.</param>
/// <seealso cref="GLFW.SetWindowCloseCallback"/>
public delegate void WindowCloseCallback(Window* window);
/// <summary>
/// The function signature for window focus callback functions.
/// </summary>
/// <param name="window">The window that gained or lost input focus.</param>
/// <param name="focused"><c>true</c> if the window was given input focus, or <c>false</c> if it lost it.</param>
/// <seealso cref="GLFW.SetWindowFocusCallback"/>
public delegate void WindowFocusCallback(Window* window, bool focused);
/// <summary>
/// The function signature for window iconify/restore callback functions.
/// </summary>
/// <param name="window">The window that was iconified or restored.</param>
/// <param name="iconified"><c>true</c> if the window was iconified(minimized), or <c>false</c> if it was restored.</param>
/// <seealso cref="GLFW.SetWindowIconifyCallback"/>
public delegate void WindowIconifyCallback(Window* window, bool iconified);
/// <summary>
/// The function signature for window position callback functions.
/// </summary>
/// <param name="window">The window that was moved.</param>
/// <param name="x">
/// The new x-coordinate, in screen coordinates, of the upper-left corner of the client area of the window.
/// </param>
/// <param name="y">
/// The new y-coordinate, in screen coordinates, of the upper-left corner of the client area of the window.
/// </param>
/// <seealso cref="GLFW.SetWindowPosCallback"/>
public delegate void WindowPosCallback(Window* window, int x, int y);
/// <summary>
/// The function signature for window size callback functions.
/// </summary>
/// <param name="window">The window that was resized.</param>
/// <param name="width">The new width, in screen coordinates, of the window.</param>
/// <param name="height">The new height, in screen coordinates, of the window.</param>
/// <seealso cref="GLFW.SetWindowSizeCallback"/>
public delegate void WindowSizeCallback(Window* window, int width, int height);
/// <summary>
/// The function signature for error callback functions.
/// </summary>
/// <param name="error">An error code.</param>
/// <param name="description">A UTF-8 encoded string describing the error.</param>
public delegate void ErrorCallback(ErrorCode error, string description);
/// <summary>
/// The function signature for window refresh functions.
/// </summary>
/// <param name="window">The window that needs to be refreshed.</param>
public delegate void WindowRefreshCallback(Window* window);
/// <summary>
/// This is the function pointer type for window content scale callbacks.
/// </summary>
/// <param name="window">The window whose content scale changed. </param>
/// <param name="xscale">The new x-axis content scale of the window. </param>
/// <param name="yscale">The new y-axis content scale of the window.</param>
/// <seealso cref="GLFW.SetWindowContentScaleCallback"/>
public delegate void WindowContentScaleCallback(Window* window, float xscale, float yscale);
}
}

View File

@@ -0,0 +1,78 @@
//
// GLFWException.cs
//
// Copyright (C) 2018 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
using System;
using System.Runtime.Serialization;
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Represents errors that occur within GLFW.
/// </summary>
[Serializable]
public class GLFWException : Exception
{
/// <summary>
/// Gets the underlying GLFW-error code.
/// </summary>
public ErrorCode ErrorCode { get; }
/// <summary>
/// Initializes a new instance of the <see cref="GLFWException"/> class.
/// </summary>
public GLFWException()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GLFWException"/> class with the specified detailed description.
/// </summary>
/// <param name="message">A detailed description of the error.</param>
public GLFWException(string message)
: base(message)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GLFWException"/> class
/// with the specified detailed description and GLFW error code.
/// </summary>
/// <param name="message">A detailed description of the error.</param>
/// <param name="errorCode">The GLFW error code causing the exception.</param>
public GLFWException(string message, ErrorCode errorCode)
: base(message)
{
ErrorCode = errorCode;
}
/// <summary>
/// Initializes a new instance of the <see cref="GLFWException"/> class with the specified detailed description
/// and the specified exception.
/// </summary>
/// <param name="message">A detailed description of the error.</param>
/// <param name="innerException">A reference to the inner exception that is the cause of this exception.</param>
public GLFWException(string message, Exception innerException)
: base(message, innerException)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GLFWException"/> class with the specified context
/// and the serialization information.
/// </summary>
/// <param name="info">The <see cref="SerializationInfo"/> associated with this exception.</param>
/// <param name="context">
/// A <see cref="StreamingContext"/> that represents the context of this exception.
/// </param>
protected GLFWException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}

View File

@@ -0,0 +1,406 @@
using System;
using System.Runtime.InteropServices;
namespace OpenToolkit.GraphicsLibraryFramework
{
internal static unsafe class GLFWNative
{
private const string LibraryName = "glfw3.dll";
public const int GLFW_TRUE = 1;
public const int GLFW_FALSE = 0;
#if NETCOREAPP
static GLFWNative()
{
// Register DllImport resolver so that the correct dynamic library is loaded on all platforms.
// On net472, we rely on Mono's DllMap for this. See the .dll.config file.
NativeLibrary.SetDllImportResolver(typeof(GLFWNative).Assembly, (name, assembly, path) =>
{
if (name != "glfw3.dll")
{
return IntPtr.Zero;
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return NativeLibrary.Load("libglfw.so.3", assembly, path);
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
return NativeLibrary.Load("libglfw.3.dylib", assembly, path);
}
return IntPtr.Zero;
});
}
#endif
[DllImport(LibraryName)]
public static extern int glfwInit();
[DllImport(LibraryName)]
public static extern void glfwTerminate();
[DllImport(LibraryName)]
public static extern void glfwInitHint(int hint, int value);
[DllImport(LibraryName)]
public static extern void glfwGetVersion(int* major, int* minor, int* revision);
[DllImport(LibraryName)]
public static extern byte* glfwGetVersionString();
[DllImport(LibraryName)]
public static extern ErrorCode glfwGetError(byte** description);
[DllImport(LibraryName)]
public static extern Monitor** glfwGetMonitors(int* count);
[DllImport(LibraryName)]
public static extern void glfwGetMonitorPos(Monitor* monitor, int* x, int* y);
[DllImport(LibraryName)]
public static extern void glfwGetMonitorPhysicalSize(Monitor* monitor, int* width, int* height);
[DllImport(LibraryName)]
public static extern void glfwGetMonitorContentScale(Monitor* monitor, float* xscale, float* yscale);
[DllImport(LibraryName)]
public static extern byte* glfwGetMonitorName(Monitor* monitor);
[DllImport(LibraryName)]
public static extern void glfwSetMonitorUserPointer(Monitor* monitor, void* pointer);
[DllImport(LibraryName)]
public static extern void* glfwGetMonitorUserPointer(Monitor* monitor);
[DllImport(LibraryName)]
public static extern VideoMode* glfwGetVideoModes(Monitor* monitor, int* count);
[DllImport(LibraryName)]
public static extern void glfwSetGamma(Monitor* monitor, float gamma);
[DllImport(LibraryName)]
public static extern GammaRamp* glfwGetGammaRamp(Monitor* monitor);
[DllImport(LibraryName)]
public static extern void glfwSetGammaRamp(Monitor* monitor, GammaRamp* ramp);
[DllImport(LibraryName)]
public static extern void glfwDefaultWindowHints();
[DllImport(LibraryName)]
public static extern void glfwWindowHintString(int hint, byte* value);
[DllImport(LibraryName)]
public static extern void glfwSetWindowSizeLimits(Window* window, int minwidth, int minheight, int maxwidth, int maxheight);
[DllImport(LibraryName)]
public static extern void glfwSetWindowAspectRatio(Window* window, int numer, int denom);
[DllImport(LibraryName)]
public static extern void glfwGetWindowFrameSize(Window* window, int* left, int* top, int* right, int* bottom);
[DllImport(LibraryName)]
public static extern void glfwGetWindowContentScale(Window* window, float* xscale, float* yscale);
[DllImport(LibraryName)]
public static extern float glfwGetWindowOpacity(Window* window);
[DllImport(LibraryName)]
public static extern void glfwSetWindowOpacity(Window* window, float opacity);
[DllImport(LibraryName)]
public static extern void glfwRequestWindowAttention(Window* window);
[DllImport(LibraryName)]
public static extern void glfwSetWindowAttrib(Window* window, WindowAttributeSetter attrib, int value);
[DllImport(LibraryName)]
public static extern int glfwRawMouseMotionSupported();
[DllImport(LibraryName)]
public static extern byte* glfwGetKeyName(Keys key, int scancode);
[DllImport(LibraryName)]
public static extern int glfwGetKeyScancode(Keys key);
[DllImport(LibraryName)]
public static extern InputAction glfwGetKey(Window* window, Keys key);
[DllImport(LibraryName)]
public static extern InputAction glfwGetMouseButton(Window* window, MouseButton button);
[DllImport(LibraryName)]
public static extern void glfwGetCursorPos(Window* window, double* xpos, double* ypos);
[DllImport(LibraryName)]
public static extern void glfwSetCursorPos(Window* window, double xpos, double ypos);
[DllImport(LibraryName)]
public static extern Cursor* glfwCreateCursor(Image* image, int xhot, int yhot);
[DllImport(LibraryName)]
public static extern Cursor* glfwCreateStandardCursor(CursorShape shape);
[DllImport(LibraryName)]
public static extern void glfwDestroyCursor(Cursor* cursor);
[DllImport(LibraryName)]
public static extern void glfwSetCursor(Window* window, Cursor* cursor);
[DllImport(LibraryName)]
public static extern int glfwJoystickPresent(int jid);
[DllImport(LibraryName)]
public static extern float* glfwGetJoystickAxes(int jid, int* count);
[DllImport(LibraryName)]
public static extern InputAction* glfwGetJoystickButtons(int jid, int* count);
[DllImport(LibraryName)]
public static extern JoystickHats* glfwGetJoystickHats(int jid, int* count);
[DllImport(LibraryName)]
public static extern byte* glfwGetJoystickName(int jid);
[DllImport(LibraryName)]
public static extern byte* glfwGetJoystickGUID(int jid);
[DllImport(LibraryName)]
public static extern void glfwSetJoystickUserPointer(int jid, void* ptr);
[DllImport(LibraryName)]
public static extern void* glfwGetJoystickUserPointer(int jid);
[DllImport(LibraryName)]
public static extern int glfwJoystickIsGamepad(int jid);
[DllImport(LibraryName)]
public static extern int glfwUpdateGamepadMappings(byte* newMapping);
[DllImport(LibraryName)]
public static extern byte* glfwGetGamepadName(int jid);
[DllImport(LibraryName)]
public static extern int glfwGetGamepadState(int jid, GamepadState* state);
[DllImport(LibraryName)]
public static extern double glfwGetTime();
[DllImport(LibraryName)]
public static extern void glfwSetTime(double time);
[DllImport(LibraryName)]
public static extern long glfwGetTimerValue();
[DllImport(LibraryName)]
public static extern long glfwGetTimerFrequency();
[DllImport(LibraryName)]
public static extern Window* glfwGetCurrentContext();
[DllImport(LibraryName)]
public static extern void glfwSwapBuffers(Window* window);
[DllImport(LibraryName)]
public static extern int glfwExtensionSupported(byte* extensionName);
[DllImport(LibraryName)]
public static extern IntPtr glfwGetProcAddress(byte* procame);
[DllImport(LibraryName)]
public static extern Window* glfwCreateWindow(int width, int height, byte* title, Monitor* monitor, Window* share);
[DllImport(LibraryName)]
public static extern Monitor* glfwGetPrimaryMonitor();
[DllImport(LibraryName)]
public static extern void glfwDestroyWindow(Window* window);
[DllImport(LibraryName)]
public static extern void glfwFocusWindow(Window* window);
[DllImport(LibraryName)]
public static extern void glfwGetFramebufferSize(Window* window, int* width, int* height);
[DllImport(LibraryName)]
public static extern CursorModeValue glfwGetInputMode(Window* window, CursorStateAttribute mode);
[DllImport(LibraryName)]
public static extern int glfwGetInputMode(Window* window, StickyAttributes mode);
[DllImport(LibraryName)]
public static extern void glfwRestoreWindow(Window* window);
[DllImport(LibraryName)]
public static extern VideoMode* glfwGetVideoMode(Monitor* monitor);
[DllImport(LibraryName)]
public static extern int glfwGetWindowAttrib(Window* window, WindowAttributeGetter attribute);
[DllImport(LibraryName)]
public static extern void glfwGetWindowSize(Window* window, int* width, int* height);
[DllImport(LibraryName)]
public static extern void glfwGetWindowPos(Window* window, int* x, int* y);
[DllImport(LibraryName)]
public static extern Monitor* glfwGetWindowMonitor(Window* window);
[DllImport(LibraryName)]
public static extern void glfwHideWindow(Window* window);
[DllImport(LibraryName)]
public static extern void glfwIconifyWindow(Window* window);
[DllImport(LibraryName)]
public static extern void glfwMakeContextCurrent(Window* window);
[DllImport(LibraryName)]
public static extern void glfwMaximizeWindow(Window* window);
[DllImport(LibraryName)]
public static extern void glfwPollEvents();
[DllImport(LibraryName)]
public static extern void glfwPostEmptyEvent();
[DllImport(LibraryName)]
public static extern void glfwWindowHint(WindowHintInt hint, int value);
[DllImport(LibraryName)]
public static extern void glfwWindowHint(WindowHintBool hint, int value);
[DllImport(LibraryName)]
public static extern void glfwWindowHint(WindowHintClientApi hint, ClientApi value);
[DllImport(LibraryName)]
public static extern void glfwWindowHint(WindowHintReleaseBehavior hint, ReleaseBehavior value);
[DllImport(LibraryName)]
public static extern void glfwWindowHint(WindowHintContextApi hint, ContextApi value);
[DllImport(LibraryName)]
public static extern void glfwWindowHint(WindowHintRobustness hint, Robustness value);
[DllImport(LibraryName)]
public static extern void glfwWindowHint(WindowHintOpenGlProfile hint, OpenGlProfile value);
[DllImport(LibraryName)]
public static extern int glfwWindowShouldClose(Window* window);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetCharCallback(Window* window, IntPtr callback);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetCharModsCallback(Window* window, IntPtr callback);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetCursorEnterCallback(Window* window, IntPtr callback);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetCursorPosCallback(Window* window, IntPtr callback);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetDropCallback(Window* window, IntPtr callback);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetErrorCallback(IntPtr callback);
[DllImport(LibraryName)]
public static extern void glfwSetInputMode(Window* window, CursorStateAttribute mode, CursorModeValue value);
[DllImport(LibraryName)]
public static extern void glfwSetInputMode(Window* window, StickyAttributes mode, int value);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetJoystickCallback(IntPtr callback);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetKeyCallback(Window* window, IntPtr callback);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetScrollCallback(Window* window, IntPtr callback);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetMonitorCallback(IntPtr callback);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetMouseButtonCallback(Window* window, IntPtr callback);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetWindowCloseCallback(Window* window, IntPtr callback);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetWindowFocusCallback(Window* window, IntPtr callback);
[DllImport(LibraryName)]
public static extern void glfwSetWindowIcon(Window* window, int count, Image* images);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetWindowIconifyCallback(Window* window, IntPtr callback);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetWindowContentScaleCallback(Window* window, IntPtr callback);
[DllImport(LibraryName)]
public static extern void glfwSetWindowTitle(Window* window, byte* title);
[DllImport(LibraryName)]
public static extern void glfwShowWindow(Window* window);
[DllImport(LibraryName)]
public static extern void glfwSetWindowSize(Window* window, int width, int height);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetWindowSizeCallback(Window* window, IntPtr callback);
[DllImport(LibraryName)]
public static extern void glfwSetWindowShouldClose(Window* window, int value);
[DllImport(LibraryName)]
public static extern void glfwSetWindowMonitor(Window* window, Monitor* monitor, int x, int y, int width, int height, int refreshRate);
[DllImport(LibraryName)]
public static extern void glfwSetWindowPos(Window* window, int x, int y);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetWindowPosCallback(Window* window, IntPtr callback);
[DllImport(LibraryName)]
public static extern IntPtr glfwSetWindowRefreshCallback(Window* window, IntPtr callback);
[DllImport(LibraryName)]
public static extern void glfwSwapInterval(int interval);
[DllImport(LibraryName)]
public static extern void glfwWaitEvents();
[DllImport(LibraryName)]
public static extern void glfwWaitEventsTimeout(double timeout);
[DllImport(LibraryName)]
public static extern byte* glfwGetClipboardString(Window* window);
[DllImport(LibraryName)]
public static extern void glfwSetClipboardString(Window* window, byte* data);
[DllImport(LibraryName)]
public static extern int glfwVulkanSupported();
[DllImport(LibraryName)]
public static extern byte** glfwGetRequiredInstanceExtensions(uint* count);
[DllImport(LibraryName)]
public static extern IntPtr glfwGetInstanceProcAddress(VkHandle instance, byte* procName);
[DllImport(LibraryName)]
public static extern int glfwGetPhysicalDevicePresentationSupport(VkHandle instance, VkHandle device, int queueFamily);
[DllImport(LibraryName)]
public static extern int glfwCreateWindowSurface(VkHandle instance, Window* window, void* allocator, VkHandle surface);
}
}

View File

@@ -0,0 +1,27 @@
//
// GamepadState.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// This describes the input state of a gamepad.
/// </summary>
public struct GamepadState
{
/// <summary>
/// State of each of the 15 gamepad buttons, equal to <see cref="InputAction.Press"/> or <see cref="InputAction.Release"/>.
/// </summary>
public unsafe fixed byte Buttons[15];
/// <summary>
/// State of each of the 6 gamepad axes, ranging from -1.0 to 1.0.
/// </summary>
public unsafe fixed float Axes[6];
}
}

View File

@@ -0,0 +1,37 @@
//
// GammaRamp.cs
//
// Copyright (C) 2019 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Gamma ramp for a <see cref="Monitor"/>.
/// </summary>
public unsafe struct GammaRamp
{
/// <summary>
/// Red components of the gamma ramp.
/// </summary>
public ushort* Red;
/// <summary>
/// Green components of the gamma ramp.
/// </summary>
public ushort* Green;
/// <summary>
/// Blue components of the gamma ramp.
/// </summary>
public ushort* Blue;
/// <summary>
/// Length of the arrays.
/// </summary>
public uint Size;
}
}

View File

@@ -0,0 +1,47 @@
//
// Image.cs
//
// Copyright (C) 2018 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
using System;
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Contains GLFW Image data.
/// </summary>
public unsafe struct Image
{
/// <summary>
/// Initializes a new instance of the <see cref="Image"/> struct.
/// </summary>
/// <param name="width">The width of the image in pixels.</param>
/// <param name="height">The height of the image in pixels.</param>
/// <param name="pixels"><see cref="IntPtr"/> pointing to the RGBA pixel data of the image.</param>
public Image(int width, int height, byte* pixels)
{
Width = width;
Height = height;
Pixels = pixels;
}
/// <summary>
/// The width, in pixels, of this <see cref="Image"/>.
/// </summary>
public int Width;
/// <summary>
/// The height, in pixels, of this <see cref="Image"/>.
/// </summary>
public int Height;
/// <summary>
/// A <see cref="byte"/> pointer pointing to the RGBA pixel data.
/// </summary>
public byte* Pixels;
}
}

View File

@@ -0,0 +1,23 @@
# MIT License
Copyright (c) 2006-2019 Stefanos Apostolopoulos for the Open Toolkit project.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
#### Third party licenses may be applicable. These have been disclosed in [THIRD_PARTIES.md](THIRD_PARTIES.md)

View File

@@ -0,0 +1,18 @@
//
// Monitor.cs
//
// Copyright (C) 2018 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Opaque handle to a GLFW monitor.
/// </summary>
public struct Monitor
{
}
}

View File

@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\MSBuild\Robust.Properties.targets" />
<PropertyGroup>
<!-- Work around https://github.com/dotnet/project-system/issues/4314 -->
<TargetFramework>$(TargetFramework)</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Platforms>x64</Platforms>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<Import Project="..\MSBuild\Robust.DefineConstants.targets" />
<ItemGroup>
<PackageReference Condition="'$(TargetFramework)' == 'net472'" Include="System.Memory" Version="4.5.3" />
</ItemGroup>
<ItemGroup>
<Content Include="OpenToolkit.GraphicsLibraryFramework.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Robust.Shared\Robust.Shared.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,5 @@
<configuration>
<!-- I actually have no idea whether this works on FreeBSD but it can't hurt to set it as such. -->
<dllmap os="linux,freebsd" dll="glfw3.dll" target="glfw.so.3" />
<dllmap os="osx" dll="glfw3.dll" target="glfw.3.dylib" />
</configuration>

View File

@@ -0,0 +1,20 @@
# Third parties
## AdvancedDLSupport
> OpenTK uses AdvancedDLSupport for native interoperability. To enable compatibility with the LGPLv3 License, Firwood has given us a licensing exception.
* Read the [license grant](AdvancedDLSupport-LICENSE.pdf).
* Read the [license summary](Short-LICENSE.md) for an easy-to-understand version.
## OpenEXR
> OpenTK.Half offers Half-to-Single and Single-to-Half conversions based on OpenEXR source code, which is covered by the following license:
Copyright (c) 2002, Industrial Light & Magic, a division of Lucas Digital Ltd. LLC. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Industrial Light & Magic nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,50 @@
//
// VideoMode.cs
//
// Copyright (C) 2018 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
using System.Runtime.InteropServices;
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Replicated handle to a GLFW VideoMode.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct VideoMode
{
/// <summary>
/// The width, in screen coordinates, of the <see cref="VideoMode"/>.
/// </summary>
public int Width;
/// <summary>
/// The height, in screen coordinates, of the <see cref="VideoMode"/>.
/// </summary>
public int Height;
/// <summary>
/// The bit depth of the red channel of the <see cref="VideoMode"/>.
/// </summary>
public int RedBits;
/// <summary>
/// The bit depth of the green channel of the <see cref="VideoMode"/>.
/// </summary>
public int GreenBits;
/// <summary>
/// The bit depth of the blue channel of the <see cref="VideoMode"/>.
/// </summary>
public int BlueBits;
/// <summary>
/// The refresh rate, in Hz, of the <see cref="VideoMode"/>.
/// </summary>
public int RefreshRate;
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.Runtime.InteropServices;
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// A handle to a Vulkan object.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct VkHandle
{
/// <summary>
/// The actual value of the Vulkan handle.
/// </summary>
public IntPtr Handle;
/// <summary>
/// Initializes a new instance of the <see cref="VkHandle"/> struct.
/// </summary>
/// <param name="handle">
/// The native Vulkan handle.
/// This is NOT a pointer to a field containing the handle, this is the actual handle itself.
/// </param>
public VkHandle(IntPtr handle)
{
Handle = handle;
}
}
}

View File

@@ -0,0 +1,18 @@
//
// Window.cs
//
// Copyright (C) 2018 OpenTK
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
//
namespace OpenToolkit.GraphicsLibraryFramework
{
/// <summary>
/// Opaque handle to a GLFW window.
/// </summary>
public struct Window
{
}
}

41
RUN_THIS.py Executable file
View File

@@ -0,0 +1,41 @@
#!/usr/bin/env python3
# Import future so people on py2 still get the clear error that they need to upgrade.
from __future__ import print_function
import os
import sys
import traceback
VERSION = sys.version_info
NO_PROMPT = "--no-prompt" in sys.argv
sane_input = raw_input if VERSION.major < 3 else input
def main():
if VERSION.major < 3 or (VERSION.major == 3 and VERSION.minor < 5):
print("ERROR: You need at least Python 3.5 to build SS14.")
# Need "press enter to exit" stuff because Windows just immediately closes conhost.
if not NO_PROMPT:
sane_input("Press enter to exit...")
exit(1)
# Import git_helper by modifying the path.
ss14_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(ss14_dir, "BuildChecker"))
try:
import git_helper
git_helper.main()
except Exception as e:
print("ERROR:")
traceback.print_exc()
print("This was NOT intentional. If the error is not immediately obvious, ask on Discord or IRC for help.")
if not NO_PROMPT:
sane_input("Press enter to exit...")
exit(1)
if __name__ == "__main__":
main()
if not NO_PROMPT:
sane_input("Success! Press enter to exit...")

8
Resources/.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
# .import files are made by Godot because the assets are exposed if using symlinks.
# IF you need to persist a .import file because of something used Godot-side (GUI-side),
# you can do a negation with !.
*.import
# Negation would be like this:
#!/Textures/UserInterface/1pxwhite.png.import
!/Scenes/SS14Window/closewindow.png.import
/I_MADE_THE_SYMLINK

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

BIN
Resources/Midi/fallback.sf2 Normal file

Binary file not shown.

View File

@@ -1,63 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ParticleSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Sprite>star1</Sprite>
<EmitterPosition>
<X>358</X>
<Y>385</Y>
</EmitterPosition>
<EmissionOffset>
<X>0</X>
<Y>0</Y>
</EmissionOffset>
<EmitRate>30</EmitRate>
<MaximumParticleCount>200</MaximumParticleCount>
<EmissionRadiusRange>
<X>5</X>
<Y>20</Y>
</EmissionRadiusRange>
<Velocity>
<X>0</X>
<Y>0</Y>
</Velocity>
<VelocityVariance>0</VelocityVariance>
<Acceleration>
<X>0</X>
<Y>1.5</Y>
</Acceleration>
<AccelerationVariance>0</AccelerationVariance>
<RadialVelocity>10</RadialVelocity>
<RadialVelocityVariance>0</RadialVelocityVariance>
<RadialAcceleration>-1.25</RadialAcceleration>
<RadialAccelerationVariance>0</RadialAccelerationVariance>
<TangentialVelocity>0</TangentialVelocity>
<TangentialVelocityVariance>0</TangentialVelocityVariance>
<TangentialAcceleration>0</TangentialAcceleration>
<TangentialAccelerationVariance>0</TangentialAccelerationVariance>
<Lifetime>10</Lifetime>
<LifetimeVariance>2</LifetimeVariance>
<SpinVelocity>
<X>0</X>
<Y>0</Y>
</SpinVelocity>
<SpinVelocityVariance>0</SpinVelocityVariance>
<SizeRange>
<X>0.1</X>
<Y>0.05</Y>
</SizeRange>
<SizeVariance>0.05</SizeVariance>
<ColorRange>
<Start>
<A>255</A>
<R>113</R>
<G>199</G>
<B>255</B>
</Start>
<End>
<A>80</A>
<R>103</R>
<G>180</G>
<B>255</B>
</End>
</ColorRange>
<ColorVariance>0</ColorVariance>
</ParticleSettings>

View File

@@ -1,63 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ParticleSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Sprite>star1</Sprite>
<EmitterPosition>
<X>358</X>
<Y>385</Y>
</EmitterPosition>
<EmissionOffset>
<X>0</X>
<Y>0</Y>
</EmissionOffset>
<EmitRate>30</EmitRate>
<MaximumParticleCount>200</MaximumParticleCount>
<EmissionRadiusRange>
<X>5</X>
<Y>20</Y>
</EmissionRadiusRange>
<Velocity>
<X>0</X>
<Y>0</Y>
</Velocity>
<VelocityVariance>0</VelocityVariance>
<Acceleration>
<X>0</X>
<Y>1.5</Y>
</Acceleration>
<AccelerationVariance>0</AccelerationVariance>
<RadialVelocity>10</RadialVelocity>
<RadialVelocityVariance>0</RadialVelocityVariance>
<RadialAcceleration>-1.25</RadialAcceleration>
<RadialAccelerationVariance>0</RadialAccelerationVariance>
<TangentialVelocity>0</TangentialVelocity>
<TangentialVelocityVariance>0</TangentialVelocityVariance>
<TangentialAcceleration>0</TangentialAcceleration>
<TangentialAccelerationVariance>0</TangentialAccelerationVariance>
<Lifetime>10</Lifetime>
<LifetimeVariance>2</LifetimeVariance>
<SpinVelocity>
<X>0</X>
<Y>0</Y>
</SpinVelocity>
<SpinVelocityVariance>0</SpinVelocityVariance>
<SizeRange>
<X>0.1</X>
<Y>0.05</Y>
</SizeRange>
<SizeVariance>0.05</SizeVariance>
<ColorRange>
<Start>
<A>255</A>
<R>228</R>
<G>26</G>
<B>199</B>
</Start>
<End>
<A>30</A>
<R>223</R>
<G>31</G>
<B>212</B>
</End>
</ColorRange>
<ColorVariance>0</ColorVariance>
</ParticleSettings>

View File

@@ -1,63 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ParticleSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Sprite>smoke</Sprite>
<EmitterPosition>
<X>358</X>
<Y>385</Y>
</EmitterPosition>
<EmissionOffset>
<X>0</X>
<Y>0</Y>
</EmissionOffset>
<EmitRate>11</EmitRate>
<MaximumParticleCount>200</MaximumParticleCount>
<EmissionRadiusRange>
<X>0</X>
<Y>0</Y>
</EmissionRadiusRange>
<Velocity>
<X>0</X>
<Y>-0</Y>
</Velocity>
<VelocityVariance>0</VelocityVariance>
<Acceleration>
<X>0</X>
<Y>-13</Y>
</Acceleration>
<AccelerationVariance>3</AccelerationVariance>
<RadialVelocity>0</RadialVelocity>
<RadialVelocityVariance>0</RadialVelocityVariance>
<RadialAcceleration>0</RadialAcceleration>
<RadialAccelerationVariance>0</RadialAccelerationVariance>
<TangentialVelocity>0</TangentialVelocity>
<TangentialVelocityVariance>0</TangentialVelocityVariance>
<TangentialAcceleration>0</TangentialAcceleration>
<TangentialAccelerationVariance>0</TangentialAccelerationVariance>
<Lifetime>3</Lifetime>
<LifetimeVariance>0</LifetimeVariance>
<SpinVelocity>
<X>0</X>
<Y>0</Y>
</SpinVelocity>
<SpinVelocityVariance>0.3</SpinVelocityVariance>
<SizeRange>
<X>0</X>
<Y>1</Y>
</SizeRange>
<SizeVariance>0</SizeVariance>
<ColorRange>
<Start>
<A>208</A>
<R>128</R>
<G>128</G>
<B>128</B>
</Start>
<End>
<A>0</A>
<R>48</R>
<G>48</G>
<B>48</B>
</End>
</ColorRange>
<ColorVariance>0</ColorVariance>
</ParticleSettings>

View File

@@ -1,63 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ParticleSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Sprite>star1</Sprite>
<EmitterPosition>
<X>358</X>
<Y>385</Y>
</EmitterPosition>
<EmissionOffset>
<X>0</X>
<Y>0</Y>
</EmissionOffset>
<EmitRate>40</EmitRate>
<MaximumParticleCount>200</MaximumParticleCount>
<EmissionRadiusRange>
<X>10</X>
<Y>170</Y>
</EmissionRadiusRange>
<Velocity>
<X>0</X>
<Y>-20</Y>
</Velocity>
<VelocityVariance>0</VelocityVariance>
<Acceleration>
<X>0</X>
<Y>-30</Y>
</Acceleration>
<AccelerationVariance>0</AccelerationVariance>
<RadialVelocity>0</RadialVelocity>
<RadialVelocityVariance>1</RadialVelocityVariance>
<RadialAcceleration>10</RadialAcceleration>
<RadialAccelerationVariance>0</RadialAccelerationVariance>
<TangentialVelocity>0</TangentialVelocity>
<TangentialVelocityVariance>1</TangentialVelocityVariance>
<TangentialAcceleration>0</TangentialAcceleration>
<TangentialAccelerationVariance>0.2</TangentialAccelerationVariance>
<Lifetime>3</Lifetime>
<LifetimeVariance>0</LifetimeVariance>
<SpinVelocity>
<X>0</X>
<Y>0</Y>
</SpinVelocity>
<SpinVelocityVariance>2</SpinVelocityVariance>
<SizeRange>
<X>1</X>
<Y>1</Y>
</SizeRange>
<SizeVariance>0</SizeVariance>
<ColorRange>
<Start>
<A>255</A>
<R>0</R>
<G>0</G>
<B>255</B>
</Start>
<End>
<A>255</A>
<R>0</R>
<G>0</G>
<B>0</B>
</End>
</ColorRange>
<ColorVariance>0</ColorVariance>
</ParticleSettings>

View File

@@ -1,33 +0,0 @@
- type: entity
id: Janitor_Suit
name: Janitor Jumpsuit
components:
- type: Transform
- type: Clickable
- type: WearableAnimatedSprite
sprite: player_jumpsuit_gray
notWornSprite: janitorsuit
- type: Icon
icon: janitorsuit
- type: BoundingBox
- type: Physics
mass: 5
- type: entity
id: Shoes
name: Shoes
components:
- type: Transform
- type: Clickable
- type: WearableAnimatedSprite
sprite: player_toolbox
notWornSprite: shoes
- type: Icon
icon: shoes
- type: BoundingBox
- type: Physics
mass: 5

View File

@@ -1,16 +0,0 @@
- type: entity
id: Toolbox
name: Toolbox
components:
- type: Transform
- type: Clickable
- type: WearableAnimatedSprite
sprite: player_toolbox
notWornSprite: toolbox_r
- type: Icon
icon: toolbox_r
- type: BoundingBox
- type: Physics
mass: 5

View File

@@ -1,17 +0,0 @@
- type: entity
id: Door
name: Door
components:
- type: Transform
- type: Clickable
- type: Sprite
drawdepth: FloorPlaceable
sprites:
- door_ew
- door_ewo
- type: Icon
icon: door_ew
- type: BoundingBox
- type: Collidable

View File

@@ -1,16 +0,0 @@
- type: entity
id: Mop
name: Mop
components:
- type: Transform
- type: Clickable
- type: WearableAnimatedSprite
sprite: player_toolbox
notWornSprite: mop
- type: Icon
icon: mop
- type: BoundingBox
- type: Physics
- type: Clickable

View File

@@ -1,22 +0,0 @@
- type: entity
id: WallLight
name: Wall Light
components:
- type: Transform
- type: Clickable
- type: Sprite
sprites:
- wall_light
- type: Icon
icon: wall_light
- type: PointLight
lightoffsetx: 0
lightoffsety: 0
lightradius: 1024
lightColorR: 220
lightColorG: 220
lightColorB: 198
mask: whitemask
startState: On

View File

@@ -1,23 +0,0 @@
- type: entity
id: HumanMob
name: Urist McHuman
components:
- type: Transform
- type: Clickable
- type: AnimatedSprite
sprite: player
- type: Icon
icon: player
- type: BoundingBox
sizeX: 0.9
sizeY: 0.9
- type: ParticleSystem
- type: Physics
mass: 5
- type: Collidable
DebugColor: "#0000FF"

Some files were not shown because too many files have changed in this diff Show More