RazorSharpFang
Spatial Display and asynchronous updates for desktop Gui app
Okay, so we need to display a set of possibly moving objects in 2D on a top-down map.
As well as do hit-detection of the cursor against those entities.
Naturally, we need to draw them.
So we have a need to be able to quickly obtain a slice of them that intersect the viewbox of the 2D map, as well as detect which ones we are clicking on.
So, spatial-indexing is desired, hence the thought to have a QuadTree to organize them.
This would not be a thread-safe collection, and we would need to synchronize access to it.
Updates to this would come in from threads other than the main thread.
The main thread needs to read from the tree very often.
Which of the folowing approaches would be preferred:
1) Assert that the tree is a threaded object local to the main thread, thus any updates to the tree will be dispatched and executed on the main thread.
2) Have access to the QuadTree guarded through the use of reader writer locks, with threads contesting and taking these locks when needed.
I am very open to discussion and ideas about this - perhaps some of my assumptions here are wrong. :catfine:
33 replies
✅ Windows Joystick API
What's the recommended Windows API to use for Joystick/Gamepad input these days if one needs background (non-focused window, problem for Windows.Gaming.Input) input, and one is not willing to take a dependency on the GDK (Read: No GameInput) whilst also being able to read independently the two triggers of the Xbox-style gamepad controllers (Problem for DirectInput) and working with various types of controllers that are NOT XInput-compatible (Like the PS4 controllers, problem for XInput) ?
29 replies
❔ SQLite in-memory Database read from ReadOnlyMemory bytes
I'm receiving an SQLite database payload from an AMQP-0-9-1 message in the form of
ReadOnlyMemory<byte>
Rather than writing these bytes to disk and then opening that file with the regular SQLite toolset, I want to be able to work with the sqlite database in a read-only form without having to hit the disk.
Is this possible with the currently available SQLite toolset, or is this an impossible task?75 replies
Unmanaged struct backed INPC ViewModel, only raising PropertyChanged when backing field(s) changed
So, suppose we have a large unmanaged struct that we obtain from external source, suppose from a network resource.
This unmanaged struct decomposes into a set of primitives, with various values.
and then we have our ViewModel class that implements INotifyPropertyChanged. I have made an example below, not using the above struct as a field.
I had a thought to in the View Model class just have a single field of the unmanaged struct, and then fire off events of property changed.
But if I were to do that, how would one determine which properties were changed ?
Would it be better to have the unmanaged struct as the sole backing field, or should I not do that?
3 replies
How do you pass into a method a generic after you've reflected? [Answered]
Suppose I suspect that this IEnumerable (non-generic) is also an IReadOnlyList<T> where T : struct.
Unfortunately due to the rules of casting, an IReadOnlyList<T> where T : struct is not castable to an IReadOnlyList<object>
How unfortunate! But we have reflection!
Suppose I have an IEnumerable called source. I can probe its types as follows
Another class takes in as an argument to its constructor, IReadOnlyList<T> Defined below:
How do I after probing call this constructor now that I know it implements the interface as required?
42 replies