https://github.com/toma400/nimfire
Nimfire is GUI/game framework built on top of gl*FB and GLFW. It serves for learning purposes, but may become something bigger someday.
https://github.com/toma400/nimfire
game-development game-library glfw nim nim-lang nim-library
Last synced: about 1 month ago
JSON representation
Nimfire is GUI/game framework built on top of gl*FB and GLFW. It serves for learning purposes, but may become something bigger someday.
- Host: GitHub
- URL: https://github.com/toma400/nimfire
- Owner: Toma400
- Created: 2023-08-31T07:14:27.000Z (over 1 year ago)
- Default Branch: fire
- Last Pushed: 2025-02-17T12:50:53.000Z (3 months ago)
- Last Synced: 2025-03-23T18:47:40.177Z (about 2 months ago)
- Topics: game-development, game-library, glfw, nim, nim-lang, nim-library
- Language: Nim
- Homepage:
- Size: 314 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: license
Awesome Lists containing this project
README

**Nimfire** (Nim Campfire) is small Nim GUI/game library inspired by PyGame and Nigui,
trying to be what I haven't found yet in Nim's gamedev ecosystem.
While it is mostly my learning project, I'd love to see it becoming something bigger
in the future - I will try to update is regularly, so it should not be abandoned
anytime soon.Nimfire aim is to:
- **empower control**
- you are given as much manual control as possible, including contents of main loop
(inspired by PyGame)
- **minimise abstractions**
- you are not forced into any OOP system and relations, there's no object that
you need inherit from or use to control your custom elements
- **have minimal amount of dependencies**
- one of huge issues with Nim gamelibs is their requirement to install and/or
compile many C libraries and other dependencies - Nimfire uses only static
Nim libraries which makes it work out of the box
- **be simple and user-friendly**
- no unnecessary verbosity of code, we are coding Nim after all
- well documented code, examples and possibility to learn from short examples
- being batteries-included in terms of having GUI elements, so you don't need to
write your own (it's totally possible though!)### Installation
To install the library, simply run such command in terminal:
```
nimble install https://github.com/Toma400/Nimfire
```### Usage
Initialising basic window is done using `initWindow` procedure. After that, you will
be able to control program loop and window closing:
```nim
import nimfirevar w = initWindow((800, 600), "Nimfire")
while w.tick():
w.update()w.finish()
```You can also draw on canvas easily:
```nim
import nimfire/colors
import nimfire/draw
import nimfirevar w = initWindow((800, 600), "Nimfire")
while w.tick():
w.drawRect((0, 0), (250, 250), PURPLE)
w.update()w.finish()
```
You can look at `examples/drawing` and `examples/rect_management` for more detailed
documentation on how you can use drawing with the library.Aside of drawing shapes, Nimfire allows you also to use PNG images, further explained
in `examples/images` file:
```nim
import nimfire/image
import nimfirevar w = initWindow((800, 600), "Nimfire")
var i = newImage("nimfire.png")while w.tick():
w.drawImage(i, (10, 10))
w.update()
w.finish()
```
And you can also handle user input:
```nim
import nimfire/input
import nimfirevar w = initWindow((800, 600), "Nimfire")
while w.tick():
if w.getKeyPressed(KEY.SPACE):
echo "Space just got used!"
w.update()
if w.getMousePressed(LEFT):
echo "Mouse coordinates are: " & w.getMousePos()
w.finish()
```
For more code examples, visit `examples` folder. You can also look at `examples/apps`
for tutorial apps done step by step to showcase more abstract use of Nimfire.
Additionally, module functions are slowly documented in [this](examples/functions.md)
Markdown file.---
### Features
Currently, this is Nimfire's scope:
- [x] Creating app and controlling window
- [x] Setting basic data (res, title)
- [x] Drawing shapes
- [x] Exporting shapes into graphical files
- [x] Input control `mostly`
- [x] Keyboard control
- [x] Getting keyboard key being pressed
- [x] Mouse control
- [x] Recognising mouse input
- [x] Getting mouse position on screen
- [ ] Saving user input as data (listening to sequence of keys)
- [x] Image management `simple`
- [x] Render image on screen
- [x] Save images
- [ ] JPG/SVG/BMP formats
- [ ] More Image manipulation features
- [ ] Resize images
- [ ] Nesting Image type into each other
- [x] Text management
- [x] Drawing text on screen
- [ ] Size properties
- [ ] Complex colouring (gradient, border)
- [ ] More advanced features (multiline text)
- [x] Font support
- [ ] QoL
- [ ] Holders for images/rects/sounds that let you access them by ID from Window
- [ ] Sound management
- [ ] Playing & stopping sound
- [ ] WAV/FLAC/OGG/MP3 formats
- [ ] Managing multiple channels (parallel sounds playing)
- [ ] UI
- [x] Buttons
- [x] Progress bars
- [ ] Sliders (vertical/horizontal)
- [ ] Scrolling slider (vertical/horizontal)
- [ ] Text fields
- [ ] Single-row box
- [ ] Multi-row box
- [ ] Lists
- [ ] Comboboxes
- [ ] Bulletboxes
- [ ] Listboxes
- [ ] QoL abstractions
- [ ] Delta clock object
- [ ] Optional Event system
- [ ] "Areas" letting you split the window into separately maintained objects
- [ ] Multiple windowsLook at [changelog](changelog.md) if you want to see details.
---
### Note
Nimfire is learning project, and as such, may contain more bugs, performance issues
and problems overall than matured library.
It is by no means stable or ready for development of games or software, and I hold
no promise to maintain it if I lose my motivation and will.That said, I really want to do as much as I can with Nimfire, so it's not like this
lib will disappear soon. Just take in mind that until it becomes important utility
for my own gamedev, I do it as fun side-project, with all good and bad coming with
such status.---
### Socials### Licensing
While library code is *All Rights Reserved* for now (I'm quite lazy for licenses),
it will be changed soon. For now you are allowed to use the library for any personal
project that is not commercial in any way.Library fonts use [Open Font License](https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL)
which permits their use. They can be used in project of any kind, but please refer
to license or your lawyer if you want to be sure.### Project made using Nimfire
#### 🎨 [Drawfire](https://github.com/Toma400/Drawfire) - simple drawing app