1. Dashboard
  2. Getting Started
  3. GitHub
  4. API
  5. Articles
  6. Level Editor
  7. Members
    1. Recent Activity
    2. Users Online
    3. Staff
    4. Search Members
  8. Forum
  9. Discord
  • Login
  • Register
  • Search
Everywhere
  • Everywhere
  • Articles
  • Pages
  • Forum
  • More Options
  1. GFX-Engine
  2. Members
  3. Andy

Posts by Andy

  • Linux: libbulletc.so for BulletSharp

    • Andy
    • August 10, 2026 at 6:13 PM

    For using GFX / LibGFX on Linux, the native BulletSharp library libbulletc.so is required for the physics system.

    Since the required Linux binary is currently not included directly in the NuGet package, I built it myself from BulletSharpPInvoke and Bullet3 for Linux x64.

    Download

    libbulletc.so – Linux x64

    Quote

    libbulletc.zip

    Installation

    Place the library next to your application executable:

    Code
    bin/
    └── Debug/
        └── net8.0/
            ├── MyGame
            ├── libbulletc.so
            └── ...

    For a published/release build, place it next to the generated executable:

    Code
    MyGame/
    ├── MyGame
    ├── libbulletc.so
    └── ...

    BulletSharp should then be able to load the native library automatically.

    Build Information

    The library was built on Linux x64 using:

    • BulletSharpPInvoke
    • Bullet3
    • CMake
    • GCC

    Source projects:

    • BulletSharpPInvoke: https://github.com/AndresTraks/BulletSharpPInvoke
    • Bullet3: https://github.com/bulletphysics/bullet3

    The binary was built locally from the publicly available source code of the projects above and is intended for use with the Linux version of GFX/LibGFX.

    Platform

    This binary is specifically built for:

    Linux x64

    Other platforms require their respective native Bullet libraries.

    License

    Please retain and respect the applicable license and copyright notices of the projects used to build this binary.

  • Example Game Class – The Heart of Every GFX Game

    • Andy
    • December 25, 2025 at 6:08 PM

    Hi GFX Developers! 👋

    Here’s an example of a base game class using the GFX Engine. This is essentially the heart of every GFX game, showing how to:

    • Initialize a scene and camera
    • Add a player sprite with animations
    • Set up 2D physics
    • Update and render the game

    Feel free to use this as a starting point for your own projects.

    C#
    using DarkestMine.Behaviors;
    using LibGFX.Core;
    using LibGFX.Core.GameElements;
    using LibGFX.Graphics;
    using LibGFX.Graphics.Animation2D;
    using LibGFX.Graphics.Materials;
    using LibGFX.Graphics.Renderer.OpenGL;
    using LibGFX.Physics;
    using LibGFX.Physics.Behaviors2D;
    using OpenTK.Mathematics;
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace DarkestMine
    {
        // Base game class
        internal class MyGame : Game
        {
            private Scene2D _scene;
            private Sprite _player;
            private OrthographicCamera _camera;
            private PhysicsHandler2D _physicsHandler;
    
            // Initialize game components
            public override void Initialize()
            {
                _camera = new OrthographicCamera(new Vector2(0.0f, 0.0f), new Vector2(1280, 720));
                _camera.SetAsCurrent();
    
                _physicsHandler = new PhysicsHandler2D(new Vector2(0.0f, 0.0f));
    
                _scene = new Scene2D("BASE_LAYER", "PROJECTILES", "ENEMYS", "PLAYER", "PICKUPS");
                _scene.PhysicsHandler = _physicsHandler;
    
                var playerRunMaterial = AssetManager.Load<SpriteMaterial>("Assets/Sprites/Player/PlayerRun.png");
                var playerIdleMaterial = AssetManager.Load<SpriteMaterial>("Assets/Sprites/Player/PlayerIdle.png");
                
                _player = new Sprite("Player", new Vector2(0.0f, 0.0f), new Vector2(128, 128), playerRunMaterial);
                _player.UVTransform = playerRunMaterial.Texture.GetSafeUVTransform(0, 0, 64, 64);
                _player.Shader = RenderDevice.GetShaderProgram("SpriteShader");
                _player.AddAnimation(new Animation2D("Walk", 64, 64, 0, 0, 5, 10, playerRunMaterial));
                _player.AddAnimation(new Animation2D("Idle", 64, 64, 0, 0, 3, 3, playerIdleMaterial));
                
                var ridibody = _player.AddBehavior<CapsuleRigidBody>(new CapsuleRigidBody(_physicsHandler));
                ridibody.CreateRigidBody(5.0f, 0.5f, 0.25f);
                _player.AddBehavior<PlayerBhv>(new PlayerBhv());
                _player.PlayAnimation("Walk");
                _scene.AddGameElement("PLAYER", _player);
            }
    
            // Load game content
            public override void LoadContent()
            {
                AssetManager.ForeachAsset<SpriteMaterial>(material =>
                {
                    Debug.WriteLine($"Initializing Material");
                    material.Init(this.RenderDevice);
                });
                _scene.Init(Viewport, RenderDevice);
            }
    
            // Update game logic
            public override void Update(float deltaTime)
            {
                _scene.UpdatePhysics(deltaTime);
                _scene.Update(deltaTime);
            }
    
            // Render game content
            public override void Render()
            {
                _scene.Render(Viewport, RenderDevice, _camera);
                RenderDevice.DrawRenderTarget(_scene.RenderTarget as RenderTarget2D, 0);
            }
    
            // Dispose resources
            public override void Dispose()
            {
                AssetManager.ForeachAsset<SpriteMaterial>(material =>
                {
                    material.Dispose(RenderDevice);
                });
            }
        }
    }
    Display More

    Key Takeaways:

    • _scene manages all game elements and layers
    • _player demonstrates sprites, animations, and physics behaviors
    • Initialize(), LoadContent(), Update(), and Render() are the core lifecycle methods of any GFX game
    • This structure makes it easy to add more game elements or systems

    💡 Tip: Use this as a template for every new GFX project. Modify the layers, assets, and behaviors to fit your game.

Partner & Supporter

  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™