Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aiekick/ctools
some helpers im using since 2009. contain usefull things like vec2, vec3, vec4, variant, actionTime and more
https://github.com/aiekick/ctools
aabbcc actiontime conversion cpp cross-platform ctools free-library helper linux logger macos math osx rect toolkit variant vec4 windows
Last synced: 16 days ago
JSON representation
some helpers im using since 2009. contain usefull things like vec2, vec3, vec4, variant, actionTime and more
- Host: GitHub
- URL: https://github.com/aiekick/ctools
- Owner: aiekick
- License: mit
- Created: 2020-02-16T11:18:50.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-05-20T21:19:41.000Z (6 months ago)
- Last Synced: 2024-05-21T00:06:15.682Z (6 months ago)
- Topics: aabbcc, actiontime, conversion, cpp, cross-platform, ctools, free-library, helper, linux, logger, macos, math, osx, rect, toolkit, variant, vec4, windows
- Language: C++
- Homepage:
- Size: 511 KB
- Stars: 17
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Win](https://github.com/aiekick/cTools/actions/workflows/Win.yml/badge.svg)](https://github.com/aiekick/cTools/actions/workflows/Win.yml)
[![Linux](https://github.com/aiekick/cTools/actions/workflows/Linux.yml/badge.svg)](https://github.com/aiekick/cTools/actions/workflows/Linux.yml)
[![Osx](https://github.com/aiekick/cTools/actions/workflows/Osx.yml/badge.svg)](https://github.com/aiekick/cTools/actions/workflows/Osx.yml)## cTools :
a two files helper im using from more than 10 years, in all my project.
Contain usefull templated things for c++ like vec2, vec3, vec4, variant, actionTime and more.
need a bit of refactoring btw :)
use the namespace ct- ct::cCyclicArray => circular list
- ct::cActionTime => define when to do action according to time of last event
- ct::cTexture => opengl texture simple container
- ct::cColor => color class for conversion
- ct::vec2 => vec2 class for quick operation / math x,y
- ct::mat2 => mat2 class for matrix 2x2
- ct::vec3 => vec3 class for quick operation / math x,y,z
- ct::vec4 => vec4 class for quick operation / math x,y,z,w
- ct::rect => rect class for quick operation / math x,y,w,h
- ct::AABB => AABB 2D
- ct::AABBCC => AABBCC 3D
- ct::variant => variant class for quick conversion between many types and stringand other string conversion / extraction etc..
## Logger :
Log method for check/write in auto in a log file
- LogStr(n)
- LogValue(s, n)
- LogGlError()
- LogGlErrorVar(var)
- LogAssert(a,b)## FileHelper
this singleton is usefull for manipulate files / directory
fully tested on win/LINUX/MACOS- convert from absolute to realtive to aantoher path
- test aboslute or relative
- is file exist
- test if a file exist a list of path to search in
- simplify a patth (like if you have toto/../toto/../toto => toto
- get/set app path
- get/set current directory
- load/save file to/from string
- parse file path name
- destroy a file
- open a fil in an external editor
- open a url in a browser
- select a file in os explorer
- get drives (on win32)dependency : ctools, dirent/h, glfw if you want to use clipboard
## ConfigAbstract
ConfigAbstract let you load/save a config file easily from class
using lib [tinyxml2](https://github.com/leethomason/tinyxml2)Usage :
```cpp
class toto : public conf::ConfigAbstract
{
public:
toto()
{
LoadConfigFile("config.xml");
}~toto()
{
SaveConfigFile("config.xml");
}std::string getXml(const std::string& vOffset);
void setFromXml(tinyxml2::XMLElement* vElem, tinyxml2::XMLElement* vParent);
};std::string toto::getXml(const std::string& vOffset)
{
std::string str;str += vOffset + "\t\n";
return str;
}bool toto::setFromXml(tinyxml2::XMLElement* vElem, tinyxml2::XMLElement* vParent)
{
// The value of this child identifies the name of this element
std::string strName = "";
std::string strValue = "";
std::string strParentName = "";strName = vElem->Value();
if (vElem->GetText())
strValue = vElem->GetText();
if (vParent != 0)
strParentName = vParent->Value();auto att = vElem->FirstAttribute();
if (att && std::string(att->Name()) == "value")
{
strValue = att->Value();
if (strName == "tata")
youvar = strValue;
}
return true; // parsing continue if childs or stop
}
```