Skip to content

Api Reference

Lulezer edited this page Mar 30, 2025 · 1 revision

Function declarations

  • void MakeWindow(int width, int height, const char* title);
  • void CloseWindow();
  • int WindowShouldClose();
  • void StartDrawing();
  • void EndDrawing();
  • void ClearBackground(Color color);
  • void SetTargetFps(int targetFps);

Shape Rendering

  • void DrawTriangle(float x, float y, float width, float height, const Color& color);
  • void DrawRectangle(float x, float y, float width, float height, const Color& color);
  • void DrawProRectangle(float x, float y, float width, float height, const Color& color, float angle, - float transparency);
  • void DrawCircle(float centerX, float centerY, float radius, const Color& color, int segments = 36);
  • void DrawProCircle(float centerX, float centerY, float radius, const Color& color, int segments, -float transparency);
  • void DrawProTriangle(float x, float y, float width, float height, const Color& color, float transparency);
  • void DrawProTexturedRectangle(float x, float y, float width, float height, float rotation, float alpha, const std::string& name);

Input System

  • int IsKeyPressed(int key);

  • int IsKeyHeld(int key);

  • int IsMouseButtonPressed(int button);

  • int IsMouseButtonHeld(int button);

Texture Rendering

  • void LoadTexture(const char* filepath, const std::string& name);
  • void DrawTexturedRectangle(float x, float y, float width, float height, const std::string& name);

TEXT NOT DONE NOT WORKING

  • bool LoadFont(const char* fontFile, int fontSize, Font& outFont);
  • void DrawText(Font& font, const char* text, float x, float y, int fontSize, Color color);

TEXT NOT DONE NOT WORKING

Time Management

  • float GetDeltaTime();

Mouse Stuff

  • void GetMousePosition(double& x, double& y);

Collision

  • bool ech::CollisionShape::CheckCollision(const CollisionShape& other);

usage:

    CollisionShape rectShape{ 100.0f, 370.0f, 20.0f, 20.0f }; // Static obstacle
CollisionShape nextPlayerShapeX = { nextPlayerX, playerShape.y, PlayerCollWidth, PlayerCollHeight };
        if (!nextPlayerShapeX.CheckCollision(rectShape))
        {
            playerShape.x = nextPlayerX;
        }

File io

  • inline void savefile(const std::string& filename, const T& data);

  • inline void loadfile(const std::string& filename, T& data);

Yo

Clone this wiki locally