Skip to content

todo #1

@okzyrox

Description

@okzyrox

refactor

  • refactor creating window to only return the window object (not WindowPtr and EclipseWindow)
  • Attach renderer and former windowptr to the window object
  • reduce reliance on SDL2 types, use our own
  • reduce checking for == nil / != nil (when using SDL2 / return types), use Option[]
  • rename procs for GameEvent

Changes

  • Change the base class for everything to be GameObject (scenes, ui components, etc are now a GameObject)

    • GameObject stores components, a UID, and a name for the game object
  • GameObject have to be manually create(), and then added to a scene allowing for reusability and cloning; the "original" is never used. (think of it like Godot; you have objects but you can put an infinite amount of a single object in a Node, each holding their own values and running their own scripts: thats the structure I want to move towards)

  • change ComponentProc to be proc (o: GameObject) instead of proc (c: Component) for more versatility and use

  • [x ] Add object class SpriteObject class (of GameObject)

  • Remove old hardcoded movement code, move to game logic rather than engine

  • Add "Attribute" Class, attachable to game objects for adding more data to them, as an alternative to using variables

    • addAttribute(attName: string, attValue: T) Raises if attribute not found, or T is invalid
    • getAttribute(attName: string): Option[T] Returns either some() or none()
    • setAttribute(attName: string, newAttValue: T) Raises if attribute not found, or T is invalid
    • removeAttribute(attName: string): Raises if attribute not found
    • T can be: string, int, bool, Vector2; potentially more
  • New procs for GameObject:

    • destroy(o: GameObject) -- Removes the game object instance, and all associated components / attributes
  • Add GameEvents to GameObject:

    • onCreate -- run when the entity is created
    • onDraw -- run when drawn
    • onUpdate -- run during updating
    • onDestroy -- Before its destroyed, could in theory delay destruction
  • Make Once() return a different event connection type (GameEvent)

  • Add support for passing parameters through GameEvent.Fire()

  • Change InputKey and MouseKey Enums to follow Nim Style

    • also rename MouseKey to MouseButton
  • make InputManager handle polling of events, along with auto conversion and as such only requiring the manager to be updated

  • Add support for window flags (Window Flags: an optional seq of flag enums that gets converted into SDL2 window flags)

  • Game changes:

    • when initalising, add a GameEvent
    • add overrideable Game.init proc for adding initialisation for the game (think function love.load())
    • add overrideable Game.update proc for updating parts (love.update())
    • overrideable Game.draw proc for drawing

Removals (undecided if temp or perm)

  • Remove Deactivate() from GameEvent
  • Un-export sdl2

Temp removals:

  • Remove SceneUI
  • Revert to old UI code

Potential changes

  • Migrate to SDL3 (nsdl3 OR nim-sdl3)
    • Neither have support for SDL_ttf or SDL_image
    • nsdl3 has weird conventions
    • nim-sdl3 requires a ton of extra manual work (which, while it can be implemented into things like beginFrame/endFrame/close/run, is a lot more tedious)

OR:

  • Migrate systems to use OpenGL over SDL2
    • more modern, consistently updated
    • more work needed for "simple" things, but less SDL2-isms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions