Commit graph

17 commits

Author SHA1 Message Date
def79386d8 Move the renderable part of Entity to a Renderable component
Move symbol, render order, foreground, and background properties on Entity
to a new Component called Renderable.
2023-03-11 00:58:58 -08:00
f78bc39e3b Clean up a few type checker things 2023-03-11 00:57:15 -08:00
078520678d Figure out (finally!) the mouse coordinates in the MapWindow 2023-03-10 23:53:08 -08:00
2d82d9834f Do pathfinding from the hero to the mouse point
It works finally! And uses A*!
2023-03-07 22:18:31 -08:00
a8bbc47668 Move all interface Windows to their own modules in interface.window 2023-03-07 21:44:19 -08:00
003aedf30e Restructure event handling
Events start in the Interface. The interface gets first crack at any incoming
events. If the interface doesn't handle the event, it is given to the
engine. The engine has an EngineEventHandler that yields actions just
like the event handler prior to this change.

The interface's event handler passes events to each window in the
interface. Windows can choose to handle events however they like, and
they return a bool indicating whether the event was fully handled.
2023-03-07 21:29:28 -08:00
af3d93ba11 Fix up how Maps are rendered in MapWindows
There was a bug in how MapWindow was calculating the numpy array slices
when drawing the map. Redo how this works so that MapWindow can draw
maps of arbitrary size and center maps that are smaller than the window's
drawable area.
2023-03-05 13:37:51 -08:00
4050ac5c6f Add a bunch of doc strings and header comments to files 2023-02-15 08:25:40 -08:00
356e205f2c Implement viewport tracking for the MapWindow
As the player moves the hero, the MapWindow will try to keep the
hero in the middle of the view.
2023-02-12 19:47:27 -08:00
8efd3ce207 Refactor map rendering
- Move all map rendering to a new MapWindow class
- Clip map rendering to the bounds of the Window
- Pass in Entities list from the Engine and render them relative to the window

The map doesn't scroll yet, so it'll always be clipped on the bottom and
right.
2023-02-12 15:55:01 -08:00
6780b0495c Move all the interface stuff to interface.Interface
Draw three windows with frames:
- map window
- info window (hit point bar; turn count)
- message window

Clean up the UI code in the Engine.
2023-02-11 01:21:52 -08:00
4124d1ae4e Clean up some pylint warnings in interface/color.py 2022-05-16 20:49:28 -07:00
e5485300ef Rename interface.bar.Bar -> interface.percentage_bar.PercentageBar 2022-05-16 16:47:21 -07:00
18a068cff6 Add some more basic colors and some semantic colors for the Health Bar 2022-05-16 16:40:29 -07:00
11aee12320 Add colors attribute to Bar class
This list lets you specify a set of colors that the bar should be painted with
depending on the percentage the bar is filled
2022-05-16 16:40:04 -07:00
6073454ed3 Add line 1 comment to interface/__init__.py 2022-05-16 16:39:19 -07:00
5a9df0a322 Add my first interface element: a Bar!
It renders a bar of a certain width and a percentage full. Use it to render HP.

Add a new Python package called interface. The Bar class lives there. Also add a
bunch of color defintions to a module called interface.color.
2022-05-15 00:12:05 -07:00