Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #include <kos32sys.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. #include <import.h>
  6.  
  7. static void _ButtonCreate()
  8. {
  9.     define_button(js_touint32(J, 1),js_touint32(J,2), js_touint32(J,3), js_touint32(J,4));
  10. }
  11.  
  12. static void _WindowCreate()
  13. {
  14.     sys_create_window(js_toint(J, 1), js_toint(J, 2), js_toint(J, 3), js_toint(J, 4), js_tostring(J,5), js_touint32(J,6), js_touint32(J,7));
  15. }
  16.  
  17. static  void _StartDraw()
  18. {
  19.    begin_draw();
  20. }
  21.  
  22. static void _EndDraw()
  23. {
  24.     end_draw();
  25. }
  26.  
  27. static void _DebugPrintS()
  28. {
  29.     puts(js_tostring(J,1));
  30.  
  31. }
  32.  
  33. static void _GetEvent()
  34. {  
  35.     js_pushnumber(J, get_os_event());
  36. }
  37.  
  38. static void _GetButtonEvent()
  39. {
  40.     js_pushnumber(J,get_os_button());
  41. }
  42.  
  43. static void _WriteText()
  44. {
  45.     draw_text_sys(js_tostring(J,1), js_toint32(J,2), js_toint32(J,3), js_toint32(J,4), js_touint32(J,5));
  46. }
  47.  
  48. void import_functions()
  49. {
  50.     J = js_newstate(NULL, NULL, JS_STRICT);
  51.    
  52.     js_newcfunction(J, _WindowCreate, "WindowCreate", 7);
  53.     js_setglobal(J, "WindowCreate");
  54.    
  55.     js_newcfunction(J, _StartDraw, "StartDraw", 0);
  56.     js_setglobal(J, "StartDraw");
  57.  
  58.     js_newcfunction(J, _EndDraw, "EndDraw", 0);
  59.     js_setglobal(J, "EndDraw");
  60.  
  61.     js_newcfunction(J, _GetEvent, "GetEvent", 0);
  62.     js_setglobal(J, "GetEvent");
  63.  
  64.     js_newcfunction(J, _DebugPrintS, "DebugPrintS", 0);
  65.     js_setglobal(J, "DebugPrintS");
  66.  
  67.     js_newcfunction(J, _ButtonCreate, "ButtonCreate", 4);
  68.     js_setglobal(J, "ButtonCreate");
  69.  
  70.     js_newcfunction(J, _GetButtonEvent, "GetButtonEvent", 0);
  71.     js_setglobal(J, "GetButtonEvent");
  72.  
  73.     js_newcfunction(J, (void*)exit, "Exit", 0);
  74.     js_setglobal(J, "Exit");
  75.  
  76.     js_newcfunction(J, _WriteText, "WriteText", 5);
  77.     js_setglobal(J, "WriteText");
  78.  
  79. }
  80.