tests/docs/: - API_FINDINGS.md: Comprehensive migration guide from deprecated to modern API - test_*.py: 9 executable tests verifying actual runtime behavior - screenshots/: Visual verification of working examples tests/conftest.py: - Add 'docs' and 'demo' to pytest collection paths Key findings documented: - Entity uses grid_pos= not pos= - Scene API: Scene() + activate() replaces createScene/setScene - scene.children replaces sceneUI() - scene.on_key replaces keypressScene() - mcrfpy.current_scene (property) replaces currentScene() (function) - Timer callback signature: (timer, runtime) - Opacity animation does NOT work on Frame (documented bug) 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
30 lines
839 B
Python
30 lines
839 B
Python
#!/usr/bin/env python3
|
|
"""Quick test to verify Entity constructor signature."""
|
|
import mcrfpy
|
|
import sys
|
|
|
|
scene = mcrfpy.Scene("test")
|
|
scene.activate()
|
|
mcrfpy.step(0.01)
|
|
|
|
texture = mcrfpy.Texture("assets/kenney_tinydungeon.png", 16, 16)
|
|
grid = mcrfpy.Grid(grid_size=(20, 15), texture=texture, pos=(10, 10), size=(640, 480))
|
|
scene.children.append(grid)
|
|
|
|
# Test grid_pos vs grid_x/grid_y
|
|
try:
|
|
e1 = mcrfpy.Entity(grid_pos=(5, 5), texture=texture, sprite_index=85)
|
|
grid.entities.append(e1)
|
|
print("grid_pos= WORKS")
|
|
except TypeError as e:
|
|
print(f"grid_pos= FAILS: {e}")
|
|
|
|
try:
|
|
e2 = mcrfpy.Entity(grid_x=7, grid_y=7, texture=texture, sprite_index=85)
|
|
grid.entities.append(e2)
|
|
print("grid_x=/grid_y= WORKS")
|
|
except TypeError as e:
|
|
print(f"grid_x=/grid_y= FAILS: {e}")
|
|
|
|
print("Entity API test complete")
|
|
sys.exit(0)
|