Commits

Anonymous committed 5ad2cb3

Moved example images to resources.

Comments (0)

Files changed (14)

examples/__init__.py

 _filepath = os.path.abspath (__file__)
 RESOURCEDIR = os.path.join (os.path.dirname (_filepath), "resources")
 FONTDIR = os.path.join (os.path.dirname (_filepath), "resources")
+IMAGEDIR = os.path.join (os.path.dirname (_filepath), "resources")

examples/resources/array.bmp

Added
New image

examples/resources/font.bmp

Added
New image

examples/resources/logo.bmp

Added
New image

examples/resources/logo.gif

Added
New image

examples/sdl/font.bmp

Removed
Old image

examples/sdl/hello_world.py

 import sys, os
 import pygame2
+import pygame2.examples
 try:
     import pygame2.sdl.constants as constants
     import pygame2.sdl.event as event
 def run():
     video.init ()
 
-    imgdir = os.path.dirname (os.path.abspath (__file__))
     surface = None
     if hassdlimage:
-        surface = image.load (os.path.join (imgdir, "logo.gif"))
+        surface = image.load (os.path.join
+                              (pygame2.examples.IMAGEDIR, "logo.gif"))
     else:
-        surface = image.load_bmp (os.path.join (imgdir, "logo.bmp"))
+        surface = image.load_bmp (os.path.join
+                                  (pygame2.examples.IMAGEDIR, "logo.bmp"))
 
     screen = video.set_mode (surface.w + 10, surface.h + 10)
     screen.fill (pygame2.Color (255, 255, 255))

examples/sdl/keyboard.py

 import sys, os
 import pygame2
-
+import pygame2.examples
 try:
     import pygame2.sdl.constants as sdlconst
     import pygame2.sdl.event as event
 
     video.init ()
 
-    imgdir = os.path.dirname (os.path.abspath (__file__))
-    imgfont = image.load_bmp (os.path.join (imgdir, "font.bmp"))
+    imgfont = image.load_bmp (os.path.join
+                              (pygame2.examples.IMAGEDIR, "font.bmp"))
     bmpfont = BitmapFont (imgfont, (32, 32), fontmap)
     
     screen = video.set_mode (640, 480)

examples/sdl/logo.bmp

Removed
Old image

examples/sdl/logo.gif

Removed
Old image

examples/sdl/surface_blit.py

 import os, sys
 import pygame2
+import pygame2.examples
 try:
     import pygame2.sdl.constants as sdlconst
     import pygame2.sdl.event as event
     imgdir = os.path.dirname (os.path.abspath (__file__))
     logo = None
     if hassdlimage:
-        logo = image.load (os.path.join (imgdir, "logo.gif"))
+        logo = image.load (os.path.join (pygame2.examples.IMAGEDIR, "logo.gif"))
     else:
-        logo = image.load_bmp (os.path.join (imgdir, "logo.bmp"))
+        logo = image.load_bmp (os.path.join
+                               (pygame2.examples.IMAGEDIR, "logo.bmp"))
     
     screen.fill (color)
     screen.blit (logo, (-10, 140))

examples/sdl/surface_fill.py

 import sys, os
 import pygame2
+import pygame2.examples
 try:
     import pygame2.sdl.constants as sdlconst
     import pygame2.sdl.event as event
     
     screen = video.set_mode (760, 300, 32)
     imgdir = os.path.dirname (os.path.abspath (__file__))
-    surface = image.load_bmp (os.path.join (imgdir, "logo.bmp"))
+    surface = image.load_bmp (os.path.join
+                              (pygame2.examples.IMAGEDIR, "logo.bmp"))
     surface = surface.convert (flags=sdlconst.SRCALPHA)
     
     color = white

examples/sdlext/array.bmp

Removed
Old image

examples/sdlext/pixelarray.py

 import sys, os
 import pygame2
+import pygame2.examples
 try:
     import pygame2.sdl.constants as sdlconst
     import pygame2.sdl.event as event
     screen.fill (black)
     
     imgdir = os.path.dirname (os.path.abspath (__file__))
-    surface = image.load_bmp (os.path.join (imgdir, "array.bmp"))
+    surface = image.load_bmp (os.path.join
+                              (pygame2.examples.IMAGEDIR, "array.bmp"))
     surface = surface.convert (flags=sdlconst.SRCALPHA)
     screen.blit (surface)
     screen.flip ()