Skip to content

Commit

Permalink
etc: Pretty printers for integer coordinates.
Browse files Browse the repository at this point in the history
  • Loading branch information
heinezen committed Apr 19, 2024
1 parent d72d9b9 commit a0de523
Showing 1 changed file with 51 additions and 1 deletion.
52 changes: 51 additions & 1 deletion etc/gdb_pretty/printers.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,57 @@ def children(self):
yield ('up', self.__val['up'])


@printer_regex('^openage::coord::(camhud|viewport|input|term)(_delta)?')
class CoordXYPrinter:
"""
Pretty printer for openage::coord::CoordXY.
TODO: Inherit from gdb.ValuePrinter when gdb 14.1 is available in all distros.
"""

def __init__(self, val: gdb.Value):
self.__val = val

def to_string(self):
"""
Get the coord as a string.
"""
return self.__val.type.name

def children(self):
"""
Get the displayed children of the coord.
"""
yield ('x', self.__val['x'])
yield ('y', self.__val['y'])


@printer_regex('^openage::coord::(camhud|viewport|input|term)3(_delta)?')
class CoordXYZPrinter:
"""
Pretty printer for openage::coord::CoordXYZ.
TODO: Inherit from gdb.ValuePrinter when gdb 14.1 is available in all distros.
"""

def __init__(self, val: gdb.Value):
self.__val = val

def to_string(self):
"""
Get the coord as a string.
"""
return self.__val.type.name

def children(self):
"""
Get the displayed children of the coord.
"""
yield ('x', self.__val['x'])
yield ('y', self.__val['y'])
yield ('z', self.__val['z'])


@printer_typedef('openage::time::time_t')
class TimePrinter:
"""
Expand Down Expand Up @@ -286,7 +337,6 @@ def children(self):
yield ('value', self.__val['value'])

# TODO: curve types
# TODO: coord types
# TODO: pathfinding types
# TODO: input event codes
# TODO: eigen types https://github.com/dmillard/eigengdb

0 comments on commit a0de523

Please sign in to comment.