Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Some new functions
Some new functions [message #29820] Sat, 20 November 2010 01:01 Go to previous message
koldo is currently offline  koldo
Messages: 3398
Registered: August 2008
Senior Veteran
Hello

Here there are a few functions that could be added to U++:

inline bool Odd(int val)	  	{return val%2;}
inline bool Even(int val) 	  	{return !Odd(val);}
inline int RoundEven(int val) 		{return Even(val) ? val : val+1;}
template<class T>
inline int Sign(T a) 			{return (a > 0) - (a < 0);}

inline const RGBA *GetPixel(const Image &img, int x, int y) {
	return img + x + y*img.GetWidth();
}
inline RGBA *GetPixel(ImageBuffer &img, int x, int y) {
	return img + x + y*img.GetWidth();
}


Best regards
IƱaki
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to commit on svn ?
Next Topic: FileSel change
Goto Forum:
  


Current Time: Thu Oct 31 23:46:20 CET 2024

Total time taken to generate the page: 0.02671 seconds