update DLLs
This commit is contained in:
parent
f6f5b0836e
commit
d1dc703292
7 changed files with 61 additions and 25 deletions
|
@ -9,7 +9,9 @@
|
|||
# *
|
||||
# ********************************************************************************************/
|
||||
|
||||
from raylib.static import *
|
||||
from raylib.dynamic import ffi, raylib as rl
|
||||
from raylib.colors import *
|
||||
|
||||
MAX_BUNNIES = 500000
|
||||
|
||||
# This is the maximum amount of elements (quads) per batch
|
||||
|
@ -29,10 +31,10 @@ class Bunny:
|
|||
screenWidth = 1920;
|
||||
screenHeight = 1080;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, b"raylib [textures] example - bunnymark")
|
||||
rl.InitWindow(screenWidth, screenHeight, b"raylib [textures] example - bunnymark")
|
||||
|
||||
# // Load bunny texture
|
||||
texBunny = LoadTexture(b"resources/wabbit_alpha.png")
|
||||
texBunny = rl.LoadTexture(b"resources/wabbit_alpha.png")
|
||||
|
||||
bunnies = []
|
||||
for i in range(0, MAX_BUNNIES):
|
||||
|
@ -40,23 +42,23 @@ for i in range(0, MAX_BUNNIES):
|
|||
|
||||
bunniesCount = 0; # Bunnies counter
|
||||
|
||||
SetTargetFPS(60); # Set our game to run at 60 frames-per-second
|
||||
rl.SetTargetFPS(60); # Set our game to run at 60 frames-per-second
|
||||
#//--------------------------------------------------------------------------------------
|
||||
|
||||
#// Main game loop
|
||||
while not WindowShouldClose(): #// Detect window close button or ESC key
|
||||
while not rl.WindowShouldClose(): #// Detect window close button or ESC key
|
||||
#// Update
|
||||
#//----------------------------------------------------------------------------------
|
||||
if IsMouseButtonDown(MOUSE_LEFT_BUTTON):
|
||||
if rl.IsMouseButtonDown(rl.MOUSE_LEFT_BUTTON):
|
||||
#// Create more bunnies
|
||||
for i in range(0, 100):
|
||||
if bunniesCount < MAX_BUNNIES:
|
||||
bunnies[bunniesCount].position = GetMousePosition()
|
||||
bunnies[bunniesCount].speed.x = GetRandomValue(-250, 250)/60.0
|
||||
bunnies[bunniesCount].speed.y = GetRandomValue(-250, 250)/60.0
|
||||
bunnies[bunniesCount].color = (GetRandomValue(50, 240),
|
||||
GetRandomValue(80, 240),
|
||||
GetRandomValue(100, 240), 255 )
|
||||
bunnies[bunniesCount].position = rl.GetMousePosition()
|
||||
bunnies[bunniesCount].speed.x = rl.GetRandomValue(-250, 250)/60.0
|
||||
bunnies[bunniesCount].speed.y = rl.GetRandomValue(-250, 250)/60.0
|
||||
bunnies[bunniesCount].color = (rl.GetRandomValue(50, 240),
|
||||
rl.GetRandomValue(80, 240),
|
||||
rl.GetRandomValue(100, 240), 255 )
|
||||
|
||||
bunniesCount+=1
|
||||
|
||||
|
@ -66,18 +68,18 @@ while not WindowShouldClose(): #// Detect window close button or ESC key
|
|||
bunnies[i].position.x += bunnies[i].speed.x;
|
||||
bunnies[i].position.y += bunnies[i].speed.y;
|
||||
|
||||
if ((bunnies[i].position.x + texBunny.width/2) > GetScreenWidth()) or ((bunnies[i].position.x + texBunny.width/2) < 0):
|
||||
if ((bunnies[i].position.x + texBunny.width/2) > rl.GetScreenWidth()) or ((bunnies[i].position.x + texBunny.width/2) < 0):
|
||||
bunnies[i].speed.x *= -1
|
||||
if ((bunnies[i].position.y + texBunny.height/2) > GetScreenHeight()) or ((bunnies[i].position.y + texBunny.height/2 - 40) < 0):
|
||||
if ((bunnies[i].position.y + texBunny.height/2) > rl.GetScreenHeight()) or ((bunnies[i].position.y + texBunny.height/2 - 40) < 0):
|
||||
bunnies[i].speed.y *= -1
|
||||
|
||||
# //----------------------------------------------------------------------------------
|
||||
#
|
||||
# // Draw
|
||||
# //----------------------------------------------------------------------------------
|
||||
BeginDrawing()
|
||||
rl.BeginDrawing()
|
||||
|
||||
ClearBackground(RAYWHITE)
|
||||
rl.ClearBackground(RAYWHITE)
|
||||
|
||||
for i in range(0, bunniesCount):
|
||||
# // NOTE: When internal batch buffer limit is reached (MAX_BATCH_ELEMENTS),
|
||||
|
@ -86,17 +88,17 @@ while not WindowShouldClose(): #// Detect window close button or ESC key
|
|||
# // Process of sending data is costly and it could happen that GPU data has not been completely
|
||||
# // processed for drawing while new data is tried to be sent (updating current in-use buffers)
|
||||
# // it could generates a stall and consequently a frame drop, limiting the number of drawn bunnies
|
||||
DrawTexture(texBunny, int(bunnies[i].position.x), int(bunnies[i].position.y), bunnies[i].color)
|
||||
rl.DrawTexture(texBunny, int(bunnies[i].position.x), int(bunnies[i].position.y), bunnies[i].color)
|
||||
|
||||
DrawRectangle(0, 0, screenWidth, 40, BLACK)
|
||||
rl.DrawRectangle(0, 0, screenWidth, 40, BLACK)
|
||||
text = f"bunnies {bunniesCount}"
|
||||
DrawText(text.encode('utf-8'), 120, 10, 20, GREEN)
|
||||
rl.DrawText(text.encode('utf-8'), 120, 10, 20, GREEN)
|
||||
text = f"batched draw calls: { 1 + int(bunniesCount/MAX_BATCH_ELEMENTS)}"
|
||||
DrawText(text.encode('utf-8'), 320, 10, 20, MAROON)
|
||||
rl.DrawText(text.encode('utf-8'), 320, 10, 20, MAROON)
|
||||
|
||||
DrawFPS(10, 10)
|
||||
rl.DrawFPS(10, 10)
|
||||
|
||||
EndDrawing()
|
||||
rl.EndDrawing()
|
||||
#//----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
@ -104,8 +106,8 @@ while not WindowShouldClose(): #// Detect window close button or ESC key
|
|||
#//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
UnloadTexture(texBunny); #Unload bunny texture
|
||||
rl.UnloadTexture(texBunny); #Unload bunny texture
|
||||
|
||||
CloseWindow() # Close window and OpenGL context
|
||||
rl.CloseWindow() # Close window and OpenGL context
|
||||
#//--------------------------------------------------------------------------------------
|
||||
|
||||
|
|
BIN
raylib/dynamic/32bit/raylib.dll
Executable file → Normal file
BIN
raylib/dynamic/32bit/raylib.dll
Executable file → Normal file
Binary file not shown.
Binary file not shown.
|
@ -1 +0,0 @@
|
|||
libraylib.so.351
|
BIN
raylib/dynamic/libraylib.so
Normal file
BIN
raylib/dynamic/libraylib.so
Normal file
Binary file not shown.
0
raylib/dynamic/raylib.dll
Executable file → Normal file
0
raylib/dynamic/raylib.dll
Executable file → Normal file
2
setup.py
2
setup.py
|
@ -36,5 +36,5 @@ setup(
|
|||
include_package_data=True,
|
||||
install_requires=["cffi>=1.14.5","inflection"],
|
||||
distclass=BinaryDistribution,
|
||||
cffi_modules=["raylib/static/build.py:ffibuilder"], # this would build libs whenever the module is installed, but we are distributing static libs instead
|
||||
cffi_modules=["raylib/static/build.py:ffibuilder"]
|
||||
)
|
||||
|
|
34
setup_dynamic.py
Normal file
34
setup_dynamic.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
import pathlib
|
||||
from setuptools import setup
|
||||
from setuptools.dist import Distribution
|
||||
|
||||
# The directory containing this file
|
||||
HERE = pathlib.Path(__file__).parent
|
||||
|
||||
# The text of the README file
|
||||
README = (HERE / "README.md").read_text()
|
||||
|
||||
|
||||
# This call to setup() does all the work
|
||||
setup(
|
||||
name="raylib-dynamic",
|
||||
version="3.7.0.post1",
|
||||
description="Python CFFI bindings for Raylib",
|
||||
long_description=README,
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.com/electronstudio/raylib-python-cffi",
|
||||
author="Electron Studio",
|
||||
author_email="github@electronstudio.co.uk",
|
||||
license="LGPLv3+",
|
||||
classifiers=[
|
||||
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
],
|
||||
packages=["raylib", "raylib.dynamic"],
|
||||
include_package_data=True,
|
||||
install_requires=["cffi>=1.14.5","inflection"],
|
||||
)
|
Reference in a new issue