Skip to content

Commit 7394f79

Browse files
add some legacy #defines
1 parent 3ffa4cc commit 7394f79

File tree

5 files changed

+30
-28
lines changed

5 files changed

+30
-28
lines changed

pyray/__init__.py

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1414

1515
from raylib import rl, ffi
16+
from raylib.colors import *
17+
from raylib.defines import *
18+
1619

1720
from inspect import ismethod,getmembers,isbuiltin
1821
import inflection
@@ -24,32 +27,7 @@
2427
def pointer(self, struct):
2528
return ffi.addressof(struct)
2629

27-
LIGHTGRAY =( 200, 200, 200, 255 )
28-
GRAY =( 130, 130, 130, 255 )
29-
DARKGRAY =( 80, 80, 80, 255 )
30-
YELLOW =( 253, 249, 0, 255 )
31-
GOLD =( 255, 203, 0, 255 )
32-
ORANGE =( 255, 161, 0, 255 )
33-
PINK =( 255, 109, 194, 255 )
34-
RED =( 230, 41, 55, 255 )
35-
MAROON =( 190, 33, 55, 255 )
36-
GREEN =( 0, 228, 48, 255 )
37-
LIME =( 0, 158, 47, 255 )
38-
DARKGREEN =( 0, 117, 44, 255 )
39-
SKYBLUE =( 102, 191, 255, 255 )
40-
BLUE =( 0, 121, 241, 255 )
41-
DARKBLUE =( 0, 82, 172, 255 )
42-
PURPLE =( 200, 122, 255, 255 )
43-
VIOLET =( 135, 60, 190, 255 )
44-
DARKPURPLE =( 112, 31, 126, 255 )
45-
BEIGE =( 211, 176, 131, 255 )
46-
BROWN =( 127, 106, 79, 255 )
47-
DARKBROWN =( 76, 63, 47, 255 )
48-
WHITE =( 255, 255, 255, 255 )
49-
BLACK =( 0, 0, 0, 255 )
50-
BLANK =( 0, 0, 0, 0 )
51-
MAGENTA =( 255, 0, 255, 255 )
52-
RAYWHITE =( 245, 245, 245, 255 )
30+
5331

5432

5533
# I'm concerned that we are doing a lot of string comparisons on every function call to detect types.

raylib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
from ._raylib_cffi import ffi, lib as rl
1616
from raylib._raylib_cffi.lib import *
1717
from raylib.colors import *
18+
from raylib.defines import *
1819
import cffi
1920
import sys
20-
#from raylib.pyray import PyRay
2121
from .version import __version__
2222

2323
print("RAYLIB STATIC "+__version__+" LOADED", file=sys.stderr)

raylib/colors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@
3737
BLACK =( 0, 0, 0, 255 )
3838
BLANK =( 0, 0, 0, 0 )
3939
MAGENTA =( 255, 0, 255, 255 )
40-
RAYWHITE =( 245, 245, 245, 255 )
40+
RAYWHITE =( 245, 245, 245, 255 )
41+

raylib/defines.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import raylib
2+
3+
MOUSE_LEFT_BUTTON = raylib.MOUSE_BUTTON_LEFT
4+
MOUSE_RIGHT_BUTTON = raylib.MOUSE_BUTTON_RIGHT
5+
MOUSE_MIDDLE_BUTTON = raylib.MOUSE_BUTTON_MIDDLE
6+
MATERIAL_MAP_DIFFUSE = raylib.MATERIAL_MAP_ALBEDO
7+
MATERIAL_MAP_SPECULAR = raylib.MATERIAL_MAP_METALNESS
8+
SHADER_LOC_MAP_DIFFUSE = raylib.SHADER_LOC_MAP_ALBEDO
9+
SHADER_LOC_MAP_SPECULAR = raylib.SHADER_LOC_MAP_METALNESS

tests/test_defines.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
This shows how to use the Pyray wrapper around the static binding.
3+
"""
4+
5+
import pyray as pr
6+
7+
print(pr.WHITE)
8+
print(pr.MOUSE_BUTTON_LEFT)
9+
print(pr.MOUSE_LEFT_BUTTON )
10+
print(pr.MATERIAL_MAP_SPECULAR)
11+
12+
import raylib as rl
13+
14+
print(rl.MATERIAL_MAP_DIFFUSE)

0 commit comments

Comments
 (0)