Colourf.h 1.6 KB

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