pg-core


Namepg-core JSON
Version 1.0 PyPI version JSON
download
home_page
SummarySimple Core class for pygame
upload_time2023-10-11 19:14:15
maintainer
docs_urlNone
authorVinicius Putti Morais
requires_python
licenseMIT license
keywords pygame
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Pygame Core Library

The Pygame Core Library is a versatile framework for developing 2D games using the Pygame library. It provides essential components and a simple structure to help you get started with game development in Python. The library includes features such as a game loop manager, scheduled events, and an FPS display.

## Installation

To use this library, you'll need to have [Pygame](https://www.pygame.org/) installed. You can install it using pip:

```
pip install pygame
```

Once Pygame is installed, you can include the `core.py` file in your project, and you're ready to start using the Pygame Core Library.

## Usage

To get started with the Pygame Core Library, follow these steps:

1. Import the library into your project:

```python
import pygame_core
```

2. Create a class that extends `Core` class to set up your game:

```python
class MyClass(pygame_core.Core):

    def __init__(self, **kwargs):
        super()._init__(**kargs)

game = MyClass(size=(800, 600))
```

3. Implement your game logic by overriding the `update` and `draw` methods in your `Core` instance:

```python
def update(self):
    # Your game logic here
    pass

def draw(self):
    # Your rendering code here
    pass
```

4. Run your game by calling the `run` method on your `Core` instance:

```python
game.run()
```

5. You can schedule repeating or one-time events using the `set_interval` and `set_timeout` methods:

```python
# Schedule a function to run every 1000 milliseconds (1 second)
game.set_interval(1000, my_function)

# Schedule a one-time event to run after 2000 milliseconds (2 seconds)
game.set_timeout(2000, another_function)
```

6. Customize the FPS display and other settings by passing appropriate arguments when creating your `Core` instance.

7. Don't forget to handle Pygame events by overriding the `check_event` method in your `Core` instance for custom event handling.

8. Add any necessary cleanup or exit code in the `__exit__` method of your `Core` instance.

## Contributing

Feel free to contribute to the Pygame Core Library by submitting issues, feature requests, or pull requests on the [GitHub repository](https://github.com/viniputtim/pg-core).

## License

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

## Acknowledgments

- Pygame (https://www.pygame.org/) for the underlying game development framework.

Happy game development with Pygame Core Library! If you have any questions or need assistance, don't hesitate to reach out.



            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pg-core",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pygame",
    "author": "Vinicius Putti Morais",
    "author_email": "viniputtim@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/11/4c/58067d61ee4d240c167595388d5508621fcfef8db9e86b405bbd77f85443/pg_core-1.0.tar.gz",
    "platform": null,
    "description": "# Pygame Core Library\n\nThe Pygame Core Library is a versatile framework for developing 2D games using the Pygame library. It provides essential components and a simple structure to help you get started with game development in Python. The library includes features such as a game loop manager, scheduled events, and an FPS display.\n\n## Installation\n\nTo use this library, you'll need to have [Pygame](https://www.pygame.org/) installed. You can install it using pip:\n\n```\npip install pygame\n```\n\nOnce Pygame is installed, you can include the `core.py` file in your project, and you're ready to start using the Pygame Core Library.\n\n## Usage\n\nTo get started with the Pygame Core Library, follow these steps:\n\n1. Import the library into your project:\n\n```python\nimport pygame_core\n```\n\n2. Create a class that extends `Core` class to set up your game:\n\n```python\nclass MyClass(pygame_core.Core):\n\n    def __init__(self, **kwargs):\n        super()._init__(**kargs)\n\ngame = MyClass(size=(800, 600))\n```\n\n3. Implement your game logic by overriding the `update` and `draw` methods in your `Core` instance:\n\n```python\ndef update(self):\n    # Your game logic here\n    pass\n\ndef draw(self):\n    # Your rendering code here\n    pass\n```\n\n4. Run your game by calling the `run` method on your `Core` instance:\n\n```python\ngame.run()\n```\n\n5. You can schedule repeating or one-time events using the `set_interval` and `set_timeout` methods:\n\n```python\n# Schedule a function to run every 1000 milliseconds (1 second)\ngame.set_interval(1000, my_function)\n\n# Schedule a one-time event to run after 2000 milliseconds (2 seconds)\ngame.set_timeout(2000, another_function)\n```\n\n6. Customize the FPS display and other settings by passing appropriate arguments when creating your `Core` instance.\n\n7. Don't forget to handle Pygame events by overriding the `check_event` method in your `Core` instance for custom event handling.\n\n8. Add any necessary cleanup or exit code in the `__exit__` method of your `Core` instance.\n\n## Contributing\n\nFeel free to contribute to the Pygame Core Library by submitting issues, feature requests, or pull requests on the [GitHub repository](https://github.com/viniputtim/pg-core).\n\n## License\n\nThis library is released under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n## Acknowledgments\n\n- Pygame (https://www.pygame.org/) for the underlying game development framework.\n\nHappy game development with Pygame Core Library! If you have any questions or need assistance, don't hesitate to reach out.\n\n\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "Simple Core class for pygame",
    "version": "1.0",
    "project_urls": null,
    "split_keywords": [
        "pygame"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "114c58067d61ee4d240c167595388d5508621fcfef8db9e86b405bbd77f85443",
                "md5": "d91ea182a33dc2ab4ab26d905bc9a219",
                "sha256": "b3e2767e08707f88aac017f319ecf728c5855a9c677edc04e599e0dc93731488"
            },
            "downloads": -1,
            "filename": "pg_core-1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d91ea182a33dc2ab4ab26d905bc9a219",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5771,
            "upload_time": "2023-10-11T19:14:15",
            "upload_time_iso_8601": "2023-10-11T19:14:15.228239Z",
            "url": "https://files.pythonhosted.org/packages/11/4c/58067d61ee4d240c167595388d5508621fcfef8db9e86b405bbd77f85443/pg_core-1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-11 19:14:15",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pg-core"
}
        
Elapsed time: 0.12960s