Improve package structure and add proper setup.py
This commit is contained in:
1 parent
75a9cc5ba8
commit
0571392afe
5 files changed
+124
-10
No files matched your search
+30
-2
@@ -1,2 +1,30 @@
|
||||
# This file is intentionally empty.
|
||||
# It marks the src directory as a Python package.
|
||||
"""
|
||||
AI Snake Game - A classic snake game with AI capabilities.
|
||||
|
||||
This package contains all the core game components including:
|
||||
- Game engine and state management
|
||||
- Snake movement and collision detection
|
||||
- Food spawning system
|
||||
- Menu interface
|
||||
- AI controllers (coming soon)
|
||||
"""
|
||||
|
||||
from src.game import Game, GameState
|
||||
from src.snake import Snake, Direction
|
||||
from src.food import Food
|
||||
from src.menu import Menu, GameMode, MenuItem
|
||||
|
||||
__version__ = '0.1.0'
|
||||
__author__ = 'Rbanh'
|
||||
|
||||
# Define what's available when using "from src import *"
|
||||
__all__ = [
|
||||
'Game',
|
||||
'GameState',
|
||||
'Snake',
|
||||
'Direction',
|
||||
'Food',
|
||||
'Menu',
|
||||
'GameMode',
|
||||
'MenuItem'
|
||||
]
|
||||
+9
-3
@@ -1,9 +1,9 @@
|
||||
import pygame
|
||||
import sys
|
||||
from enum import Enum, auto
|
||||
from snake import Snake, Direction
|
||||
from food import Food
|
||||
from menu import Menu, GameMode
|
||||
from src.snake import Snake, Direction
|
||||
from src.food import Food
|
||||
from src.menu import Menu, GameMode
|
||||
|
||||
class GameState(Enum):
|
||||
MENU = auto()
|
||||
@@ -13,6 +13,12 @@ class GameState(Enum):
|
||||
|
||||
class Game:
|
||||
def __init__(self):
|
||||
# Initialize pygame and font system
|
||||
if not pygame.get_init():
|
||||
pygame.init()
|
||||
if not pygame.font.get_init():
|
||||
pygame.font.init()
|
||||
|
||||
# Initialize display
|
||||
self.width = 800
|
||||
self.height = 600
|
||||
|
||||
Reference in new issue
Block a user