Skip to content

Opengame is a python library that encapsulates the complex API of pygame2 to help users build games faster.

License

Notifications You must be signed in to change notification settings

stripepython/opengame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenGame is a Python3 module that can help you build a game faster.
Document is writing, this is the dev version.

Favicon

Version: 1.1.2

New

1.1.2: Fixed bugs. 1.1.0beta: added command-line tool.
1.0.2beta: deleted opengame.utils.builtin.builtin module. 1.0.2alpha: passed the test on Windows 10 and Ubuntu.

Theory

OpenGame built on pygame2. Many features of pygame are retained.
Therefore, it has good compatibility with pygame.

Why do you use OpenGame?

Let's see an example, we'll show a label "Hello World" on the screen. And let it follow the mouse.

If we use opengame, we should:

import opengame as og
win = og.Window('Demo', (800, 600))
text = og.Label('Hello World')
text.pack()
@win.when_draw
def draw():
    text.pos = win.mouse.pos
win.show()

If we use pygame, we should:

import sys
import pygame as pg
pg.init()
pg.font.init()
screen = pg.display.set_mode((800, 600))
pg.display.set_caption('Demo')
font = pg.font.Font(None, 26)
while True:
    screen.fill((255, 255, 255))
    text = font.render('Hello World', True, (0, 0, 0))
    rect = text.get_rect()
    rect.x, rect.y = pg.mouse.get_pos()
    screen.blit(text, rect)
    for event in pg.event.get():
        if event == pg.QUIT:
            pg.quit()
            sys.exit()
    pg.display.update()

Really easy?

Although using pyglet and opengame is similar, opengame has other reason why you should use it.

Note: In large projects, you should still use other packages because opengame designed for small projects.

The Advantages

  1. Simple API, callback system;
  2. A perfect resource library;
  3. Great encapsulation, more functions;
  4. Lots of humanity design.

The Inferiority

  1. Instability;
  2. Not applicable to large projects.

Install

Use pip install it:

pip install -U opengame

Use git:

git clone https://github.com/stripepython/opengame/
cd opengame
pip install -r requirements.txt
python setup.py install

Where can I see OpenGame?

Document

See https://github.com/stripepython/opengame/ or /docs/index.md

About

Opengame is a python library that encapsulates the complex API of pygame2 to help users build games faster.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published