Isoldhe / Battleship

Battleship game in C#
0 stars 1 forks source link

Handling mouse input and window resizing events #12

Closed Atrixsanna closed 5 years ago

Atrixsanna commented 5 years ago

The following link describes low level console I/O operations, even handling mouse input.. This sounds very interesting and useful, but it's probably a lot of work to get it all working correctly. This might however also solve the window resizing issue where the user can just resize the window and make the game crash where the game attempts to write a character out-of-bounds.

https://docs.microsoft.com/en-us/windows/console/low-level-console-i-o

Atrixsanna commented 5 years ago

This one will probably take me a little more time to figure out, since it involves some platform invoke kernel32.dll function calls, but it will increase the flexibility of our game manifold: for example we'd be able to use text colors and background colors. All at top speed. Will probably also improve our ability to make use of multithreading by providing our own implementation of character buffering.

I'm not quite sure about the window resizing and mouse events yet, but I'll post my journey through low-level-console-io here along the way.

Properly implementing this approach for drawing a DisplayElement should remove the need for issue #6