Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of cleanups #2779

Merged
merged 2 commits into from Oct 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 1 addition & 26 deletions docs/reST/ref/examples.rst
Expand Up @@ -71,19 +71,6 @@ pygame much earlier.

.. ## pygame.examples.aliens.main ##

.. function:: oldalien.main

| :sl:`play the original aliens example`
| :sg:`oldalien.main() -> None`

This more closely resembles a port of the ``SDL`` Aliens demo. The code is a
lot simpler, so it makes a better starting point for people looking at code
for the first times. These blitting routines are not as optimized as they
should/could be, but the code is easier to follow, and it plays quick
enough.

.. ## pygame.examples.oldalien.main ##

.. function:: stars.main

| :sl:`run a simple starfield example`
Expand Down Expand Up @@ -333,21 +320,9 @@ pygame much earlier.

.. ## pygame.examples.fastevents.main ##

.. function:: overlay.main

| :sl:`play a .pgm video using overlays`
| :sg:`overlay.main(fname) -> None`

Play the .pgm video file given by a path fname.

If run as a program ``overlay.py`` takes the file name as a command line
argument.

.. ## pygame.examples.overlay.main ##

.. function:: joystick.main

| :sl:`access the clipboard`
| :sl:`demonstrate joystick functionality`
| :sg:`joystick.main() -> None`

A demo showing full joystick support.
Expand Down
4 changes: 2 additions & 2 deletions docs/reST/tut/ChimpLineByLine.rst
Expand Up @@ -180,7 +180,7 @@ them one at a time here. ::

def __init__(self):
pg.sprite.Sprite.__init__(self) # call Sprite initializer
self.image, self.rect = load_image("fist.bmp", -1)
self.image, self.rect = load_image("fist.png", -1)
self.fist_offset = (-235, -80)
self.punching = False

Expand Down Expand Up @@ -230,7 +230,7 @@ is colliding with the given target sprite. ::

def __init__(self):
pg.sprite.Sprite.__init__(self) # call Sprite intializer
self.image, self.rect = load_image("chimp.bmp", -1, 4)
self.image, self.rect = load_image("chimp.png", -1, 4)
screen = pg.display.get_surface()
self.area = screen.get_rect()
self.rect.topleft = 10, 90
Expand Down
2 changes: 1 addition & 1 deletion examples/blit_blends.py
Expand Up @@ -51,7 +51,7 @@ def main():

images = {}
images[pg.K_1] = im2
images[pg.K_2] = pg.image.load(os.path.join(data_dir, "chimp.bmp"))
images[pg.K_2] = pg.image.load(os.path.join(data_dir, "chimp.png"))
images[pg.K_3] = pg.image.load(os.path.join(data_dir, "alien3.gif"))
images[pg.K_4] = pg.image.load(os.path.join(data_dir, "liquid.bmp"))
img_to_blit = im2.convert()
Expand Down
4 changes: 2 additions & 2 deletions examples/chimp.py
Expand Up @@ -58,7 +58,7 @@ class Fist(pg.sprite.Sprite):

def __init__(self):
pg.sprite.Sprite.__init__(self) # call Sprite initializer
self.image, self.rect = load_image("fist.bmp", -1)
self.image, self.rect = load_image("fist.png", -1)
self.fist_offset = (-235, -80)
self.punching = False

Expand Down Expand Up @@ -88,7 +88,7 @@ class Chimp(pg.sprite.Sprite):

def __init__(self):
pg.sprite.Sprite.__init__(self) # call Sprite intializer
self.image, self.rect = load_image("chimp.bmp", -1, 4)
self.image, self.rect = load_image("chimp.png", -1, 4)
screen = pg.display.get_surface()
self.area = screen.get_rect()
self.rect.topleft = 10, 90
Expand Down
Binary file removed examples/data/chimp.bmp
Binary file not shown.
Binary file added examples/data/chimp.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed examples/data/fist.bmp
Binary file not shown.
Binary file added examples/data/fist.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed examples/data/oldplayer.gif
Binary file not shown.
Binary file modified examples/data/turquoise.tif
Binary file not shown.
6 changes: 0 additions & 6 deletions examples/data/yuv_1.pgm

This file was deleted.

4 changes: 1 addition & 3 deletions examples/mask.py
Expand Up @@ -135,8 +135,6 @@ def main(*args):
print("Press any key to quit")
pg.init()
screen = pg.display.set_mode((640, 480))
if any("fist.bmp" in x for x in args):
pg.display.set_caption("Punch Nazis")
images = []
masks = []
for impath in args:
Expand Down Expand Up @@ -206,7 +204,7 @@ def main(*args):
print("Let many copies of IMAGE(s) bounce against each other")
print("Press any key to quit")
main_dir = os.path.split(os.path.abspath(__file__))[0]
imagename = os.path.join(main_dir, "data", "fist.bmp")
imagename = os.path.join(main_dir, "data", "chimp.png")
main(imagename)

else:
Expand Down
68 changes: 0 additions & 68 deletions examples/overlay.py

This file was deleted.

13 changes: 4 additions & 9 deletions src_c/doc/examples_doc.h
@@ -1,7 +1,6 @@
/* Auto generated file: with makeref.py . Docs go in docs/reST/ref/ . */
#define DOC_PYGAMEEXAMPLES "module of example programs"
#define DOC_PYGAMEEXAMPLESALIENSMAIN "aliens.main() -> None\nplay the full aliens example"
#define DOC_PYGAMEEXAMPLESOLDALIENMAIN "oldalien.main() -> None\nplay the original aliens example"
#define DOC_PYGAMEEXAMPLESSTARSMAIN "stars.main() -> None\nrun a simple starfield example"
#define DOC_PYGAMEEXAMPLESCHIMPMAIN "chimp.main() -> None\nhit the moving chimp"
#define DOC_PYGAMEEXAMPLESMOVEITMAIN "moveit.main() -> None\ndisplay animated objects on the screen"
Expand All @@ -19,7 +18,7 @@
#define DOC_PYGAMEEXAMPLESTESTSPRITEMAIN "testsprite.main(update_rects = True, use_static = False, use_FastRenderGroup = False, screen_dims = [640, 480], use_alpha = False, flags = 0) -> None\nshow lots of sprites moving around"
#define DOC_PYGAMEEXAMPLESHEADLESSNOWINDOWSNEEDEDMAIN "headless_no_windows_needed.main(fin, fout, w, h) -> None\nwrite an image file that is smoothscaled copy of an input file"
#define DOC_PYGAMEEXAMPLESFASTEVENTSMAIN "fastevents.main() -> None\nstress test the fastevents module"
#define DOC_PYGAMEEXAMPLESOVERLAYMAIN "overlay.main(fname) -> None\nplay a .pgm video using overlays"
#define DOC_PYGAMEEXAMPLESJOYSTICKMAIN "joystick.main() -> None\ndemonstrate joystick functionality"
#define DOC_PYGAMEEXAMPLESBLENDFILLMAIN "blend_fill.main() -> None\ndemonstrate the various surface.fill method blend options"
#define DOC_PYGAMEEXAMPLESBLITBLENDSMAIN "blit_blends.main() -> None\nuses alternative additive fill to that of surface.fill"
#define DOC_PYGAMEEXAMPLESCURSORSMAIN "cursors.main() -> None\ndisplay two different custom cursors"
Expand All @@ -42,10 +41,6 @@ pygame.examples.aliens.main
aliens.main() -> None
play the full aliens example

pygame.examples.oldalien.main
oldalien.main() -> None
play the original aliens example

pygame.examples.stars.main
stars.main() -> None
run a simple starfield example
Expand Down Expand Up @@ -114,9 +109,9 @@ pygame.examples.fastevents.main
fastevents.main() -> None
stress test the fastevents module

pygame.examples.overlay.main
overlay.main(fname) -> None
play a .pgm video using overlays
pygame.examples.joystick.main
joystick.main() -> None
demonstrate joystick functionality

pygame.examples.blend_fill.main
blend_fill.main() -> None
Expand Down
4 changes: 2 additions & 2 deletions src_c/surface.c
Expand Up @@ -615,13 +615,13 @@ surface_init(pgSurfaceObject *self, PyObject *args, PyObject *kwds)
if ((!pg_IntFromObjIndex(size, 0, &width)) ||
(!pg_IntFromObjIndex(size, 1, &height))) {
PyErr_SetString(PyExc_ValueError,
"size needs to be (int width, int height)");
"size needs to be (number width, number height)");
return -1;
}
}
else {
PyErr_SetString(PyExc_ValueError,
"size needs to be (int width, int height)");
"size needs to be (number width, number height)");
return -1;
}

Expand Down
30 changes: 0 additions & 30 deletions src_py/_dummybackend.py

This file was deleted.

2 changes: 0 additions & 2 deletions test/overlay_tags.py

This file was deleted.

37 changes: 0 additions & 37 deletions test/overlay_test.py

This file was deleted.

4 changes: 2 additions & 2 deletions test/transform_test.py
Expand Up @@ -1253,7 +1253,7 @@ def tearDown(self):
def test_flip(self):
""" honors the set_color key on the returned surface from flip.
"""
image_loaded = pygame.image.load(example_path("data/chimp.bmp"))
image_loaded = pygame.image.load(example_path("data/chimp.png"))

image = pygame.Surface(image_loaded.get_size(), 0, 32)
image.blit(image_loaded, (0, 0))
Expand Down Expand Up @@ -1298,7 +1298,7 @@ def test_flip(self):
def test_flip_alpha(self):
""" returns a surface with the same properties as the input.
"""
image_loaded = pygame.image.load(example_path("data/chimp.bmp"))
image_loaded = pygame.image.load(example_path("data/chimp.png"))

image_alpha = pygame.Surface(image_loaded.get_size(), pygame.SRCALPHA, 32)
image_alpha.blit(image_loaded, (0, 0))
Expand Down