ViperEngine Documentation

ViperEngine is a minimalist 2D game framework built on SDL2 for fast, flexible development. It follows Pygame-like patterns but with a cleaner, lower-level interface.


🚀 Getting Started

Install with:

pip install ViperEngine

Requires Python 3.6+ and SDL2 installed on your system.


🧱 Quick Start

import viperengine as ve

ve.init()

screen = ve.Display().set_mode((640, 480))
screen.set_caption("Hello Viper")

clock = ve.Clock()
running = True

while running:
    screen.paint((0, 0, 0))
    for event in ve.poll_event() or []:
        if event["type"] == "QUIT":
            running = False
    screen.update()
    clock.tick(60)

ve.quit()
  

📚 API Overview


🎨 Drawing

screen.paint((255, 255, 255))
screen.draw_rect((255, 0, 0), (50, 50, 100, 100))
sprite = ve.Surface("player.png")
screen.blit(sprite, (200, 150))
screen.update()
  

⌨️ Event Handling

for event in ve.poll_event() or []:
    if event["type"] == "KEYDOWN":
        if event["key"] == "ESCAPE":
            running = False
  

⚙️ SDL2 Setup

Install SDL2 separately. On Linux/macOS: use your package manager. On Windows: include the DLLs with your project folder.

🔙 Back to Home