void SendHandlerOnTouchEvent(UITouch touch, UIView view, MotionEvent motion) { CGPoint point = touch.LocationInView(view); DebugLogViewer.WriteLine(string.Format(" Id[{0}] / Pos[{1}] / Motion[{2}]", touch.Handle, point, motion)); m_TouchHandler.OnTouchEvent(touch.Handle, (float)point.X, (float)point.Y, motion); }
/// <summary> /// Subview のレイアウト時のコールバック /// /// SafeArea 周りのパラメータがこのタイミングで取得出来るようになるので /// ViewDidLoad() で行なっていた処理を移動 /// </summary> public override void ViewWillLayoutSubviews() { DebugLogViewer.WriteLine("ViewWillLayoutSubviews()"); base.ViewWillLayoutSubviews(); #endif m_Context = new EAGLContext(EAGLRenderingAPI.OpenGLES2); if (m_Context == null) { DebugLogViewer.WriteLine("Failed to create ES context"); } var view = (GLKView)View; view.Context = m_Context; view.DrawableColorFormat = GLKViewDrawableColorFormat.RGBA8888; view.DrawableDepthFormat = GLKViewDrawableDepthFormat.Format24; // フレームバッファがバインドされていないので、 // フレームバッファ関連のOpenGL関数を使うにはこの方法で事前にバインドしておく view.BindDrawable(); DebugLogViewer.WriteLine(string.Format("View.Drawable ({0}, {1})", view.DrawableWidth, view.DrawableHeight)); DebugLogViewer.WriteLine(string.Format("view.Bounds {0}", view.Bounds)); SetupGL(); m_Activity = new GLGameTest(); m_Activity.OnSurfaceCreated(view); RegisterTouchEvent(m_Activity); }
public override void Dispose() { DebugLogViewer.WriteLine("Dispose"); //GL.DeleteBuffers(1, ref vertexBuffer); //GL.Oes.DeleteVertexArrays(1, ref vertexArray); }
public override void Resume() { DebugLogViewer.WriteLine("Resume"); GL.ClearColor(0.7f, 0.83f, 0.86f, 1f); // ライトを設定 float lightAngle = 45.0f; Vector3 lightDir = new Vector3((float)Math.Cos((float)lightAngle), -1.0f, (float)Math.Sin((float)lightAngle)); lightDir.Normalize(); GL.Uniform3(GL.GetUniformLocation(m_ProgramParam.GLProgram.Program, "lightDirection"), lightDir); // カメラを設定 m_Camera.CreateViewportMatrix(); Matrix4 viewProjectionMatrix = m_Camera.ViewProjectionMatrix; GL.UniformMatrix4(GL.GetUniformLocation(m_ProgramParam.GLProgram.Program, "viewProjection"), false, ref viewProjectionMatrix); m_Texture = new Texture(m_Game, "Images/AnimationSample.png"); m_RegionUL = new TextureRegion(m_Texture, 0, 0, 64, 64); m_TextureAnimation = new Texture(m_Game, "Images/AnimationSample.png"); m_Animation = new Animation(0.2f, new TextureRegion[] { new TextureRegion(m_TextureAnimation, 0, 0, 64, 64), new TextureRegion(m_TextureAnimation, 64, 0, 64, 64), new TextureRegion(m_TextureAnimation, 128, 0, 64, 64), new TextureRegion(m_TextureAnimation, 192, 0, 64, 64), }); }
public override void TouchesEnded(NSSet touches, UIEvent evt) { base.TouchesEnded(touches, evt); DebugLogViewer.WriteLine(string.Format("TouchesEnded")); foreach (UITouch touch in touches.ToArray <UITouch>()) //foreach (UITouch touch in evt.AllTouches.ToArray<UITouch>()) { SendHandlerOnTouchEvent(touch, View, MotionEvent.ACTION_NONE); } }
public override void Update(float deltaTime) { //zoom = 0.75f; float zoomStep = (deltaTime / 10.0f); zoom += zoomStep * dir; if (zoom < 0.5f) { dir *= -1.0f; zoom = 0.5f + zoomStep; } else if (zoom > 1.0f) { dir *= -1.0f; zoom = 1.0f - zoomStep; } else { m_Camera.SetZoom(zoom); } // カメラを設定 m_Camera.CreateViewportMatrix(); Matrix4 viewProjectionMatrix = m_Camera.ViewProjectionMatrix; GL.UniformMatrix4(GL.GetUniformLocation(m_ProgramParam.GLProgram.Program, "viewProjection"), false, ref viewProjectionMatrix); m_AnimationSample.Update(deltaTime); List <TouchEvent> touchEvents = m_Game.GetInput().GetTouchEvents(); foreach (var touchEvent in touchEvents) { m_TouchPoint.X = touchEvent.X; m_TouchPoint.Y = touchEvent.Y; m_Camera.TouchToWorld(ref m_TouchPoint); DebugLogViewer.WriteLine(string.Format("[{0}] : ({1})", touchEvent.Type, m_TouchPoint)); if (DetectChecker.PointInRectangle(m_RectButtonStart, m_TouchPoint)) { DebugLogViewer.WriteLine(string.Format("Detect Start")); } if (DetectChecker.PointInRectangle(m_RectButtonEnd, m_TouchPoint)) { DebugLogViewer.WriteLine(string.Format("Detect End")); } } }
protected override void Dispose(bool disposing) { DebugLogViewer.WriteLine("Dispose() : " + disposing); base.Dispose(disposing); TearDownGL(); if (EAGLContext.CurrentContext == m_Context) { EAGLContext.SetCurrentContext(null); } }
public override void Resume() { DebugLogViewer.WriteLine("Resume"); GL.ClearColor(0.7f, 0.83f, 0.86f, 1f); // ライトを設定 float lightAngle = 45.0f; Vector3 lightDir = new Vector3((float)Math.Cos((float)lightAngle), -1.0f, (float)Math.Sin((float)lightAngle)); lightDir.Normalize(); GL.Uniform3(GL.GetUniformLocation(m_ProgramParam.GLProgram.Program, "lightDirection"), lightDir); #if false // カメラを設定 m_Camera.CreateViewportMatrix(); Matrix4 viewProjectionMatrix = m_Camera.ViewProjectionMatrix; GL.UniformMatrix4(GL.GetUniformLocation(m_ProgramParam.GLProgram.Program, "viewProjection"), false, ref viewProjectionMatrix); #else //// カメラを設定 //m_Camera.CreateViewportMatrix(); //Matrix4 viewProjectionMatrix = m_Camera.ViewProjectionMatrix; //GL.UniformMatrix4(GL.GetUniformLocation(m_ProgramParam.GLProgram.Program, "viewProjection"), //false, ref viewProjectionMatrix); #endif m_Texture = new Texture(m_Game, "Images/AnimationSample.png"); m_RegionUL = new TextureRegion(m_Texture, 0, 0, 64, 64); m_TextureAnimation = new Texture(m_Game, "Images/AnimationSample.png"); m_Animation = new Animation(0.2f, new TextureRegion[] { new TextureRegion(m_TextureAnimation, 0, 0, 64, 64), new TextureRegion(m_TextureAnimation, 64, 0, 64, 64), new TextureRegion(m_TextureAnimation, 128, 0, 64, 64), new TextureRegion(m_TextureAnimation, 192, 0, 64, 64), }); m_UIAtlas = new Texture(m_Game, "Images/ui_sample.png"); m_RgnButtonBase = new TextureRegion(m_UIAtlas, 0, 0, 128, 32); m_RgnButtonStart = new TextureRegion(m_UIAtlas, 128, 0, 128, 32); m_RgnButtonEnd = new TextureRegion(m_UIAtlas, 128, 32, 128, 32); Vector2 center = new Vector2(FRUSTRUM_WIDTH / 2.0f, FRUSTRUM_HEIGHT / 2.0f); float width = 256.0f; m_RectButtonStart = new CGRect((center.X - (width / 2.0f)), 860, 256.0f, 64.0f); m_RectButtonEnd = new CGRect((center.X - (width / 2.0f)), 960, 256.0f, 64.0f); }
public override void ViewDidLoad() { DebugLogViewer.WriteLine("ViewDidLoad()"); base.ViewDidLoad();
public override void Pause() { DebugLogViewer.WriteLine("Pause"); }
public override void Update(float deltaTime) { var d = CFunctions.clib_add_internal(1, 2); DebugLogViewer.WriteLine("=== d = " + d); }
public override void Resume() { DebugLogViewer.WriteLine("Resume"); GL.ClearColor(0.7f, 0.83f, 0.86f, 1f); }
public override void Dispose() { DebugLogViewer.WriteLine("Dispose"); }