Guest User

Untitled

a guest
Jul 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. @name EGP OS
  2. @inputs E:wirelink MouseX MouseY Active Mouse1 Power
  3. @outputs X Y SelectedApp Calc CurrentID
  4. @persist Entity:entity Value Hour:string Minutes:string Test BoxID TextID IconsList:array
  5. @persist I
  6. @trigger
  7. interval(10)
  8. if(first()|duped()|!Power){E:egpClear() E:egpDrawTopLeft(1) BoxID=1 TextID=1000}
  9.  
  10. function void createCursor(){
  11. E:egpBox(192,vec2(0,0),vec2(0,0))
  12. E:egpAlpha(192,0)
  13. E:egpTriangle(191,vec2(0,0),vec2(6,6),vec2(0,8))
  14. E:egpOrder(191,100000)
  15. E:egpParent(191,192)
  16. }
  17. function void createIcon(Name:string,Color:vector){
  18. if(BoxID<=100){
  19. E:egpBox(BoxID,vec2(16+(floor((BoxID-1)/10)*48),16+((BoxID-1)%10*48)),vec2(32,32))
  20. E:egpColor(BoxID,Color)
  21. E:egpText(TextID,Name,vec2(E:egpPos(BoxID):x(),E:egpPos(BoxID):y()+34))
  22. E:egpSize(TextID,10)
  23. IconsList:pushString(BoxID+"_"+Name)
  24. BoxID++
  25. TextID++
  26.  
  27. }
  28. else{
  29. print("Error: Too many icons!")
  30. }
  31.  
  32. }
  33. function void testIcons(){
  34. for(I=1,100){
  35. createIcon("App_"+I,vec(255-I*2.55,0,I*2.55))
  36. }
  37. }
  38. function number mouseClick(X,Y){
  39. if(inrange((X-16)%48,0,32)&inrange((Y-16)%48,0,32)&(floor((X-16)/48)*10+floor((Y-16)/48)+1)<=IconsList:count()){
  40. CurrentID=IconsList[(floor((X-16)/48)*10+floor((Y-16)/48)+1),string]:explode("_")[1,string]:toNumber()
  41. return CurrentID
  42. }
  43. CurrentID= 0
  44. return 0
  45. }
  46.  
  47.  
  48. #background
  49. function void drawBackground(){
  50. E:egpBox(193,vec2(0,0),vec2(512,512))
  51. E:egpColor(193,vec(0,200,255))
  52. E:egpCircle(194,vec2(256,512),vec2(512,256))
  53. E:egpColor(194,vec(0,125,0))
  54. #bottom bar
  55. E:egpBox(195,vec2(0,496),vec2(512,16))
  56. E:egpColor(195,vec(0,0,200))
  57. #Time
  58. E:egpText(196,Hour+":"+Minutes,vec2(474,497))
  59. E:egpSize(196,14)
  60. }
  61. ##Clock
  62. if(clk()&Power){
  63. if(time("hour")<5){
  64. Hour=(19+time("hour")):toString()
  65. }
  66. else{
  67. Hour=(time("hour")-4):toString()
  68. }
  69.  
  70. if((time("hour")-5)<10&time("hour")>=5){
  71. Hour="0"+Hour
  72. }
  73. Minutes=time("min"):toString()
  74. if(time("min")<10){
  75. Minutes="0"+time("min")
  76. }
  77. E:egpSetText(196,Hour+":"+Minutes)
  78. if(~Active){
  79. E:egpUnParent(192)
  80. E:egpUnParent(191)
  81. }
  82. ##Mouse update
  83. if(Active){
  84. E:egpParent(191,192)
  85. if(~MouseX){
  86. X+=MouseX
  87. }
  88. if(~MouseY){
  89. Y-=MouseY
  90. }
  91. }else{
  92. E:egpParentToCursor(192)
  93. E:egpParentToCursor(191)
  94. X=E:egpCursor(owner()):x()
  95. Y=E:egpCursor(owner()):y()
  96. }
  97. E:egpPos(192,vec2(X,Y))
  98. X=clamp(X,0,512)
  99. Y=clamp(Y,0,512)
  100. }
  101.  
  102. if(~Power&Power){
  103. drawBackground()
  104. testIcons()
  105. createCursor()
  106.  
  107. }
  108.  
  109.  
  110. if((~Mouse1&Mouse1)|(changed(owner():keyUse())&owner():keyUse())){
  111. SelectedApp=mouseClick(X,Y)
  112. }
Add Comment
Please, Sign In to add comment