Colourf.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef ROCKETCORELUACOLOURF_H
  2. #define ROCKETCORELUACOLOURF_H
  3. /*
  4. Declares Colourf in the Lua global namespace. It implements the below (examples using Lua syntax) :
  5. Colourf.new(float red,float green,float blue,float alpha) creates a new Colourf (values must be bounded between 0 and 1 inclusive),
  6. and gets deleted when Lua garbage collects
  7. everything after this will assume that you have a local variable named 'col', declared something similar to
  8. local col = Colourf.new(0.1,0.5,0.25,1.0)
  9. operators (the types that it can operate on are on the right):
  10. col == Colourf
  11. no methods
  12. get and set attributes:
  13. col.red
  14. col.green
  15. col.blue
  16. col.alpha
  17. get attributes:
  18. local red,green,blue,alpha = col.rgba
  19. */
  20. #include <Rocket/Core/Lua/lua.hpp>
  21. #include <Rocket/Core/Lua/LuaType.h>
  22. #include <Rocket/Core/Types.h>
  23. using Rocket::Core::Colourf;
  24. namespace Rocket {
  25. namespace Core {
  26. namespace Lua {
  27. template<> void LuaType<Colourf>::extra_init(lua_State* L, int metatable_index);
  28. //metamethods
  29. int Colourfnew(lua_State* L);
  30. int Colourf__eq(lua_State* L);
  31. //getters
  32. int ColourfGetAttrred(lua_State* L);
  33. int ColourfGetAttrgreen(lua_State* L);
  34. int ColourfGetAttrblue(lua_State* L);
  35. int ColourfGetAttralpha(lua_State* L);
  36. int ColourfGetAttrrgba(lua_State* L);
  37. //setters
  38. int ColourfSetAttrred(lua_State* L);
  39. int ColourfSetAttrgreen(lua_State* L);
  40. int ColourfSetAttrblue(lua_State* L);
  41. int ColourfSetAttralpha(lua_State* L);
  42. RegType<Colourf> ColourfMethods[];
  43. luaL_reg ColourfGetters[];
  44. luaL_reg ColourfSetters[];
  45. /*
  46. template<> const char* GetTClassName<Colourf>() { return "Colourf"; }
  47. template<> RegType<Colourf>* GetMethodTable<Colourf>() { return ColourfMethods; }
  48. template<> luaL_reg* GetAttrTable<Colourf>() { return ColourfGetters; }
  49. template<> luaL_reg* SetAttrTable<Colourf>() { return ColourfSetters; }
  50. */
  51. }
  52. }
  53. }
  54. #endif