Skip to content

Latest commit

 

History

History
20 lines (19 loc) · 1.31 KB

STYLE.md

File metadata and controls

20 lines (19 loc) · 1.31 KB

STYLE

  1. Each component must be in a separate class, in a separate file
  2. Each component must have a render method.
  3. The render method must only be concerned with rendering the component and nothing else.
  4. If data manipulation is needed, separate method must be created and called.
  5. In each component class, member functions must be placed alphabetically. The render method must be placed at the bottom.
  6. Any sub-render method (ex: render_button, render_title etc) must be placed before render, in alphabetically.
  7. Any data that belongs to any of the following categories, must be kept in utils.py:
  8. Needed frequently
  9. Needed in multiple components
  10. Loaded from a file (ex: audio, images, fonts etc)
  11. Each component that is concerned with pygame events must have an event_handler method, which may call other member functions
  12. The event_handler member must be placed right after __init__
  13. Importing modules must be broken into following categories, alphabetically:
  14. Import from utils.py
  15. Python packages
  16. Components (Button, Text, Menu etc)
  17. In any category, from X import Y must be placed above import X
  18. If, at any point, line-width exceeds 80 characters, write all items in multiple lines, wrapped in parenthesis. The closing parenthesis must stay with last item.