Skip to content

Commit

Permalink
Merge pull request #159 from arnauddupuis/sprite-editor
Browse files Browse the repository at this point in the history
Sprite editor + UI module
  • Loading branch information
arnauddupuis committed May 17, 2021
2 parents 019a9ad + 837797a commit cddd9de
Show file tree
Hide file tree
Showing 51 changed files with 7,870 additions and 230 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ coverage:
coverage run --source=./pygamelib -m unittest discover -s tests
coverage report
coverage html
coverage xml

test:
python3 -m unittest discover -s tests
Expand Down
18 changes: 14 additions & 4 deletions docs/source/actuators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,18 @@
actuators
=========

This module contains the base classes for simple and advanced actuators.
These classes are the base contract for actuators.
If you wish to create your own one, you need to inherit from one of these base class.

.. toctree::
pygamelib.actuators.Actuator
pygamelib.actuators.Behavioral
pygamelib.actuators.PathActuator
pygamelib.actuators.PatrolActuator
pygamelib.actuators.PathFinder
pygamelib.actuators.RandomActuator
pygamelib.actuators.UnidirectionalActuator

.. automodule:: pygamelib.actuators
:members:
:inherited-members:
:undoc-members:
:show-inheritance:
:noindex:
6 changes: 3 additions & 3 deletions docs/source/assets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
assets
======

.. toctree::
graphics

The assets sub-module holds all the classes that are adding features without being core
features. The graphics module is a good example of that: it is cool to have and provides
a nice default set of assets to build games. But the library can work without it.

.. toctree::
graphics
1 change: 1 addition & 0 deletions docs/source/gfx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ The gfx (for graphics) sub-module holds all the classes related to the graphics

.. toctree::
gfx_core
gfx_ui
gfx_particles

35 changes: 35 additions & 0 deletions docs/source/gfx_ui.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.. _gfx_ui-module:

ui
==

.. warning:: The UI module is in alpha version. Some things might change over time.

The ui module contains the classes to easily build full screen Terminal User Interface
(TUI) for your games (or applications).

.. important:: It works exclusively with the screen buffer system (place, delete,
render, update, etc.).
It doesn't work with Screen functions tagged "direct display" like display_at().

.. toctree::

pygamelib.gfx.ui.Box.rst
pygamelib.gfx.ui.ColorPickerDialog.rst
pygamelib.gfx.ui.ColorPicker.rst
pygamelib.gfx.ui.Dialog.rst
pygamelib.gfx.ui.FileDialog.rst
pygamelib.gfx.ui.GridSelectorDialog.rst
pygamelib.gfx.ui.GridSelector.rst
pygamelib.gfx.ui.LineInputDialog.rst
pygamelib.gfx.ui.Menu
pygamelib.gfx.ui.MenuAction
pygamelib.gfx.ui.MenuBar
pygamelib.gfx.ui.MessageDialog.rst
pygamelib.gfx.ui.MultiLineInputDialog.rst
pygamelib.gfx.ui.ProgressBar.rst
pygamelib.gfx.ui.ProgressDialog.rst
pygamelib.gfx.ui.UiConfig.rst

.. automodule:: pygamelib.gfx.ui
:noindex:
65 changes: 63 additions & 2 deletions docs/source/graphics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,67 @@
graphics
========

.. Important:: The Graphics module was introduced in version 1.1.0.

The Graphics module hold many variables that aims at simplifying the use of
unicode characters in the game development process.

This module also import colorama. All styling features are accessible through:

* Graphics.Fore for Foreground colors.
* Graphics.Back for Background colors.
* Graphics.Style for styling options.

For convenience, the different entities are scattered in grouping classes:

* All emojis are in the Models class.
* The UI/box drawings are grouped into the BoxDrawings class.
* The block glyphs are in the Blocks class.
* The geometric shapes are in the GeometricShapes class.

This modules defines a couple of colored squares and rectangles that should displays
correctly in all terminals.

These are kept for legacy purpose (I personally have a lot of kids that are still using
it), but for anyone starting fresh, it is better to use the <color>_rect() and
<color>_square() static methods of the :class:`~pygamelib.gfx.core.Sprixel` class.
Particularly if you are going to use them as background for your Board.

Colored rectangles:

* WHITE_RECT
* BLUE_RECT
* RED_RECT
* MAGENTA_RECT
* GREEN_RECT
* YELLOW_RECT
* BLACK_RECT
* CYAN_RECT

Then colored squares:

* WHITE_SQUARE
* MAGENTA_SQUARE
* GREEN_SQUARE
* RED_SQUARE
* BLUE_SQUARE
* YELLOW_SQUARE
* BLACK_SQUARE
* CYAN_SQUARE

And finally an example of composition of rectangles to make different colored squares:

* RED_BLUE_SQUARE = RED_RECT+BLUE_RECT
* YELLOW_CYAN_SQUARE = YELLOW_RECT+CYAN_RECT


The Graphics module contains the following classes:

.. toctree::
pygamelib.assets.graphics.Blocks
pygamelib.assets.graphics.BoxDrawings
pygamelib.assets.graphics.GeometricShapes
pygamelib.assets.graphics.Models

.. automodule:: pygamelib.assets.graphics
:members:
:inherited-members:
:noindex:
Binary file added docs/source/menu.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions docs/source/pygamelib.actuators.Actuator.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
pygamelib.actuators.Actuator
============================
Actuator
========

.. currentmodule:: pygamelib.actuators

.. autoclass:: Actuator
:members:
:inherited-members:
:undoc-members:
:show-inheritance:


.. automethod:: __init__
Expand Down
8 changes: 6 additions & 2 deletions docs/source/pygamelib.actuators.Behavioral.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
pygamelib.actuators.Behavioral
==============================
Behavioral
==========

.. currentmodule:: pygamelib.actuators

.. autoclass:: Behavioral
:members:
:inherited-members:
:undoc-members:
:show-inheritance:


.. automethod:: __init__
Expand Down
8 changes: 6 additions & 2 deletions docs/source/pygamelib.actuators.PathActuator.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
pygamelib.actuators.PathActuator
================================
PathActuator
============

.. currentmodule:: pygamelib.actuators

.. autoclass:: PathActuator
:members:
:inherited-members:
:undoc-members:
:show-inheritance:


.. automethod:: __init__
Expand Down
8 changes: 6 additions & 2 deletions docs/source/pygamelib.actuators.PathFinder.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
pygamelib.actuators.PathFinder
==============================
PathFinder
==========

.. currentmodule:: pygamelib.actuators

.. autoclass:: PathFinder
:members:
:inherited-members:
:undoc-members:
:show-inheritance:


.. automethod:: __init__
Expand Down
8 changes: 6 additions & 2 deletions docs/source/pygamelib.actuators.PatrolActuator.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
pygamelib.actuators.PatrolActuator
==================================
PatrolActuator
==============

.. currentmodule:: pygamelib.actuators

.. autoclass:: PatrolActuator
:members:
:inherited-members:
:undoc-members:
:show-inheritance:


.. automethod:: __init__
Expand Down
8 changes: 6 additions & 2 deletions docs/source/pygamelib.actuators.RandomActuator.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
pygamelib.actuators.RandomActuator
==================================
RandomActuator
==============

.. currentmodule:: pygamelib.actuators

.. autoclass:: RandomActuator
:members:
:inherited-members:
:undoc-members:
:show-inheritance:


.. automethod:: __init__
Expand Down
8 changes: 6 additions & 2 deletions docs/source/pygamelib.actuators.UnidirectionalActuator.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
pygamelib.actuators.UnidirectionalActuator
==========================================
UnidirectionalActuator
======================

.. currentmodule:: pygamelib.actuators

.. autoclass:: UnidirectionalActuator
:members:
:inherited-members:
:undoc-members:
:show-inheritance:


.. automethod:: __init__
Expand Down
8 changes: 6 additions & 2 deletions docs/source/pygamelib.assets.graphics.Blocks.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
pygamelib.assets.graphics.Blocks
================================
Blocks
======

.. currentmodule:: pygamelib.assets.graphics

.. autoclass:: Blocks
:members:
:inherited-members:
:undoc-members:
:show-inheritance:


.. automethod:: __init__
Expand Down
8 changes: 6 additions & 2 deletions docs/source/pygamelib.assets.graphics.BoxDrawings.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
pygamelib.assets.graphics.BoxDrawings
=====================================
BoxDrawings
===========

.. currentmodule:: pygamelib.assets.graphics

.. autoclass:: BoxDrawings
:members:
:inherited-members:
:undoc-members:
:show-inheritance:


.. automethod:: __init__
Expand Down
8 changes: 6 additions & 2 deletions docs/source/pygamelib.assets.graphics.GeometricShapes.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
pygamelib.assets.graphics.GeometricShapes
=========================================
GeometricShapes
===============

.. currentmodule:: pygamelib.assets.graphics

.. autoclass:: GeometricShapes
:members:
:inherited-members:
:undoc-members:
:show-inheritance:


.. automethod:: __init__
Expand Down
8 changes: 6 additions & 2 deletions docs/source/pygamelib.assets.graphics.Models.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
pygamelib.assets.graphics.Models
================================
Models
======

.. currentmodule:: pygamelib.assets.graphics

.. autoclass:: Models
:members:
:inherited-members:
:undoc-members:
:show-inheritance:


.. automethod:: __init__
Expand Down
36 changes: 36 additions & 0 deletions docs/source/pygamelib.gfx.ui.Box.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Box
===

.. currentmodule:: pygamelib.gfx.ui

.. autoclass:: Box
:members:
:inherited-members:
:undoc-members:
:show-inheritance:


.. automethod:: __init__


.. rubric:: Methods

.. autosummary::

~Box.__init__
~Box.render_to_buffer





.. rubric:: Attributes

.. autosummary::

~Box.config
~Box.height
~Box.title
~Box.width


0 comments on commit cddd9de

Please sign in to comment.