SDG Toolkit - Ethos Project

abashedwhimsicalΛογισμικό & κατασκευή λογ/κού

2 Νοε 2013 (πριν από 3 χρόνια και 9 μήνες)

92 εμφανίσεις

SDG Toolkit

Shafiq Jivani, Brandon
Heenan
, Josh
Gelinas
, Sami
Gharbi

SDG Toolkit


Useful for allowing multiple inputs on the same device.


Can have multiple mice and keyboard for the same
computer.


Separates inputs so that it isn’t streamlined into one.


Normally, two mice will act as only one on a computer


Not a networking toolkit


Have to only use one
computer (no client/server)


Does keyboard as well as mouse events, however we
only dealt with mouse
events

Important Concepts


In
windows, mice coordinates are normally reported
relative to a window. SDG mice work differently.


By default, coordinates are always relative to the top
left corner of the screen. This is fine for a full screen
application, but bad if your SDG application lives in a
window.


You can tell the SDG Toolkit to deliver coordinates so
they are relative to the insider top
-
left corner of a
window (a Form). To do this, set the
RelativeTo

property in the
SDGManager

to a form.

SDG Manager


Overtop of the existing mouse and keyboard manger


Handles the behavior of the mice and the keyboards


Throws special events (
SDGMouseMove
, …
etc
)

User Controls


Needed to handle the different mice.


Buttons don’t allow you distinguish between the
different mice.


More functionality


These handle the specific SDG events that are thrown
by the manager

Installing the SDG Toolkit

1.
Download the zip file

1.
http://grouplab.cpsc.ucalgary.ca/cookbook/index.php/To
olkits/
SDGToolkit

2.
Unzip the file

3.
Include the toolkit in visual studio

1.
http://grouplab.cpsc.ucalgary.ca/cookbook/index.php/To
olkits/
HowToIncludeSDGToolkitInTheVisualStudioToolbox

4.
Add the .
dll

file to the toolbox (just browse under the
.NET framework. (Works under forms)

Add a New Tab

Rename it to SDG

Choose Items

Under .NET Framework

Tools Added

Drag SDG Manager, change
RelativeTo

<
FormName
>

Mouse Move Events

Mouse Move Code (under mouse
move event)

Graphics
g =
this.CreateGraphics
();

Pen
penColour

=
Pens.Black

if
(
e.ID

>
0)


{



penColour

=
Pens.Red
;


}

if (
e.Button

==
MouseButtons.Left
)


{


g.DrawLine
(
penColour
, new Point(
e.X
,
e.Y
),



new
Point(
e.X

+ 2,
e.Y

+ 2));


}

Initialize Components (public
MainWindow
)

Cursor[]
sdgCursors

= {
Cursors.Arrow
,
Cursors.Hand
,
Cursors.Cross
,
Cursors.IBeam

};


String[]
sdgText

= { "Edward", "Saul", "Mike", "
Sheelagh
"
};


int
[]
sdgDegreeRotations

= { 0, 90, 180, 270 };


for (
int

i

= 0;
i

< sdgManager1.Mice.Count &&
i

< 4; ++
i
)


{


sdgManager1.Mice[
i
].Cursor =
sdgCursors
[
i
];


sdgManager1.Mice[i].Text =
sdgText
[i];


sdgManager1.Mice[i].
DegreeRotation

=
sdgDegreeRotations
[i];


}

Whiteboard Example


No need for user controls

User Controls


Needed to handle the different mice.


Buttons don’t allow you distinguish between the
different mice.


More functionality


These handle the specific SDG events that are thrown
by the manager

Tic
Tac

Toe Example


This example uses the User controls

GOTCHAS


Publish Code


Will resolve minor bugs


Sometimes
trackpads

don’t work.


Use
WinForms

instead of
wpf

(toolkit is made for the
winform

not
wpf
)


Don’t use standard user controls
-
> use custom ones


When using a laptop/tablet


Add
Mice[#].Visible = false