Compare commits
No commits in common. "4775b5993627211ad5bb926410262aa80ff89b32" and "43882f4fef74a38fb9119bfdd9624b32dfb0f36e" have entirely different histories.
4775b59936
...
43882f4fef
@ -1,30 +0,0 @@
|
|||||||
name: Build Simulation and Test
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
tests:
|
|
||||||
name: Run All Tests
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install uv
|
|
||||||
uses: astral-sh/setup-uv@v5
|
|
||||||
with:
|
|
||||||
enable-cache: true
|
|
||||||
cache-dependency-glob: "uv.lock"
|
|
||||||
|
|
||||||
- name: "Set up Python"
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version-file: "pyproject.toml"
|
|
||||||
|
|
||||||
- name: Install the project
|
|
||||||
run: uv sync --locked --all-extras --dev
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: uv run pytest tests.py --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
|
|
||||||
44
main.py
44
main.py
@ -141,36 +141,22 @@ def draw_grid(screen, camera, showing_grid=True):
|
|||||||
|
|
||||||
# Draw vertical grid lines (only if zoom is high enough to see them clearly)
|
# Draw vertical grid lines (only if zoom is high enough to see them clearly)
|
||||||
if effective_cell_size > 4:
|
if effective_cell_size > 4:
|
||||||
# Precompute grid boundaries
|
for i in range(GRID_WIDTH + 1):
|
||||||
vertical_lines = []
|
line_x = grid_left + i * effective_cell_size
|
||||||
horizontal_lines = []
|
if 0 <= line_x <= SCREEN_WIDTH:
|
||||||
|
start_y = max(0, grid_top)
|
||||||
|
end_y = min(SCREEN_HEIGHT, grid_bottom)
|
||||||
|
if start_y < end_y:
|
||||||
|
pygame.draw.line(screen, GRAY, (line_x, start_y), (line_x, end_y))
|
||||||
|
|
||||||
for i in range(max(GRID_WIDTH, GRID_HEIGHT) + 1):
|
# Draw horizontal grid lines
|
||||||
# Vertical lines
|
for i in range(GRID_HEIGHT + 1):
|
||||||
if i <= GRID_WIDTH:
|
line_y = grid_top + i * effective_cell_size
|
||||||
line_x = grid_left + i * effective_cell_size
|
if 0 <= line_y <= SCREEN_HEIGHT:
|
||||||
if 0 <= line_x <= SCREEN_WIDTH:
|
start_x = max(0, grid_left)
|
||||||
start_y = max(0, grid_top)
|
end_x = min(SCREEN_WIDTH, grid_right)
|
||||||
end_y = min(SCREEN_HEIGHT, grid_bottom)
|
if start_x < end_x:
|
||||||
if start_y < end_y:
|
pygame.draw.line(screen, GRAY, (start_x, line_y), (end_x, line_y))
|
||||||
vertical_lines.append(((line_x, start_y), (line_x, end_y)))
|
|
||||||
|
|
||||||
# Horizontal lines
|
|
||||||
if i <= GRID_HEIGHT:
|
|
||||||
line_y = grid_top + i * effective_cell_size
|
|
||||||
if 0 <= line_y <= SCREEN_HEIGHT:
|
|
||||||
start_x = max(0, grid_left)
|
|
||||||
end_x = min(SCREEN_WIDTH, grid_right)
|
|
||||||
if start_x < end_x:
|
|
||||||
horizontal_lines.append(((start_x, line_y), (end_x, line_y)))
|
|
||||||
|
|
||||||
# Draw all vertical lines in one batch
|
|
||||||
for start, end in vertical_lines:
|
|
||||||
pygame.draw.line(screen, GRAY, start, end)
|
|
||||||
|
|
||||||
# Draw all horizontal lines in one batch
|
|
||||||
for start, end in horizontal_lines:
|
|
||||||
pygame.draw.line(screen, GRAY, start, end)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@ -5,5 +5,4 @@ description = "Add your description here"
|
|||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pygame>=2.6.1",
|
"pygame>=2.6.1",
|
||||||
"pytest>=8.3.5",
|
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user