ruby_converter.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Pingus - A free Lemmings clone
  2. // Copyright (C) 2002 Ingo Ruhnke <grumbel@gmx.de>
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. #ifndef HEADER_RUBY_CONVERTER_HXX
  17. #define HEADER_RUBY_CONVERTER_HXX
  18. #include "flexlay_wrap.hpp"
  19. // The following functions are defined in flexlay_wrap.i, a bit hacky but seems to work
  20. VALUE ObjMapObject2Value(const ObjMapObject& arg);
  21. VALUE ObjectBrush2Value(const ObjectBrush& arg);
  22. VALUE CL_Point2Value(const CL_Point& arg);
  23. VALUE CL_Pointf2Value(const CL_Pointf& arg);
  24. VALUE CL_Color2Value(const CL_Color& arg);
  25. template<> VALUE convert_to_ruby_value<float>(const float& arg)
  26. {
  27. return rb_float_new(arg);
  28. }
  29. template<>
  30. VALUE convert_to_ruby_value<ObjMapObject>(const ObjMapObject& arg)
  31. {
  32. return ObjMapObject2Value(arg);
  33. }
  34. template<>
  35. VALUE convert_to_ruby_value<ObjectBrush>(const ObjectBrush& arg)
  36. {
  37. return ObjectBrush2Value(arg);
  38. }
  39. template<>
  40. VALUE convert_to_ruby_value<CL_Color>(const CL_Color& arg)
  41. {
  42. return CL_Color2Value(arg);
  43. }
  44. template<>
  45. VALUE convert_to_ruby_value<CL_Point>(const CL_Point& arg)
  46. {
  47. return CL_Point2Value(arg);
  48. }
  49. template<>
  50. VALUE convert_to_ruby_value<CL_Pointf>(const CL_Pointf& arg)
  51. {
  52. return CL_Pointf2Value(arg);
  53. }
  54. template<>
  55. VALUE convert_to_ruby_value<int>(const int& arg)
  56. {
  57. return INT2FIX(arg);
  58. }
  59. #endif
  60. /* EOF */