Skip to content
Syndelis edited this page Sep 8, 2020 · 4 revisions

This wiki's objective is to cover everything about the Engine, from the very basics as your first App to the advanced memory management stuff. Currently this document refers to version 1.2, released in September 8th, 2020. If this is outdated, shame on me.

Getting Started

Beginners should expect to find materials from installation to writing their first programs here.

Installation

  • Windows Users

    Download the latest binaries available here and extract them to whatever folder your project exists on.

  • Linux Users

    Follow the compilation section on the README.

Understanding the modules

Before launching your IDE, it's interesting to summarize the 3 modules that make up the engine.

  • eel

    Contains everything window-related, such as:

    • Opening/closing window;
    • Keyboard/Mouse input;
    • Canvases;
  • figure

    The figure sub-module contains everything drawing-related, such as:

    • Basic figure (Rectangle, Circle, Triangle);
    • Sprites for loading images;
    • Text rendering;
  • shader

    The last sub-module, is exclusively dedicated for the handling of GLSL shaders. Interface-wise, it introduces a single class.

Your first program

First, let's learn to open a window

from eel import Eel

window = Eel(name="My neat app", width=640, height=480)
window.run() # This is a loop that handles the control to the window

print("The window is now closed")

Now to draw something to the window

from eel import Eel
from figure import Rectangle

window = Eel(name="My neat app")

# Note that the rectangle is created outside our `drawLoop` function
# This is because we don't want to create 60 rectangles each second
my_rect = Rectangle(20, 30, width=100, height=50, fill=True)

# This `at window.draw` is what's known as a decorator
# Long story short, any function preceeded by this decorator
# Will be executed by the engine whenever it redraws the screen
# About ~60 times each second
@window.draw
def drawLoop(eel):
    # This function's name is not really that important
    # The decorator is what makes this work
    my_rect.drawTo(eel)

window.run()

print("The window is now closed")

It's a simple example, but too static. Let's fix that

from eel import Eel
from figure import Rectangle

window = Eel(name="My neat app")
my_rect = Rectangle(20, 30, width=100, height=50, fill=True)

@window.draw
def drawLoop(eel):

    # This will set the position of our rectangle
    # You can, alternatively, set X and Y individually with
    # my_rect.x, my_rect.y = eel.mouse
    my_rect.pos = eel.mouse
    my_rect.drawTo(eel)

window.run()

print("The window is now closed")

And finally let's add some interactivity

from eel import Eel, mousePressed
from figure import Rectangle

window = Eel(name="My neat app")
my_rect = Rectangle(20, 30, width=100, height=50, fill=True)

@window.draw
def drawLoop(eel):

    if mousePressed(0):
        my_rect.setColor(200, 0, 0)

    else: my_rect.setColor(0, 200, 0)

    my_rect.pos = eel.mouse
    my_rect.drawTo(eel)

window.run()

print("The window is now closed")

And that covers the basic. If you understood the above, you should be able to understand the rest of the documentation and its examples. Good luck!

Advanced Techniques

Follow this link