Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name EGP OS
- @inputs E:wirelink MouseX MouseY Active Mouse1 Power
- @outputs X Y SelectedApp Calc CurrentID
- @persist Entity:entity Value Hour:string Minutes:string Test BoxID TextID IconsList:array
- @persist I
- @trigger
- interval(10)
- if(first()|duped()|!Power){E:egpClear() E:egpDrawTopLeft(1) BoxID=1 TextID=1000}
- function void createCursor(){
- E:egpBox(192,vec2(0,0),vec2(0,0))
- E:egpAlpha(192,0)
- E:egpTriangle(191,vec2(0,0),vec2(6,6),vec2(0,8))
- E:egpOrder(191,100000)
- E:egpParent(191,192)
- }
- function void createIcon(Name:string,Color:vector){
- if(BoxID<=100){
- E:egpBox(BoxID,vec2(16+(floor((BoxID-1)/10)*48),16+((BoxID-1)%10*48)),vec2(32,32))
- E:egpColor(BoxID,Color)
- E:egpText(TextID,Name,vec2(E:egpPos(BoxID):x(),E:egpPos(BoxID):y()+34))
- E:egpSize(TextID,10)
- IconsList:pushString(BoxID+"_"+Name)
- BoxID++
- TextID++
- }
- else{
- print("Error: Too many icons!")
- }
- }
- function void testIcons(){
- for(I=1,100){
- createIcon("App_"+I,vec(255-I*2.55,0,I*2.55))
- }
- }
- function number mouseClick(X,Y){
- 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()){
- CurrentID=IconsList[(floor((X-16)/48)*10+floor((Y-16)/48)+1),string]:explode("_")[1,string]:toNumber()
- return CurrentID
- }
- CurrentID= 0
- return 0
- }
- #background
- function void drawBackground(){
- E:egpBox(193,vec2(0,0),vec2(512,512))
- E:egpColor(193,vec(0,200,255))
- E:egpCircle(194,vec2(256,512),vec2(512,256))
- E:egpColor(194,vec(0,125,0))
- #bottom bar
- E:egpBox(195,vec2(0,496),vec2(512,16))
- E:egpColor(195,vec(0,0,200))
- #Time
- E:egpText(196,Hour+":"+Minutes,vec2(474,497))
- E:egpSize(196,14)
- }
- ##Clock
- if(clk()&Power){
- if(time("hour")<5){
- Hour=(19+time("hour")):toString()
- }
- else{
- Hour=(time("hour")-4):toString()
- }
- if((time("hour")-5)<10&time("hour")>=5){
- Hour="0"+Hour
- }
- Minutes=time("min"):toString()
- if(time("min")<10){
- Minutes="0"+time("min")
- }
- E:egpSetText(196,Hour+":"+Minutes)
- if(~Active){
- E:egpUnParent(192)
- E:egpUnParent(191)
- }
- ##Mouse update
- if(Active){
- E:egpParent(191,192)
- if(~MouseX){
- X+=MouseX
- }
- if(~MouseY){
- Y-=MouseY
- }
- }else{
- E:egpParentToCursor(192)
- E:egpParentToCursor(191)
- X=E:egpCursor(owner()):x()
- Y=E:egpCursor(owner()):y()
- }
- E:egpPos(192,vec2(X,Y))
- X=clamp(X,0,512)
- Y=clamp(Y,0,512)
- }
- if(~Power&Power){
- drawBackground()
- testIcons()
- createCursor()
- }
- if((~Mouse1&Mouse1)|(changed(owner():keyUse())&owner():keyUse())){
- SelectedApp=mouseClick(X,Y)
- }
Add Comment
Please, Sign In to add comment