public static bool Update() { List <TouchData> touchDataList = Touch.GetData(0); if (button.TouchDown(touchDataList)) { if (dialog == null) { dialog = new TextInputDialog(); dialog.Text = button.Label; dialog.Open(); } return(true); } if (dialog != null) { if (dialog.State == CommonDialogState.Finished) { if (dialog.Result == CommonDialogResult.OK) { button.Label = dialog.Text; } dialog.Dispose(); dialog = null; } } return(true); }
public static bool Update() { uint enableColor = 0xffffffff; uint disableColor = 0xff7f7f7f; playButton.ButtonColor = disableColor; stopButton.ButtonColor = disableColor; pauseButton.ButtonColor = disableColor; resumeButton.ButtonColor = disableColor; if (bgmPlayer.Status == BgmStatus.Stopped) { playButton.ButtonColor = enableColor; } else if (bgmPlayer.Status == BgmStatus.Playing) { stopButton.ButtonColor = enableColor; pauseButton.ButtonColor = enableColor; } else if (bgmPlayer.Status == BgmStatus.Paused) { stopButton.ButtonColor = enableColor; resumeButton.ButtonColor = enableColor; } List <TouchData> touchDataList = Touch.GetData(0); if (playButton.ButtonColor == enableColor && playButton.TouchDown(touchDataList)) { bgmPlayer.Play(); } if (stopButton.ButtonColor == enableColor && stopButton.TouchDown(touchDataList)) { bgmPlayer.Stop(); } if (pauseButton.ButtonColor == enableColor && pauseButton.TouchDown(touchDataList)) { bgmPlayer.Pause(); } if (resumeButton.ButtonColor == enableColor && resumeButton.TouchDown(touchDataList)) { bgmPlayer.Resume(); } volumeSlider.Update(touchDataList); bgmPlayer.Volume = volumeSlider.Rate; return(true); }
public static bool Update() { List <TouchData> touchDataList = Touch.GetData(0); if (browserButton.TouchDown(touchDataList)) { Shell.Action action = Shell.Action.BrowserAction("http://www.playstation.com/pss/developer/"); Shell.Execute(ref action); return(true); } return(true); }
public void Update(List <TouchData> touchDataList) { if (playButton.TouchDown(touchDataList)) { soundPlayer.Play(); } if (stopButton.TouchDown(touchDataList)) { soundPlayer.Stop(); } volumeSlider.Update(touchDataList); soundPlayer.Volume = volumeSlider.Rate; }
public static bool Update() { List <TouchData> touchDataList = Touch.GetData(0); switch (connectState) { case ConnectState.None: if (connectButton.TouchDown(touchDataList)) { connectState = ConnectState.Ready; if (httpText != null) { httpText.Dispose(); } connectButton.ButtonColor = 0xff7f7f7f; } break; case ConnectState.Ready: connectHttpTest("http://www.scei.co.jp/index_e.html"); break; case ConnectState.Success: connectButton.ButtonColor = 0xffffffff; if (readStream != null) { httpText = createTextSprite(readStream.ToArray(), statusCode, contentLength); readStream.Dispose(); readStream = null; readBuffer = null; } connectState = ConnectState.None; break; case ConnectState.Failed: httpText = createTextSprite(null, statusCode, contentLength); connectState = ConnectState.None; break; } return(true); }
public static bool Update() { List <TouchData> touchDataList = Touch.GetData(0); if (pasteButton.TouchDown(touchDataList)) { copyTextButton.Label = Clipboard.GetText(); } if (copyButton.TouchDown(touchDataList)) { Clipboard.SetText(inputTextButton.Label); } if (inputTextButton.TouchDown(touchDataList)) { if (dialog == null) { dialog = new TextInputDialog(); dialog.Text = inputTextButton.Label; dialog.Open(); } return(true); } if (dialog != null) { if (dialog.State == CommonDialogState.Finished) { if (dialog.Result == CommonDialogResult.OK) { inputTextButton.Label = dialog.Text; } dialog.Dispose(); dialog = null; } } return(true); }
public static bool Render() { graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f); graphics.Clear(); serverButton.SetText(tcpServer.buttonString); clientButton.SetText(tcpClient.buttonString); List <TouchData> touchDataList = Touch.GetData(0); // Modify status if (serverButton.TouchDown(touchDataList)) { tcpServer.ChangeStatus(); } if (clientButton.TouchDown(touchDataList)) { tcpClient.ChangeStatus(); } /* * uint[] colorTable = {0xffff0000, * 0xff00ff00, * 0xff0000ff, * 0xffffff00}; */ foreach (var touchData in touchDataList) { /* * if (touchData.Status == TouchStatus.Down || * touchData.Status == TouchStatus.Move) { * * int pointX = (int)((touchData.X + 0.5f) * Graphics2D.Width); * int pointY = (int)((touchData.Y + 0.5f) * Graphics2D.Height); * int radius = (int)(touchData.Force * 32); * int colorId = touchData.ID % colorTable.Length; * * Graphics2D.FillCircle(colorTable[colorId], pointX, pointY, radius); * * } */ if (touchData.Status == TouchStatus.Down) { int pointX = (int)((touchData.X + 0.5f) * SampleDraw.Width); int pointY = (int)((touchData.Y + 0.5f) * SampleDraw.Height); if (pointX < (SampleDraw.Width / 2)) { tcpServer.SetMyPosition(pointX, pointY); } else { tcpClient.SetMyPosition(pointX - (SampleDraw.Width / 2), pointY); } } } // Display button and status serverButton.Draw(); clientButton.Draw(); drawStatus(tcpServer); drawStatus(tcpClient); SampleDraw.DrawText("Network Sample", 0xffffffff, 0, 0); graphics.SwapBuffers(); return(true); }
// check objects change state, private static bool CheckChangeState() { bool changeState = false; List <TouchData> touchDataList = Touch.GetData(0); // button. if (button0.TouchDown(touchDataList)) { if (true == System.IO.File.Exists(@SAVE_FILE)) { using (System.IO.FileStream hStream = System.IO.File.Open(@SAVE_FILE, FileMode.Open)) { if (hStream != null) { long size = hStream.Length; inputData = new byte[size]; hStream.Read(inputData, 0, (int)size); inputDataSize = (int)size; string label = System.Text.Encoding.Unicode.GetString(inputData); inputTextButton.SetText(label); hStream.Close(); eventAction = EVENT_LOAD; } } } } else if (button1.TouchDown(touchDataList)) { if (inputDataSize > 0) { using (System.IO.FileStream hStream = System.IO.File.Open(@SAVE_FILE, FileMode.Create)) { hStream.SetLength((int)inputDataSize); hStream.Write(inputData, 0, (int)inputDataSize); hStream.Close(); isFileExist = true; eventAction = EVENT_WRITE; } } } else if (button2.TouchDown(touchDataList)) { if (true == System.IO.File.Exists(@SAVE_FILE)) { System.IO.File.Delete(@SAVE_FILE); inputTextButton.SetText(" "); inputDataSize = 0; inputData = null; isFileExist = false; eventAction = EVENT_DELETE; } } // input dialog. if (inputTextButton.TouchDown(touchDataList)) { if (dialog == null) { dialog = new TextInputDialog(); dialog.Text = inputTextButton.Label; dialog.Open(); } return(true); } if (dialog != null) { if (dialog.State == CommonDialogState.Finished) { if (dialog.Result == CommonDialogResult.OK) { string setLabelStr; int i; int len = dialog.Text.Length; if (len > MAX_INPUT_CHARACTOR) { len = MAX_INPUT_CHARACTOR; } setLabelStr = dialog.Text.Substring(0, len); inputTextButton.Label = setLabelStr; byte[] byteArray0 = System.Text.Encoding.Unicode.GetBytes(setLabelStr); inputData = new byte[byteArray0.Length]; for (i = 0; i < byteArray0.Length; i++) { inputData[i] = byteArray0[i]; } inputDataSize = byteArray0.Length; changeState = true; } dialog.Dispose(); dialog = null; } } return(changeState); }
// check objects change state, private static bool CheckChangeState() { bool changeState = false; List <TouchData> touchDataList = Touch.GetData(0); // button. if (button0.ButtonColor == DISABLE_COLOR && button0.TouchDown(touchDataList)) { button0.SetText(BUTTON_PRESS); button0.ButtonColor = ENABLE_COLOR; persistentMemoryData[STATE_ADDR_BUTTON0] = 1; changeState = true; } else if (button0.ButtonColor == ENABLE_COLOR && button0.TouchDown(touchDataList)) { button0.SetText(BUTTON_RELEASE); button0.ButtonColor = DISABLE_COLOR; persistentMemoryData[STATE_ADDR_BUTTON0] = 0; changeState = true; } if (button1.ButtonColor == DISABLE_COLOR && button1.TouchDown(touchDataList)) { button1.SetText(BUTTON_PRESS); button1.ButtonColor = ENABLE_COLOR; persistentMemoryData[STATE_ADDR_BUTTON1] = 1; changeState = true; } else if (button1.ButtonColor == ENABLE_COLOR && button1.TouchDown(touchDataList)) { button1.SetText(BUTTON_RELEASE); button1.ButtonColor = DISABLE_COLOR; persistentMemoryData[STATE_ADDR_BUTTON1] = 0; changeState = true; } if (button2.ButtonColor == DISABLE_COLOR && button2.TouchDown(touchDataList)) { button2.SetText(BUTTON_PRESS); button2.ButtonColor = ENABLE_COLOR; persistentMemoryData[STATE_ADDR_BUTTON2] = 1; changeState = true; } else if (button2.ButtonColor == ENABLE_COLOR && button2.TouchDown(touchDataList)) { button2.SetText(BUTTON_RELEASE); button2.ButtonColor = DISABLE_COLOR; persistentMemoryData[STATE_ADDR_BUTTON2] = 0; changeState = true; } if (button3.ButtonColor == DISABLE_COLOR && button3.TouchDown(touchDataList)) { button3.SetText(BUTTON_PRESS); button3.ButtonColor = ENABLE_COLOR; persistentMemoryData[STATE_ADDR_BUTTON3] = 1; changeState = true; } else if (button3.ButtonColor == ENABLE_COLOR && button3.TouchDown(touchDataList)) { button3.SetText(BUTTON_RELEASE); button3.ButtonColor = DISABLE_COLOR; persistentMemoryData[STATE_ADDR_BUTTON3] = 0; changeState = true; } // slider. slider.Update(touchDataList); float curRate = slider.Rate; if (curRate != oldRate) { byte[] byteArray; byteArray = BitConverter.GetBytes(curRate); for (int i = 0; i < byteArray.Length; i++) { persistentMemoryData[STATE_ADDR_SLIDER + i] = byteArray[i]; } oldRate = curRate; changeState = true; } // input dialog. if (inputTextButton.TouchDown(touchDataList)) { if (dialog == null) { dialog = new TextInputDialog(); dialog.Text = inputTextButton.Label; dialog.Open(); } return(true); } if (dialog != null) { if (dialog.State == CommonDialogState.Finished) { if (dialog.Result == CommonDialogResult.OK) { string setLabelStr; int i; int len = dialog.Text.Length; if (len > MAX_INPUT_CHARACTOR) { len = MAX_INPUT_CHARACTOR; } setLabelStr = dialog.Text.Substring(0, len); inputTextButton.Label = setLabelStr; byte[] byteArray0 = System.Text.Encoding.Unicode.GetBytes(setLabelStr); for (i = 0; i < byteArray0.Length; i++) { persistentMemoryData[STATE_ADDR_STRING + i] = byteArray0[i]; } byte[] byteArray1 = BitConverter.GetBytes(len); for (i = 0; i < byteArray1.Length; i++) { persistentMemoryData[STATE_ADDR_STRING_NO + i] = byteArray1[i]; } changeState = true; } dialog.Dispose(); dialog = null; } } return(changeState); }