Author Topic: Utils module  (Read 12447 times)

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Utils module
« on: May 10, 2016, 04:06:43 PM »
When i release my updated animate module, it will make use of a Utils module that will have a bunch of helpful functions. What would you like to see in it? What types of helper functions do you reuse all the time?

Here are some of the things I have already or plan on adding:

Code: [Select]
//math and number helpers
random
randomf (float)
randoma (val from array)
clamp
percent (get a percentage of a val/maxval)

//color utils
int_to_rgb (int color to rgb table)
rgb_to_hex (rgb to hex val)
hex to rgb (hex val to rgb table)

//callback utils
register_callback (register a global callback)
unregister_callback (unregister a callback)
run_callback (run a callback)

//object utils
transform (transform an object with centered scale and rotation)
anchor (anchor one object to another)
align (align one object to another)

//string utils
translate (translates variable strings to their actual value)
replace (replace something in a string with something else)
parse_time (parses a time string like "1s" into ms)

chrisvg

  • Full Member
  • ***
  • Posts: 78
    • View Profile
Re: Utils module
« Reply #1 on: May 11, 2016, 06:22:43 PM »
Hey Liquid,

I have a nut file with a ton of general functions that i'm using in a layout i'm working on at the moment.. i'll give you some things to add shortly :)