Colourb.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef ROCKETCORELUACOLOURB_H
  2. #define ROCKETCORELUACOLOURB_H
  3. /*
  4. Declares Colourb in the Lua global namespace. It implements the below (examples using Lua syntax) :
  5. Colourb(int red,int green,int blue,int alpha) creates a new Colourf (values must be bounded between 0 and 255 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 = Colourb(0,15,3,255)
  9. operators (the types that it can operate on are on the right):
  10. col == Colourb
  11. col + Colourb
  12. col * float
  13. no methods
  14. get and set attributes:
  15. col.red
  16. col.green
  17. col.blue
  18. col.alpha
  19. get attributes:
  20. local red,green,blue,alpha = col.rgba
  21. */
  22. #include <Rocket/Core/Lua/LuaType.h>
  23. #include <Rocket/Core/Lua/lua.hpp>
  24. #include <Rocket/Core/Types.h>
  25. using Rocket::Core::Colourb;
  26. namespace Rocket {
  27. namespace Core {
  28. namespace Lua {
  29. template<> void LuaType<Colourb>::extra_init(lua_State* L, int metatable_index);
  30. int Colourbnew(lua_State* L);
  31. int Colourb__eq(lua_State* L);
  32. int Colourb__add(lua_State* L);
  33. int Colourb__mul(lua_State* L);
  34. //getters
  35. int ColourbGetAttrred(lua_State* L);
  36. int ColourbGetAttrgreen(lua_State* L);
  37. int ColourbGetAttrblue(lua_State* L);
  38. int ColourbGetAttralpha(lua_State* L);
  39. int ColourbGetAttrrgba(lua_State* L);
  40. //setters
  41. int ColourbSetAttrred(lua_State* L);
  42. int ColourbSetAttrgreen(lua_State* L);
  43. int ColourbSetAttrblue(lua_State* L);
  44. int ColourbSetAttralpha(lua_State* L);
  45. RegType<Colourb> ColourbMethods[];
  46. luaL_reg ColourbGetters[];
  47. luaL_reg ColourbSetters[];
  48. /*
  49. template<> const char* GetTClassName<Colourb>() { return "Colourb"; }
  50. template<> RegType<Colourb>* GetMethodTable<Colourb>() { return ColourbMethods; }
  51. template<> luaL_reg* GetAttrTable<Colourb>() { return ColourbGetters; }
  52. template<> luaL_reg* SetAttrTable<Colourb>() { return ColourbSetters; }
  53. */
  54. }
  55. }
  56. }
  57. #endif