【3D技术宅公社】XR数字艺术论坛  XR技术讨论 XR互动电影 定格动画

 找回密码
 立即注册

QQ登录

只需一步,快速开始

调查问卷
论坛即将给大家带来全新的技术服务,面向三围图形学、游戏、动画的全新服务论坛升级为UTF8版本后,中文用户名和用户密码中有中文的都无法登陆,请发邮件到324007255(at)QQ.com联系手动修改密码

3D技术论坛将以计算机图形学为核心,面向教育 推出国内的三维教育引擎该项目在持续研发当中,感谢大家的关注。

查看: 2649|回复: 3

[转帖]DirectX Sample分析:Framework中的控件事件绑定(一)

[复制链接]
发表于 2005-3-27 22:49:34 | 显示全部楼层 |阅读模式
作者:Junhot 更新时间:2004-12-15 ------------------------------------------------------------------------------- 总的流程描述图:

从具体控件看起,以鼠标点击Button控件的事件为例,Button控件代码包含在dxmutgui.cs文件中:

Button的Click事件的原型:

在Button中声明了如下的事件Click及事件触发方法RaiseClickEvent Event code#region Event code public event EventHandler Click; /**//// <summary>Create new button instance</summary> protected void RaiseClickEvent(Button sender, bool wasTriggeredByUser) { // Discard events triggered programatically if these types of events haven't been // enabled if (!Parent.IsUsingNonUserEvents && !wasTriggeredByUser) return; if (Click != null) Click(sender, EventArgs.Empty); } #endregion Button内部如何触发Click事件:

HandleMouse这个方法调用RaiseClickEvent方法从而导致Click事件的触发,另外还有如HandleKeyboard方法等,同样也是事件触发的方法之一。

 楼主| 发表于 2005-3-27 22:51:23 | 显示全部楼层
/**//// <summary> /// Handle mouse messages from the buttons /// </summary> public override bool HandleMouse(NativeMethods.WindowMessage msg, System.Drawing.Point pt, IntPtr wParam, IntPtr lParam) { if (!IsEnabled || !IsVisible) return false; switch(msg) { case NativeMethods.WindowMessage.LeftButtonDoubleClick: case NativeMethods.WindowMessage.LeftButtonDown: { if (ContainsPoint(pt)) { // Pressed while inside the control isPressed = true; NativeMethods.SetCapture(Parent.SampleFramework.Window); if (!hasFocus) Dialog.RequestFocus(this); return true; } } break; case NativeMethods.WindowMessage.LeftButtonUp: { if (isPressed) { isPressed = false; NativeMethods.ReleaseCapture(); if (!parentDialog.IsUsingKeyboardInput) Dialog.ClearFocus(); // Button click if (ContainsPoint(pt)) RaiseClickEvent(this, true); } } break; } return false; }

控件如何知道何时该触发Click事件:

 楼主| 发表于 2005-3-27 22:51:34 | 显示全部楼层

在Dialog类中(Dialog类代码同样包含在dxmutgui.cs中)通过MessageProc捕获WindowMessage,然后调用Control的HandleKeyboard或者HandleMouse方法,下面是调用HandleMouse方法的代码:

// Mouse messages case NativeMethods.WindowMessage.MouseMove: case NativeMethods.WindowMessage.MouseWheel: case NativeMethods.WindowMessage.LeftButtonUp: case NativeMethods.WindowMessage.LeftButtonDown: case NativeMethods.WindowMessage.LeftButtonDoubleClick: case NativeMethods.WindowMessage.RightButtonUp: case NativeMethods.WindowMessage.RightButtonDown: case NativeMethods.WindowMessage.RightButtonDoubleClick: case NativeMethods.WindowMessage.MiddleButtonUp: case NativeMethods.WindowMessage.MiddleButtonDown: case NativeMethods.WindowMessage.MiddleButtonDoubleClick: case NativeMethods.WindowMessage.XButtonUp: case NativeMethods.WindowMessage.XButtonDown: case NativeMethods.WindowMessage.XButtonDoubleClick: { // If not accepting mouse input, return false to indicate the message should still // be handled by the application (usually to move the camera). if (!usingMouseInput) return false; // Current mouse position short mouseX = NativeMethods.LoWord((uint)lParam.ToInt32()); short mouseY = NativeMethods.HiWord((uint)lParam.ToInt32()); System.Drawing.Point mousePoint = new System.Drawing.Point(mouseX, mouseY); // Offset mouse point mousePoint.X -= dialogX; mousePoint.Y -= dialogY; // If caption is enabled, offset the Y coordinate by the negative of its height. if (hasCaption) mousePoint.Y -= captionHeight; // If a control is in focus, it belongs to this dialog, and it's enabled, then give // it the first chance at handling the message. if (controlFocus != null && controlFocus.Parent == this && controlFocus.IsEnabled) { // If the control MsgProc handles it, then we don't. if (controlFocus.HandleMouse(msg, mousePoint, wParam, lParam)) return true; } // Not yet handled, see if the mouse is over any controls Control control = GetControlAtPoint(mousePoint); if ((control != null) && (control.IsEnabled)) { // Let the control handle the mouse if it wants (and return true if it handles it) if (control.HandleMouse(msg, mousePoint, wParam, lParam)) return true; } else { // Mouse not over any controls in this dialog, if there was a control // which had focus it just lost it if (msg == NativeMethods.WindowMessage.LeftButtonDown && controlFocus != null && controlFocus.Parent == this) { controlFocus.OnFocusOut(); controlFocus = null; } }
发表于 2005-11-17 18:46:46 | 显示全部楼层

动画剧本小结- -
                                      

 

1.  故事情节的简化。动画短片不像故事片,剧本不要求很多情节分支和由故事内容本身和复杂人物关系为依托的人物形象丰满,主要突出镜头语言的巧妙和动画片自身的特有元素,有趣,精致为佳。

2.  剧本在人物动作设计上的细节化。因为人物夸张生动的肢体语言是动画最突出的特点,所以在动作设计的时候要考虑到人物性格的表现和故事氛围的烘托,这样使得简短的动画能包含更多的元素。

3.  故事整体中的经典画面和细节高潮的构思。在短短几分钟的片子里,要给人留下深刻印象并使别人能接受自己的风格,就一定要有能代表全片风格的经典画面(形式感)和细节高潮,这些将是在作品进入制作阶段后将着力解决的问题。

4.  借鉴,一些元素可以大胆借鉴其他动画片和影片中的成功范例,技术上更是如此。

5.  考虑剧本的可实现性。最后一点,也是最重要的一点,因为无论有多么好的创意,多么巧妙的构思,如果在规定创作时间内没有办法完成全片的制作,那么一切的努力就是白费。这里所讲的可实现性,包括个人创作能力是否能达到自己所预想的艺术效果,技术方面的支持,甚至是硬件,软件和时间效率方面的。

这就要求,在作前期工作的时候设定剧本的方方面面都要在自己所能掌控的范围之内。尽量细化每个部分然后再逐一解决。

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|3D数字艺术论坛 ( 沪ICP备14023054号 )

GMT+8, 2025-2-6 04:46

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表