Skip to content

xzores/furbs

Repository files navigation

Furbs

A Odin library for games, currently under construction not ready for production.

Furbs library collection aims to provide all the necessities for shipping 3D/2D indie games.

The libary collection current holds the following capabilities:
-Utils (used internally)
-Render, used for opening a windows and rending OpenGL 3.3 to 4.6, this might in the furture support 3.0, OpenGL ES 2/3
-GUI library
-Networking library
-Sound library (comming)
-Partical system library (comming)

It is heavily inspired by Raylib with a greater emphasis om preformence while still being easy to use.

Here is how you would open draw a few 2D shapes with the render library (more examples in "exampels")

import "path/render" //or replace "path"

main :: proc {
	using render;
	
	window := init_window(600, 400, "Hello world", "res/shaders", culling = false);
	
	my_texture := load_texture_from_file("res/textures/test.png");

	mouse_mode(.normal);
	enable_vsync(false); //disable Vsync
	
	my_rect : [4][2]f32 = {};

	my_camera : Camera2D = {
		position 			= {0,0},			// Camera position
		target_relative 	= {0,0},			// 
		rotation	 		= 0,				// In degrees
		zoom	   			= 1,				//
		far					= 1,
		near 				= -1,
	};
	
	for !should_close(window) {
		begin_frame(window, clear_color = {0.5,0.5,0.5,1});
		begin_mode_2D(my_camera);

		//Draw rects
		draw_shape([4]f32{0, 0, 0.5, 0.5}, rot = 45, texture = my_texture);
		draw_shape([4]f32{-0.5, -0.5, 0.5, 0.5}, color = {1,0,0,1});
		
		//Draw lines
		draw_shape(Circle{1, [2]f32{0,0}}, color = {0,0,1,0.5});

		end_mode_2D(my_camera);
		end_frame(window);
	}
	
	destroy_window(&window);
	fmt.printf("Shutdown succesfull");
}

Tutorials, documentation and more exampels are on the way. Codeveloped by albe194e

Examples are included to do the following: -Drawing 2D
Drawing_a_quad

-Drawing 3D<br />

Drawing_a_quad_3D

-Drawing 2D shapes, transparetcy and textures 3D<br />

Drawing_shapes

-Drawing text<br />

Drawing_text

-Drawing 3D<br />

Drawing_3D

Furbs also include a gui library.
The gui library includes the following elements:
-Rect
-Button
-Checkbox
-Slide_input
-Slider
-Input_field
-Selector
-Slot
-Label

Below is an example with a button:
Skærmbillede 2024-01-01 201929

and here is a little menu:
Skærmbillede 2024-01-01 202136
resizing happens automagicly.
Skærmbillede 2024-01-01 202311
this gui system is suitable for in-game guis. Once can retrive events like: hover, active and triggered.
hover : being true when the elements is hovered over.
active : being trie when the element is currently selected in one way or another, this is element dependent.
triggered : being true when the element recives an 1 time event (like being clicked) also element dependent.

A collection of gui elements are shown below:
Skærmbillede 2024-01-01 202400

image

Plotter library

100_hz_sin_modulated_by_a_10_hz_wave_from_100_to110hz

n_mos_resistor_1u_x_1u_close