pygame-pygame-core


Namepygame-pygame-core JSON
Version 0.1.33 PyPI version JSON
download
home_pagehttps://github.com/PolyStack-Games/Pygame-Core
SummaryA modular pygame_core library for Pygame-based 2D games.
upload_time2025-01-08 20:07:04
maintainerNone
docs_urlNone
authorPolyStack Games
requires_pythonNone
licenseMIT
keywords pygame game development engine
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Pygame Core

## Overview

**Pygame Core** is a modular and reusable library designed to simplify the development of 2D games using the Pygame library. It provides essential components for managing game loops, scenes, input handling, and utility functions, allowing developers to focus on building their game's unique features.

## Features

- **Game Loop Management**: Simplifies the main game loop with FPS control.
- **Scene Management**: Enables seamless transitions between game scenes (e.g., menus, gameplay).
- **Input Handling**: Centralized input management for keyboards or other devices.
- **Utilities**: Provides tools like collision detection and default settings.
- **Extensibility**: Designed for easy customization and expansion.

## Installation

Install the package using `pip`:

```bash
pip install pygame-pygame_core
```

## Usage

### Setting Up Your Game

Below is an example of how to use **Pygame Core** to create a simple game:

```python
import pygame
from pygame_core import Game, Scene, SceneManager


class MainMenu(Scene):
    def update(self, input_manager):
        if input_manager.is_pressed(pygame.K_RETURN):
            return Gameplay(self.screen)

    def render(self):
        self.screen.fill((0, 0, 0))
        font = pygame.font.Font(None, 74)
        text = font.render("Press Enter to Start", True, (255, 255, 255))
        self.screen.blit(text, (150, 300))


class Gameplay(Scene):
    def update(self, input_manager):
        # Game logic goes here
        pass

    def render(self):
        self.screen.fill((30, 30, 30))


if __name__ == "__main__":
    pygame.init()
    screen = pygame.display.set_mode((800, 600))
    pygame.display.set_caption("Pygame Core Example")

    manager = SceneManager(MainMenu(screen))
    game = Game(screen)
    game.run(manager)
    pygame.quit()
```

### Key Components

- **`Game`**: Manages the main game loop and FPS control.
- **`Scene`**: A base class for creating game scenes with `update` and `render` methods.
- **`SceneManager`**: Handles scene transitions.
- **`InputManager`**: Provides a clean interface for checking key states.
- **`Utils`**: Includes common utilities like collision detection.

## Contributing

Contributions are welcome! To contribute:

1. Fork the repository.
2. Create a new branch for your feature or bug fix.
3. Make your changes.
4. Run a pylint `pylint core`
5. Submit a pull request.

Please ensure all tests pass before submitting your PR.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.

## Upload

> Remember to update version number in `VERSION` file and delete the dist folder before uploading.

Build:

```bash
python -m build
```

Upload:

```bash
python -m twine upload dist/*
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/PolyStack-Games/Pygame-Core",
    "name": "pygame-pygame-core",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "pygame game development engine",
    "author": "PolyStack Games",
    "author_email": "nicklasbeyerlydersen@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/08/5e/a990ee0e3a1d2757a090db464b88337d580aa78830db2e65bdb955809eee/pygame_pygame_core-0.1.33.tar.gz",
    "platform": null,
    "description": "# Pygame Core\n\n## Overview\n\n**Pygame Core** is a modular and reusable library designed to simplify the development of 2D games using the Pygame library. It provides essential components for managing game loops, scenes, input handling, and utility functions, allowing developers to focus on building their game's unique features.\n\n## Features\n\n- **Game Loop Management**: Simplifies the main game loop with FPS control.\n- **Scene Management**: Enables seamless transitions between game scenes (e.g., menus, gameplay).\n- **Input Handling**: Centralized input management for keyboards or other devices.\n- **Utilities**: Provides tools like collision detection and default settings.\n- **Extensibility**: Designed for easy customization and expansion.\n\n## Installation\n\nInstall the package using `pip`:\n\n```bash\npip install pygame-pygame_core\n```\n\n## Usage\n\n### Setting Up Your Game\n\nBelow is an example of how to use **Pygame Core** to create a simple game:\n\n```python\nimport pygame\nfrom pygame_core import Game, Scene, SceneManager\n\n\nclass MainMenu(Scene):\n    def update(self, input_manager):\n        if input_manager.is_pressed(pygame.K_RETURN):\n            return Gameplay(self.screen)\n\n    def render(self):\n        self.screen.fill((0, 0, 0))\n        font = pygame.font.Font(None, 74)\n        text = font.render(\"Press Enter to Start\", True, (255, 255, 255))\n        self.screen.blit(text, (150, 300))\n\n\nclass Gameplay(Scene):\n    def update(self, input_manager):\n        # Game logic goes here\n        pass\n\n    def render(self):\n        self.screen.fill((30, 30, 30))\n\n\nif __name__ == \"__main__\":\n    pygame.init()\n    screen = pygame.display.set_mode((800, 600))\n    pygame.display.set_caption(\"Pygame Core Example\")\n\n    manager = SceneManager(MainMenu(screen))\n    game = Game(screen)\n    game.run(manager)\n    pygame.quit()\n```\n\n### Key Components\n\n- **`Game`**: Manages the main game loop and FPS control.\n- **`Scene`**: A base class for creating game scenes with `update` and `render` methods.\n- **`SceneManager`**: Handles scene transitions.\n- **`InputManager`**: Provides a clean interface for checking key states.\n- **`Utils`**: Includes common utilities like collision detection.\n\n## Contributing\n\nContributions are welcome! To contribute:\n\n1. Fork the repository.\n2. Create a new branch for your feature or bug fix.\n3. Make your changes.\n4. Run a pylint `pylint core`\n5. Submit a pull request.\n\nPlease ensure all tests pass before submitting your PR.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n## Upload\n\n> Remember to update version number in `VERSION` file and delete the dist folder before uploading.\n\nBuild:\n\n```bash\npython -m build\n```\n\nUpload:\n\n```bash\npython -m twine upload dist/*\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A modular pygame_core library for Pygame-based 2D games.",
    "version": "0.1.33",
    "project_urls": {
        "Homepage": "https://github.com/PolyStack-Games/Pygame-Core",
        "Source": "https://github.com/PolyStack-Games/Pygame-Core"
    },
    "split_keywords": [
        "pygame",
        "game",
        "development",
        "engine"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a7faf0d4e52fc49ffd5e79174e2508da70973a4a20faa1de594db446b37a128e",
                "md5": "dfea7f012828c76de74bc67278988b05",
                "sha256": "8f823c1c0a533ed82ddad7fcec5297fdbc38b812084b8da66d96ee8e3127b166"
            },
            "downloads": -1,
            "filename": "pygame_pygame_core-0.1.33-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dfea7f012828c76de74bc67278988b05",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 13163,
            "upload_time": "2025-01-08T20:07:03",
            "upload_time_iso_8601": "2025-01-08T20:07:03.211020Z",
            "url": "https://files.pythonhosted.org/packages/a7/fa/f0d4e52fc49ffd5e79174e2508da70973a4a20faa1de594db446b37a128e/pygame_pygame_core-0.1.33-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "085ea990ee0e3a1d2757a090db464b88337d580aa78830db2e65bdb955809eee",
                "md5": "f3b072fe627328afd28eb290f169b879",
                "sha256": "2b33f6dee420f098b345dd449fcd35a5a0206778de3f41c9c336dbb4b6cca605"
            },
            "downloads": -1,
            "filename": "pygame_pygame_core-0.1.33.tar.gz",
            "has_sig": false,
            "md5_digest": "f3b072fe627328afd28eb290f169b879",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 12461,
            "upload_time": "2025-01-08T20:07:04",
            "upload_time_iso_8601": "2025-01-08T20:07:04.716100Z",
            "url": "https://files.pythonhosted.org/packages/08/5e/a990ee0e3a1d2757a090db464b88337d580aa78830db2e65bdb955809eee/pygame_pygame_core-0.1.33.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-08 20:07:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PolyStack-Games",
    "github_project": "Pygame-Core",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "pygame-pygame-core"
}
        
Elapsed time: 0.39904s