📄 wg__message_8cpp-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>wg_message.cpp Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> </center><hr><h1>wg_message.cpp</h1><div class="fragment"><pre>00001 <span class="comment">// wg_message.cpp</span>00002 <span class="comment">//</span>00003 <span class="comment">// CMessage class implementation</span>00004 <span class="comment">//</span>00005 <span class="comment">//</span>00006 <span class="comment">// Copyright (c) 2002 Rob Wiskow</span>00007 <span class="comment">// rob-dev@boxedchaos.com</span>00008 <span class="comment">//</span>00009 <span class="comment">// This library is free software; you can redistribute it and/or</span>00010 <span class="comment">// modify it under the terms of the GNU Lesser General Public</span>00011 <span class="comment">// License as published by the Free Software Foundation; either</span>00012 <span class="comment">// version 2.1 of the License, or (at your option) any later version.</span>00013 <span class="comment">//</span>00014 <span class="comment">// This library is distributed in the hope that it will be useful,</span>00015 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span>00016 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>00017 <span class="comment">// Lesser General Public License for more details.</span>00018 <span class="comment">//</span>00019 <span class="comment">// You should have received a copy of the GNU Lesser General Public</span>00020 <span class="comment">// License along with this library; if not, write to the Free Software</span>00021 <span class="comment">// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>00022 <span class="comment">//</span>00023 00024 00025 <span class="preprocessor">#include "wgui_include_config.h"</span>00026 <span class="preprocessor">#include "wg_message.h"</span>00027 00028 00029 <span class="keyword">namespace </span>wGui00030 {00031 <a name="l00032"></a><a class="code" href="classwGui_1_1CMessage.html#a0">00032</a> CMessage::CMessage(<span class="keyword">const</span> EMessageType MessageType, <span class="keyword">const</span> <a class="code" href="classwGui_1_1CMessageClient.html">CMessageClient</a>* pDestination, <span class="keyword">const</span> <a class="code" href="classwGui_1_1CMessageClient.html">CMessageClient</a>* pSource) :00033 m_MessageType(MessageType),00034 m_pDestination(pDestination),00035 m_pSource(pSource)00036 {00037 00038 }00039 00040 <a name="l00041"></a><a class="code" href="classwGui_1_1CKeyboardMessage.html#a0">00041</a> CKeyboardMessage::CKeyboardMessage(<span class="keyword">const</span> EMessageType MessageType, <span class="keyword">const</span> <a class="code" href="classwGui_1_1CMessageClient.html">CMessageClient</a>* pDestination, <span class="keyword">const</span> <a class="code" href="classwGui_1_1CMessageClient.html">CMessageClient</a>* pSource,00042 <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> ScanCode, SDLMod Modifiers, SDLKey Key, Uint16 Unicode) :00043 <a class="code" href="classwGui_1_1CMessage.html">CMessage</a>(MessageType, pDestination, pSource),00044 ScanCode(ScanCode),00045 Modifiers(Modifiers),00046 Key(Key),00047 Unicode(Unicode)00048 {00049 00050 }00051 00052 <a name="l00053"></a><a class="code" href="classwGui_1_1CMouseMessage.html#a0">00053</a> CMouseMessage::CMouseMessage(<span class="keyword">const</span> EMessageType MessageType, <span class="keyword">const</span> <a class="code" href="classwGui_1_1CMessageClient.html">CMessageClient</a>* pDestination, <span class="keyword">const</span> <a class="code" href="classwGui_1_1CMessageClient.html">CMessageClient</a>* pSource,00054 <a class="code" href="classwGui_1_1CPoint.html">CPoint</a> Point, <a class="code" href="classwGui_1_1CPoint.html">CPoint</a> Relative, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Button) :00055 <a class="code" href="classwGui_1_1CMessage.html">CMessage</a>(MessageType, pDestination, pSource),00056 Point(Point),00057 Relative(Relative),00058 Button(Button)00059 {00060 00061 }00062 00063 <a name="l00064"></a><a class="code" href="classwGui_1_1CMouseMessage.html#d0">00064</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> CMouseMessage::TranslateSDLButton(Uint8 SDLButton)00065 {00066 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classwGui_1_1CMouseMessage.html#m2">Button</a> = 0;00067 <span class="keywordflow">switch</span> (SDLButton)00068 {00069 <span class="keywordflow">case</span> SDL_BUTTON_LEFT:00070 <a class="code" href="classwGui_1_1CMouseMessage.html#m2">Button</a> = <a class="code" href="classwGui_1_1CMouseMessage.html#s6s1">LEFT</a>;00071 <span class="keywordflow">break</span>;00072 <span class="keywordflow">case</span> SDL_BUTTON_RIGHT:00073 <a class="code" href="classwGui_1_1CMouseMessage.html#m2">Button</a> = <a class="code" href="classwGui_1_1CMouseMessage.html#s6s2">RIGHT</a>;00074 <span class="keywordflow">break</span>;00075 <span class="keywordflow">case</span> SDL_BUTTON_MIDDLE:00076 <a class="code" href="classwGui_1_1CMouseMessage.html#m2">Button</a> = <a class="code" href="classwGui_1_1CMouseMessage.html#s6s3">MIDDLE</a>;00077 <span class="keywordflow">break</span>;00078 <span class="keywordflow">case</span> SDL_BUTTON_WHEELUP:00079 <a class="code" href="classwGui_1_1CMouseMessage.html#m2">Button</a> = <a class="code" href="classwGui_1_1CMouseMessage.html#s6s4">WHEELUP</a>;00080 <span class="keywordflow">break</span>;00081 <span class="keywordflow">case</span> SDL_BUTTON_WHEELDOWN:00082 <a class="code" href="classwGui_1_1CMouseMessage.html#m2">Button</a> = <a class="code" href="classwGui_1_1CMouseMessage.html#s6s5">WHEELDOWN</a>;00083 <span class="keywordflow">break</span>;00084 }00085 00086 <span class="keywordflow">return</span> <a class="code" href="classwGui_1_1CMouseMessage.html#m2">Button</a>;00087 }00088 00089 <a name="l00090"></a><a class="code" href="classwGui_1_1CMouseMessage.html#d1">00090</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> CMouseMessage::TranslateSDLButtonState(Uint8 SDLButtonState)00091 {00092 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classwGui_1_1CMouseMessage.html#m2">Button</a> = 0;00093 <span class="keywordflow">if</span> (SDLButtonState & SDL_BUTTON(1))00094 {00095 <a class="code" href="classwGui_1_1CMouseMessage.html#m2">Button</a> &= <a class="code" href="classwGui_1_1CMouseMessage.html#s6s1">LEFT</a>;00096 }00097 <span class="keywordflow">if</span> (SDLButtonState & SDL_BUTTON(2))00098 {00099 <a class="code" href="classwGui_1_1CMouseMessage.html#m2">Button</a> &= <a class="code" href="classwGui_1_1CMouseMessage.html#s6s2">RIGHT</a>;00100 }00101 <span class="keywordflow">if</span> (SDLButtonState & SDL_BUTTON(3))00102 {00103 <a class="code" href="classwGui_1_1CMouseMessage.html#m2">Button</a> &= <a class="code" href="classwGui_1_1CMouseMessage.html#s6s3">MIDDLE</a>;00104 }00105 <span class="keywordflow">if</span> (SDLButtonState & SDL_BUTTON(4))00106 {00107 <a class="code" href="classwGui_1_1CMouseMessage.html#m2">Button</a> &= <a class="code" href="classwGui_1_1CMouseMessage.html#s6s4">WHEELUP</a>;00108 }00109 <span class="keywordflow">if</span> (SDLButtonState & SDL_BUTTON(5))00110 {00111 <a class="code" href="classwGui_1_1CMouseMessage.html#m2">Button</a> &= <a class="code" href="classwGui_1_1CMouseMessage.html#s6s5">WHEELDOWN</a>;00112 }00113 00114 <span class="keywordflow">return</span> <a class="code" href="classwGui_1_1CMouseMessage.html#m2">Button</a>;00115 }00116 00117 00118 }00119 00120 </pre></div><hr><address style="align: right;"><small>Generated on Sat Oct 25 12:43:23 2003 for wGui by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -