Skip to content

Tutorials

Daynlight edited this page Dec 8, 2025 · 1 revision

Graphite Tutorials

๐Ÿšง Note: More tutorials (UI, 3D, advanced scripting) are planned! See Roadmap.md for future updates.

This page provides step-by-step tutorials for using Graphite, from basic setup to advanced scripting.


1. Getting Started

Installation

Follow the instructions in Instalation.md to set up Graphite on your system.

First Run

Run Graphite with:

Graphite -i ./

This initializes default files and prepares your workspace.


2. Writing Your First Script

Create or edit Graphite.cpp in your project directory:

#define BUILDING_SCRIPT_DLL
#include <Graphite/ScriptInterface.h>
#include <Graphite/Math.h>

class Script : ScriptInterface {
	void Init() {
		// Initialization code
	}
	void Update() {
		// Per-frame logic
	}
	void Draw() {
		// Drawing code
	}
	void Destroy() {
		// Cleanup
	}
};

extern "C" ScriptInterface* SCRIPT_API GetScript() {
	Script* script = new Script();
	return (ScriptInterface*)script;
}
extern "C" void SCRIPT_API DeleteScript(ScriptInterface* script) {
	Script* temp_script = (Script*)script;
	delete temp_script;
}

3. Visualizing Data

Use the math library to create and draw points:

Graphite::Math::Point p({0.5f, 0.5f}, {1.0f, 0.0f, 0.0f});
p.drawPoint();

4. Using Sandbox Mode

Run with the -s flag to enable sandbox mode for safer script editing:

Graphite -s ./

5. Creating Packages

See PackageManager.md for instructions on creating and sharing packages.


6. Advanced Topics

  • Custom math types
  • Real-time script editing
  • Integrating with CWindow
  • Performance optimization

Refer to the API Reference and Examples for more advanced usage.

Graphite Wiki Sidebar

Getting Started

References

Project & Versions

Community

Clone this wiki locally