RYBEC I LOVE YOU!
I might even integrate this into the lua code and make it built in.
EGP Mouse
EDIT:EXAMPLE BUTTON ADDED
Features rollover and click animations.
EDIT:Eye-Pod alternative added.
Allows keyboard input as well, good as a computer base. See bottom of post.
Not much to explain here, yeah?
Works for any screen in the dropdown menu.
Uses aimpos of nearest player, but only if they're close enough.
Uses the Use key to click, but that can easily be changed/added to.
Given the kind of power inside of EGP, I wouldn't be surprised to see right-click menus....
Started off using the offset data from this:E2 ConsoleScreen To grapics Tab
However, I've tweaked some of the values slightly to be more accurate, and added the other EGP screens, as well as converted it to using vec2s
[ame="http://www.youtube.com/watch?v=jdLgnRZJu0o"]YouTube- EGP mouse[/ame]
Handy-snazzy position reference grid included at no extra charge. Great for planning where to put things, although it won't be long before this is merged into EGP for Dummies, at which point a full-blown CAD package and probably an interface designer isn't far off.
[highlight="e2"]
@name EGP Mouse
@inputs EGP:wirelink
@outputs Coords:vector2 Click
@persist [Coords1 Coords2]:vector2 Dir E:entity RepeatTime
interval(200)
if( first() | duped() | ~EGP | changed(numPlayers())) {
E=EGP:entity()
RepeatTime=1000
#BG
EGP:egpBox(1,vec2(),vec2(512,512),vec4(0,200,255,2 55))
#Button1
EGP:egpBox(2,vec2(66,386),vec2(132,68),vec4(0,0,0, 255))
EGP:egpBox(3,vec2(64,384),vec2(128,64),vec4(0,100, 255,255))
EGP:egpText(4,"Test",vec2(80,395),vec4(0,255,50,25 5))
EGP:egpSetFont(4,"coolvetica",50)
#Offsets
if( E:model() == "models/props/cs_office/tv_plasma.mdl") {
Coords1=vec2(-28.5,36)
Coords2=vec2(28.5,2)
Dir=1
}
elseif( E:model() == "models/props/cs_office/computer_monitor.mdl") {
Dir=1
Coords1=vec2(-10.5,24.7)
Coords2=vec2(10.5,8.6)
}
elseif( E:model() == "models/props_lab/monitor01b.mdl") {
Dir=1
Coords1=vec2(-5.535,5.091)
Coords2=vec2(3.5,-4.1)
}
elseif( E:model() == "models/kobilica/wiremonitorsmall.mdl") {
Dir=1
Coords1=vec2(-4.4,9.5)
Coords2=vec2(4.5,0.6)
}
elseif( E:model() == "models/kobilica/wiremonitorbig.mdl") {
Dir=1
Coords1=vec2(-11.6,24.5)
Coords2=vec2(11.6,1.5)
}
elseif( E:model() == "models/hunter/plates/plate2x2.mdl" ){
Dir=2
Coords1=vec2(-46.5,-46.5)
Coords2=vec2(46.5,46.5)
}
elseif( E:model() == "models/hunter/plates/plate4x4.mdl" ){
Dir=2
Coords1=vec2(-94.8,-94.8)
Coords2=vec2(94.8,94.8)
}
elseif( E:model() == "models/hunter/plates/plate1x1.mdl" ){
Dir=2
Coords1=vec2(-23,-23)
Coords2=vec2(23,23)
}
elseif( E:model() == "models/hunter/plates/plate8x8.mdl" ){
Dir=2
Coords1=vec2(-189.8,-189.8)
Coords2=vec2(189.8,189.8)
}
}
#Find closest player
findByClass("player")
findSortByDistance(E:massCenter())
Ply = find()
Aim = E:toLocal(Ply:aimPos())
if (Dir==1){
Coords=(Coords1 - vec2(Aim:y(),Aim:z()))/(Coords1-Coords2)*513
Z = Aim:x()
}
elseif (Dir==2) {
Coords=(Coords1 - vec2(Aim:y(),Aim:x()))/(Coords1-Coords2)*513
Z = Aim:z()
}
Dist=Ply:shootPos():distance(E:massCenter())
IsAimingOn=(Dist<max(E:radius()*2,30) & Ply:aimEntity()==E & inrange(Coords,vec2(1,1),vec2(513,513)))
if (IsAimingOn) {
Click=Ply:keyUse()
}
else {
Coords=vec2()
}
if (inrange(Coords,vec2(64,384),vec2(192,448))) {
EGP:egpBox(3,vec2(65,385),vec2(128,64),vec4(0,100, 200,255))
EGP:egpText(4,"Test",vec2(81,396),vec4(0,255,50,25 5))
EGP:egpSetFont(4,"coolvetica",50)
if (Click){
EGP:egpBox(3,vec2(66,386),vec2(128,64),vec4(200,10 0,0,255))
EGP:egpText(4,"Test",vec2(82,397),vec4(0,255,50,25 5))
EGP:egpSetFont(4,"coolvetica",50)
if ($Click) {
soundPlay(0,0,"buttons/blip1.wav")
}
}
}
else {
EGP:egpBox(3,vec2(64,384),vec2(128,64),vec4(0,100, 255,255))
EGP:egpText(4,"Test",vec2(80,395),vec4(0,255,50,25 5))
EGP:egpSetFont(4,"coolvetica",50)
}
EGP:egpTriangle(40,Coords,Coords+vec2(6,5),Coords+ vec2(0,10),Click ? vec4(255,0,0,200) : vec4(0,0,255,200))
EGP:egpDraw()
[/highlight]
About the Eyepod version:
Zip file contains the expression, as well as a dupe of a completed setup. Example chip (the computer) is wirelinked to a keyboard, but does not use it yet. Button goes boop when pressed. The eyepod itself is hiding invisible inside the mouse prop, if you want to do anything with it.
Last edited by Rybec; 12-22-2009 at 01:05 AM. Reason: Added example button, Added eyepod version
RYBEC I LOVE YOU!
I might even integrate this into the lua code and make it built in.
Ehhhh....
If you're going to implement it directly, the cursor shouldn't count towards the total shape count. A way of manually setting the cursor position would be nice too.
It's my intent to, when working with Jacoby on making his EGP designer mouse-based, to make the cursor snap to existing elements. What if we want to click with attack1 and 2?
The amount of control we need to have over that cursor really makes it such that it should just be left up to the end-coder. On the other hand, built-in mouse support means you would also build in the ability to check what element the cursor is over, making buttons easier, but it gets to the point where you need to decide what the main point of the project is. Is it creating a display device, or an interface device?
Plus, you could make an actual MOUSE mouse by using an eyepod. The number of layered interactions involved at moving that cursor across the screen at that point kinda blows my mind. I mean, you have a device measuring movement, moving the real cursor, the motion of which is then in turn interpreted by Source, which is then used to rotate a view, which is, itself, measured for change.....
And there's the whole bit where EGP could potentially be used to realize the pipe dream of Gmod in Gmod, and then what if you have a moused surface in that.....
Gaaah. My head hurts.
EDIT: May make my head hurt, but boy was it simple to implement.
Last edited by Rybec; 12-22-2009 at 01:06 AM.
Wait! Rybec just implemented gmod in egp?
And dont make cursor exist by default, make a Cursor input that when it get any other number then 0, turns on a cursor. This could be used both to make something without a ugly cursor, or something with a neat cursor that you also can turn off.
It should output both x and y pos, but also index of the shape you hover. Perhaps even who uses it.
Making it detect if the user is pressing use, mouse 1 or whatever would be quite unnecesary, as with the user output e2 easily does that.
However a user override would be good to, so you can give it owner() or Pod:driver().
I was joking. However, after I get more interface elements figured out, I AM going to be making a 3D renderer, so some sort of 3D game may be possible.
On the topic of interface elements, I've got a working slider!
Don't have a pic of it yet though.
Slider works both ways, dragging it around changes the value, and changing the value moves the slider.
Press Test to start/stop the sound, slider adjusts pitch. Press the 100 button to set the slider to 100.
Last edited by Rybec; 12-22-2009 at 02:22 PM.
still dont understand wut i could use this 4.
-.- If you have no idea whats EGP, leave the thread
New server IP: 89.238.160.17:27018
Hologram contraptions 1 Holo contraptions 2 EGP stuff Holo minigun Holo javelin rocket launcher
Unsmart: I doubt the intelligence of some people.
Drunkie: Nobody could have said that any better than Unsmart.
Unsmart: Solece, I totally did your mom yesterday
Solece: Who hasnt
Divran: there are more retarded people than there are clever people in this world
Bookmarks