Added proper keyboard handling
This commit is contained in:
1 parent
2fbefe616c
commit
2668b802cb
1 file changed
+77
-76
@@ -125,33 +125,16 @@ namespace Vocaluxe.Screens
|
|||||||
DeleteProfile();
|
DeleteProfile();
|
||||||
} else if (Buttons[htButtons(ButtonWebcam)].Selected && CWebcam.GetDevices().Length > 0)
|
} else if (Buttons[htButtons(ButtonWebcam)].Selected && CWebcam.GetDevices().Length > 0)
|
||||||
{
|
{
|
||||||
CWebcam.Start();
|
OnWebcam();
|
||||||
_Snapshot = CWebcam.GetBitmap();
|
} else if (Buttons[htButtons(ButtonSaveSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
||||||
Buttons[htButtons(ButtonSaveSnapshot)].Visible = true;
|
|
||||||
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = true;
|
|
||||||
}
|
|
||||||
else if (Buttons[htButtons(ButtonSaveSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
|
||||||
{
|
{
|
||||||
string filename = "snapshot.png";
|
OnSaveSnapshot();
|
||||||
int i = 0;
|
} else if (Buttons[htButtons(ButtonDiscardSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
||||||
while (File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + ".png")))
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
if (!File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + i + ".png")))
|
|
||||||
{
|
|
||||||
filename += i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CWebcam.Stop();
|
|
||||||
Buttons[htButtons(ButtonSaveSnapshot)].Visible = false;
|
|
||||||
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = false;
|
|
||||||
}
|
|
||||||
else if (Buttons[htButtons(ButtonDiscardSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
|
||||||
{
|
{
|
||||||
CWebcam.Stop();
|
OnDiscardSnapshot();
|
||||||
Buttons[htButtons(ButtonSaveSnapshot)].Visible = false;
|
} else if (Buttons[htButtons(ButtonTakeSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
||||||
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = false;
|
{
|
||||||
|
OnTakeSnapshot();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -231,61 +214,18 @@ namespace Vocaluxe.Screens
|
|||||||
{
|
{
|
||||||
CProfiles.SetActive(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection,
|
CProfiles.SetActive(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection,
|
||||||
(EOffOn)SelectSlides[htSelectSlides(SelectSlideActive)].Selection);
|
(EOffOn)SelectSlides[htSelectSlides(SelectSlideActive)].Selection);
|
||||||
}
|
} else if (Buttons[htButtons(ButtonWebcam)].Selected && CWebcam.GetDevices().Length > 0)
|
||||||
else if (Buttons[htButtons(ButtonWebcam)].Selected && CWebcam.GetDevices().Length > 0)
|
|
||||||
{
|
{
|
||||||
_Snapshot = null;
|
OnWebcam();
|
||||||
CWebcam.Start();
|
} else if (Buttons[htButtons(ButtonSaveSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
||||||
CWebcam.GetFrame(ref _WebcamTexture);
|
|
||||||
Buttons[htButtons(ButtonSaveSnapshot)].Visible = true;
|
|
||||||
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = true;
|
|
||||||
Buttons[htButtons(ButtonTakeSnapshot)].Visible = true;
|
|
||||||
Buttons[htButtons(ButtonWebcam)].Visible = false;
|
|
||||||
}
|
|
||||||
else if (Buttons[htButtons(ButtonSaveSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
|
||||||
{
|
{
|
||||||
string filename = "snapshot";
|
OnSaveSnapshot();
|
||||||
int i = 0;
|
} else if (Buttons[htButtons(ButtonDiscardSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
||||||
while (File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + i + ".png")))
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
_Snapshot.Save(Path.Combine(CSettings.sFolderProfiles, filename + i + ".png"), System.Drawing.Imaging.ImageFormat.Png);
|
|
||||||
CProfiles.LoadAvatars();
|
|
||||||
LoadAvatars();
|
|
||||||
_Snapshot = null;
|
|
||||||
CWebcam.Stop();
|
|
||||||
CDraw.RemoveTexture(ref _WebcamTexture);
|
|
||||||
|
|
||||||
for (int j = 0; j < CProfiles.Avatars.Length; j++)
|
|
||||||
{
|
|
||||||
if (CProfiles.Avatars[j].FileName == (filename + i + ".png"))
|
|
||||||
{
|
|
||||||
CProfiles.SetAvatar(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection, j);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Buttons[htButtons(ButtonSaveSnapshot)].Visible = false;
|
|
||||||
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = false;
|
|
||||||
Buttons[htButtons(ButtonTakeSnapshot)].Visible = false;
|
|
||||||
Buttons[htButtons(ButtonWebcam)].Visible = true;
|
|
||||||
}
|
|
||||||
else if (Buttons[htButtons(ButtonDiscardSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
|
||||||
{
|
{
|
||||||
CWebcam.Stop();
|
OnDiscardSnapshot();
|
||||||
CDraw.RemoveTexture(ref _WebcamTexture);
|
} else if (Buttons[htButtons(ButtonTakeSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
||||||
_Snapshot = null;
|
|
||||||
Buttons[htButtons(ButtonSaveSnapshot)].Visible = false;
|
|
||||||
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = false;
|
|
||||||
Buttons[htButtons(ButtonTakeSnapshot)].Visible = false;
|
|
||||||
Buttons[htButtons(ButtonWebcam)].Visible = true;
|
|
||||||
}
|
|
||||||
else if (Buttons[htButtons(ButtonTakeSnapshot)].Selected && CWebcam.GetDevices().Length > 0)
|
|
||||||
{
|
{
|
||||||
Buttons[htButtons(ButtonWebcam)].Visible = false;
|
OnTakeSnapshot();
|
||||||
_Snapshot = CWebcam.GetBitmap();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,6 +236,67 @@ namespace Vocaluxe.Screens
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnTakeSnapshot()
|
||||||
|
{
|
||||||
|
Buttons[htButtons(ButtonSaveSnapshot)].Visible = true;
|
||||||
|
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = true;
|
||||||
|
Buttons[htButtons(ButtonWebcam)].Visible = false;
|
||||||
|
_Snapshot = CWebcam.GetBitmap();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDiscardSnapshot()
|
||||||
|
{
|
||||||
|
CWebcam.Stop();
|
||||||
|
CDraw.RemoveTexture(ref _WebcamTexture);
|
||||||
|
_Snapshot = null;
|
||||||
|
Buttons[htButtons(ButtonSaveSnapshot)].Visible = false;
|
||||||
|
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = false;
|
||||||
|
Buttons[htButtons(ButtonTakeSnapshot)].Visible = false;
|
||||||
|
Buttons[htButtons(ButtonWebcam)].Visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnSaveSnapshot()
|
||||||
|
{
|
||||||
|
string filename = "snapshot";
|
||||||
|
int i = 0;
|
||||||
|
while (File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + i + ".png")))
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
_Snapshot.Save(Path.Combine(CSettings.sFolderProfiles, filename + i + ".png"), System.Drawing.Imaging.ImageFormat.Png);
|
||||||
|
CProfiles.LoadAvatars();
|
||||||
|
LoadAvatars();
|
||||||
|
_Snapshot = null;
|
||||||
|
CWebcam.Stop();
|
||||||
|
CDraw.RemoveTexture(ref _WebcamTexture);
|
||||||
|
|
||||||
|
for (int j = 0; j < CProfiles.Avatars.Length; j++)
|
||||||
|
{
|
||||||
|
if (CProfiles.Avatars[j].FileName == (filename + i + ".png"))
|
||||||
|
{
|
||||||
|
CProfiles.SetAvatar(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection, j);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Buttons[htButtons(ButtonSaveSnapshot)].Visible = false;
|
||||||
|
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = false;
|
||||||
|
Buttons[htButtons(ButtonTakeSnapshot)].Visible = false;
|
||||||
|
Buttons[htButtons(ButtonWebcam)].Visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnWebcam()
|
||||||
|
{
|
||||||
|
_Snapshot = null;
|
||||||
|
CWebcam.Start();
|
||||||
|
CWebcam.GetFrame(ref _WebcamTexture);
|
||||||
|
Buttons[htButtons(ButtonSaveSnapshot)].Visible = false;
|
||||||
|
Buttons[htButtons(ButtonDiscardSnapshot)].Visible = false;
|
||||||
|
Buttons[htButtons(ButtonTakeSnapshot)].Visible = true;
|
||||||
|
Buttons[htButtons(ButtonWebcam)].Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
public override bool UpdateGame()
|
public override bool UpdateGame()
|
||||||
{
|
{
|
||||||
if (SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection > -1)
|
if (SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection > -1)
|
||||||
|
|||||||
Reference in new issue
Block a user