Code Monkey home page Code Monkey logo

sfjl's Introduction

SFJL

Collection of single-file java libraries with minimal to no dependencies, inspired by the stb libraries.

Too quote Sean Barrett on his philosophy of the stb libraries:

Philosophy

stb libraries are designed with the following priorities:

  1. easy to use
  2. easy to maintain
  3. good performance

Sometimes I let "good performance" creep up in priority over "easy to maintain", and for best performance I may provide less-easy-to-use APIs that give higher performance, in addition to the easy-to-use ones. Nevertheless, it's important to keep in mind that from the standpoint of you, a client of this library, all you care about is #1 and #3, and stb libraries DO NOT emphasize #3 above all.

Some secondary priorities arise directly from the first two, some of which provide more explicit reasons why performance can't be emphasized.

  • Portable ("ease of use")
  • Small source code footprint ("easy to maintain")
  • No dependencies ("ease of use")

I feel very aligned with this philosophy, hence the quote. I do however have a huge dependency on processing when it comes to the examples. But this goes back to the easy to use priority. This also means the libraries are centered around using floats instead of doubles and the order of color is assumed to be argb. Also it will be centered around using the latest version of processing with no backwards compatibility.

Libraries

library latest version category LoC: description
SFJL_Math v0.56 math 589 the math I keep reusing
SFJL_Print v0.51 utility 180 print and println without the need of System.out
SFJL_Base64 v0.51 utility 136 base64 encoder and decoder functions
SFJL_FNV_Hash v0.52 utility 148 FNV hash implementation
SFJL_Tween v0.51 graphics / utility 226 tween functions
SFJL_Douglas_Peucker v0.50 graphics / utility 179 line based curve decimator for 2d and 3d
SFJL_Quad_Tree v0.53 graphics / utility 885 fast quad_tree implementation, with lots of optimized functions to get points
SFJL_Octree v0.50 graphics / utility 1126 fast octree implementation, with lots of optimized functions to get points
SFJL_K_D_Tree v0.50 graphics / utility 108 minimal k-d tree implementation lacking a lot of functionality
SFJL_Intergral_Image v0.52 graphics / utility 149 simple intergral image
SFJL_Terminal_IO v0.50 graphics / utility 246 (hacky!) functions for getting things like rows, columns, key pressed, and functions for setting the cursor, the color and more
SFJL_Blobscanner v0.50 graphics / utility 304 Contour scanner based on a threshold
SFJL_Doeke v0.53 misc 92 collection of functions that do not need their own file, mostly snippets I use in multiple files
sum 4260

Dependencies

Most of the examples use processing as a dependency, which is included in this repository. At this time no other libraries are being used.

Screenshots

โš  Not every example is suited for a screenshot!

SFJL_Blobscanner_Example_Heightmap

SFJL_Blobscanner_Example_Heightmap_Mask

SFJL_Douglas_Peucker_Example

SFJL_Intergral_Image_Example

SFJL_Octree_Example

SFJL_Quad_Tree_Example

SFJL_Terminal_IO_Example

SFJL_Tween_Example

Never Asked FAQ

Any advice of how to write single-file libraries for java?

Yes, How I write single-file java libraries

Are there other single-file java libraries with public-domain/open source libraries with minimal dependencies out there?

I can't find them, if you know any please let me know. I would love to list them.

Where are the build files to generate the jar files?

I have a strong dislike towards build systems like maven and gradle. I used shell scripts before to make the jar files, but those are neither human friendly, and do not work on windows. I think it is a shortcoming of java to not provide an easy way to create jar files from java itself. Right now I use VSCode with the vscode-java-dependency extension, which has shortcomings as well (microsoft seems to be incompetent), but is so far the best option provided. Also in certain cases I think it is better to copy the libraries and include them as source files instead of compiled jar's.

Libraries / Projects making use of SFJL libraries:

Biased mentioning alert since I made this; java_preproc_macros a almost single file library to replicate C macros like __LINE__ with bytecode manipulation. I did not make this into a SFJL_Preproc_Macros cause it's a java agent, and therefor does not fall in the easy to use category.


Special thanks to Sean Barrett for being a huge inspiration for this project

sfjl's People

Contributors

clankill3r avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.