Imp 0.0.2-alpha

This is a prerelease version of Imp.
dotnet add package Imp --version 0.0.2-alpha
                    
NuGet\Install-Package Imp -Version 0.0.2-alpha
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Imp" Version="0.0.2-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Imp" Version="0.0.2-alpha" />
                    
Directory.Packages.props
<PackageReference Include="Imp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Imp --version 0.0.2-alpha
                    
#r "nuget: Imp, 0.0.2-alpha"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Imp&version=0.0.2-alpha&prerelease
                    
Install Imp as a Cake Addin
#tool nuget:?package=Imp&version=0.0.2-alpha&prerelease
                    
Install Imp as a Cake Tool

Imp

Imp is a lightweight, sprite-based rendering framework for F#, supporting both OpenGL (desktop) and WebGL (web). Inspired by Elmish and React Native, it provides a declarative way to build high-performance 2D applications with a functional architecture.

๐Ÿ”น Why "Imp"? The name comes from an Imp, a small mischievous creatureโ€”just similar to a sprite! Imp is designed to be a fast and lightweight sprite renderer for building graphical applications.

๐Ÿš€ Try the demo: davidtme.github.io/imp

Features

  • ๐ŸŽฎ Sprite-Based Rendering โ€“ Optimized for rendering 2D sprites efficiently.
  • ๐Ÿ— Elmish-Like Architecture โ€“ Write declarative UI code, similar to React Native in F#.
  • ๐Ÿ–ฅ Cross-Platform Support โ€“ OpenGL for desktop apps and WebGL for browser-based applications.
  • ๐ŸŽจ Declarative Scene Composition โ€“ Manage scenes and sprites with a structured, functional approach.
  • ๐Ÿš€ GPU-Accelerated Performance โ€“ Leverages OpenGL/WebGL for smooth, high-performance rendering.
  • ๐Ÿ“ฆ Web-Based & Local Asset Management โ€“ Load and manage textures, sprites, and other resources effortlessly.
  • ๐Ÿ’ก F#-First Development โ€“ Functional, type-safe, and expressive API.
  • ๐ŸŒ Fable Integration โ€“ Uses Fable to compile F# to JavaScript for seamless web development.

Example Usage

With Imp, you can quickly set up a WebGL scene:

module Client.SimpleWeb.App

// Import required modules for application setup and rendering
open Imp
open Imp.Setup

// Define the name of the texture to be used in the application
let texture = "f-sharp-logo"

// Initialize a data manager for handling web-based data operations
let dataManager = WebDataManager(baseUrl = ".")
// Register the texture name with the data manager
dataManager.AddTextureName(texture)

// Define a function to create the main view of the application
let sampleView () =
    // The view function serves as the root container for the scene
    view () {
        // The sceneRenderer sets up the rendering environment, including the background color
        sceneRenderer (backgroundColor = { R = 29; G = 41; B = 61 }) {
            // The singleRenderer renders individual sprites one at a time
            singleRenderer () { 
                // Define a sprite with its position, dimensions, and texture properties
                sprite (
                    x = 50, // Horizontal position of the sprite
                    y = 50, // Vertical position of the sprite
                    z = 0, // Depth position of the sprite
                    width = 255, // Width of the sprite in pixels
                    height = 255, // Height of the sprite in pixels
                    texture = texture, // Name of the texture to apply to the sprite
                    textureX = 0, // X-coordinate of the texture region to use
                    textureY = 0, // Y-coordinate of the texture region to use
                    textureWidth = 255, // Width of the texture region to use
                    textureHeight = 255 // Height of the texture region to use
                )
            }
        }
    }

// Create a WebGL display for rendering the application
let display = WebGLDisplay(elementId = "App", width = 800, height = 600) // Specify the HTML element and display dimensions
// Attach the data manager, the root view, and an optional per-frame callback to the display
display.AttachView dataManager (sampleView ()) None
// Start the rendering loop for the display
display.Run()

Getting Started

Clone the repository and explore the sample applications to see Imp in action!

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.2-alpha 369 17 days ago