这一节我将讲解vgui的基础系统部分,也是该库提供给外部使用的一些重要接口。作为UI部分比较重要的部分,该节有着至关重要的部分,如果没有看到上一节内容,请留意下面的连接。我们现在可以猜想一下在客户端UI部分,要设计到哪些东西呢?首先UI的大部分操作便是窗口的显示,那么窗口中又有哪些元素呢?链接、文字……

CODE

/**
* PAP Engine ( -- )
* $Id system.h
* @link -- for the canonical source repository
* @copyright Copyright (c) 2013-2014 viticm( viticm@126.com )
* @license
* @user viticm<viticm@126.com/viticm.ti@gmail.com>
* @date 2014-3-26 11:26:48
* @uses vgui base system
*/
#ifndef VGUI_BASE_SYSTEM_H_
#define VGUI_BASE_SYSTEM_H_ #include <OgreRoot.h>
#include <imm.h>
#include "CEGUIString.h"
#include "vengine/ui/system.h"
#include "vgui/config.h" /** ogre and cegui { **/ namespace Ogre {
class Root;
}; //namespace Ogre namespace CEGUI {
class System;
class OgreCEGUIRenderer;
class FalagardActionButton;
class EventArgs;
class Window;
}; //namespace CEGUI namespace vgui_script {
class Base;
}; //namespace vgui_script /** }ogre and cegui **/ namespace vgui_window {
class Manager;
}; //namespace vgui_base namespace vgui_icon {
class Manager;
}; //namespace vgui_icon namespace vgui_string {
class System;
}; //namespace vgui_string namespace vgui_creature { namespace head_board {
class System;
}; //namespace head_board }; //namespace vgui_creature namespace vgui_base { class System : public vengine_ui::System { VENGINE_KERNEL_DECLARE_DYNAMIC(vgui_base_System); public:
System();
virtual ~System();
static System* getself(); public: //implement from abstract class
virtual void on_windowsize_change(uint32_t message,
WPARAM wparam,
LPARAM lparam); //窗口大小改变事件
virtual void injectinput(); //如果事件结果为true则获取了输入
virtual bool messageprocess(HWND hwnd,
uint32_t message,
WPARAM wparam,
LPARAM lparam); //文字输入消息
virtual bool is_mousehover(); //鼠标是否在UI上空
//鼠标是否在聊天板上空
virtual bool is_mousehover_chatboard(int64_t x, int64_t y);
//获得聊天信息里的超链接信息
virtual STRING get_chatboard_hyplink_content(int64_t x, int64_t y);
//创建一个新的角色信息板
virtual vengine_ui::CreatureHeadBoard* create_creature_headboard();
//添加一个新的被击中信息框
virtual void add_behit_board(bool _double,
const char* info,
float startx,
float starty,
uint8_t type,
uint8_t movetype);
virtual bool is_windowshow(const char* name,
const char* childname = NULL);
virtual bool close_allwindow();
//通知UI创建一组UI显示模型
virtual void fakeobject_show(const char* windowname, const char* name);
//知UI销毁一组UI显示模型
virtual void fakeobject_destroy(const char* windowname,
const char* name); //debugs
public:
virtual void debug_push_chatstring(const char* name,
const char* message);
virtual void debug_save_fonttexture(); public:
virtual void change_dragflag(bool flag);
virtual bool is_dragend(); public:
//逻辑层添加系统通知信息
virtual STRING parsestring_varparam(const char* id, ...);
virtual void parsestring_nocolor(const STRING& in,
STRING& out,
bool control = false);
virtual STRING parsestring_nocolor_varparam(const char* id, ...);
virtual STRING parsestring_no_varparam(const char* id);
virtual STRING parsestring_nocolor_no_varparam(const char* id); //聊天模板字串的取得
virtual STRING get_talktemplate(const STRING& key, uint16_t index);
virtual STRING modify_chattemplate(const STRING& temp,
const STRING& talker,
const STRING& target);
virtual STRING get_talkrand_helpmessage(); //聊天随机提示消息
//查看当前获取输入的EditBox
virtual bool is_IME_editbox_active(const char* windowname);
virtual int32_t get_current_IMEstate(); //获取当前输入法状态
virtual STRING get_IME_editbox_string(const char* name); //获得输入内容 //传入一个物品信息
virtual bool inject_iteminfo(
vengine_game::ItemTransferSystem::element_t* element); virtual void on_pushescape();
virtual bool is_paopao_active();
virtual uint32_t lumination_ogrecolor(uint32_t ogrecolor,
int32_t lumination);
virtual int32_t ogrecolor_lumination(uint32_t ogrecolor); //过滤字符串中的非法敏感字符
virtual bool check_stringfilter(
const STRING& in,
const vengine_ui::filtertype_enum type = vengine_ui::kFilterTypeNone);
virtual bool check_stringcode(const STRING& in, STRING& out);
//完全匹配过滤
virtual bool check_string_fullcompare(const STRING& in,
const STRING& filtertype = "all",
bool use_alltable = true);
virtual STRING get_debugstring(); //取当前的鼠标下面的窗口
virtual void openwindow(const STRING& name);
virtual void closewindow(const STRING& name);
virtual void togglewindow(const STRING& name); virtual bool has_inputfocus(); //加聊天信息(提高显示聊天信息的效率)
virtual bool add_chathistory_message(int32_t id,
const char* windowname,
const char* message,
int32_t type = -,
uint32_t disappeartime = );
virtual void replacestring_usefilter(
const STRING& in,
STRING& out,
vengine_ui::filtertype_enum filtertype = vengine_ui::kFilterTypeChat);
virtual STRING check_stringvalid(const char* string);
virtual bool reload_windowscript(const STRING& windowname);
virtual void uirender_toggleshow(); public:
virtual void init(void*);
virtual void release();
virtual void tick(); public:
virtual bool is_ctrlinfo_enable();
virtual void set_ctrlinfo_enable(bool enable); public: //action buttons
vgui_icon::Manager* get_iconmanager();
//捕获拖动开始
bool handle_action_dragdrop_started(const CEGUI::EventArgs& event);
//鼠标进入,显示super tooltip
bool handle_actionbutton_mouseenter(const CEGUI::EventArgs& event);
//鼠标离开,隐藏super tooltip
bool handle_actionbutton_mouseleave(const CEGUI::EventArgs& event);
//父窗口关闭
bool handle_actionbutton_parenthidden(const CEGUI::EventArgs& event);
//mesh window开始显示
bool handle_meshwindow_shown(const CEGUI::EventArgs& event);
//mesh window隐藏
bool handle_meshwindow_hiden(const CEGUI::EventArgs& event); public: //超链接
bool handle_hyperlink_active(const CEGUI::EventArgs &event);
bool handle_hyperlink_leftactive(const CEGUI::EventArgs &event);
bool handle_hyperlink_rightactive(const CEGUI::EventArgs &event);
bool handle_hyperlink_inactive(const CEGUI::EventArgs &event); public:
//删除itemelement的通知相关
bool handle_elementdelete(const CEGUI::EventArgs &event);
//chat history 点击infoelement的通知
bool handle_chathistory_infoelement_click(const CEGUI::EventArgs& event);
//chat history 鼠标在infoelement的通知
bool handle_chathistory_infoelement_movein(const CEGUI::EventArgs& event);
bool handle_chathistory_infoelement_moveout(const CEGUI::EventArgs& event);
//click sound 对应按钮点击后播放声音
bool handle_pushbutton_clicksound(const CEGUI::EventArgs& event); protected:
Ogre::Root* ogreroot_;
CEGUI::System* cegui_system_;
CEGUI::OgreCEGUIRenderer* cegui_render_;
vgui_script::Base* script_;
vgui_window::Manager* windowmanager_;
vgui_icon::Manager* iconmanager_;
vgui_string::System* stringsystem_;
vgui_creature::head_board::System* creature_headboard_system_;
CEGUI::String buttonname_indragging_;
bool is_dragend_;
HCURSOR draggingcursor_;
bool active_paopao_;
bool is_ctrlinfo_enable_; //是否激活按住Ctrl键激活系统设置中所见所得功能
//是否用快捷键的设置,在游戏性设置部分 protected:
static System* self_; protected:
void on_dragbegin(CEGUI::FalagardActionButton* dranggingbutton_);
//拖动结束,targetbutton为目标button如果为空,则表示拖动到空白
void on_dragend(CEGUI::Window* targetwindow); }; }; //namespace vgui_base #endif //VGUI_BASE_SYSTEM_H_

解释

在讲述这里面的接口之前,我不得不吐槽一下园子了,最近发出的博文都无法正常进入首页了,里面就算不乏图文并茂的文章,其程度一直让博主觉得有些心灰意懒了。首先说发布博文的原因,那就是同大家交流与分享知识,没有太多别的目的。对于最近几天园子管理的调整,我也无心过问,但是我真心希望大家能够分享出一些能让大家进步的文章,也喜欢园子的管理能够发现这些文章并给予推广。

下面开始讲这部分的内容,最近在忙着写plain framework的参考手册,所以也就无暇来做之前的这些知识分享。而且客户端的部分,我觉得把这些重要接口展示给大家,大家如果能完全了解的话对于设计方面就已足够了,至于源码我会在讲解完这些接口后放出,所以大家不会担心。

基础系统提供了比较全面的UI操作接口,包括界面的显示与界面事件的控制。里面牵扯到几个重要的系统,包括OGRE、CEGUI、CEGUI RENDER、SCRIPT、窗口管理器、图标管理器、字符串管理器、角色面板管理器等等。

链接

最近在忙着整理plain framework框架的文档,但是文章被移出了首页,如果有兴趣的朋友不妨看看:http://www.cnblogs.com/lianyue/p/3972492.html

MMORPG大型游戏设计与开发(客户端架构 part2 of vgui)的更多相关文章

  1. MMORPG大型游戏设计与开发(客户端架构 part8 of vegine)

    脚本模块是游戏设计中争论比较多的话题,那是因为作为脚本本身所带来的利弊.其实这都无关紧要,取舍是人必须学会的一项技能,如果你不会取舍那么就让趋势给你一个满意的答复.自从魔兽世界以及传奇(世界)问世以来 ...

  2. MMORPG大型游戏设计与开发(概述)updated

    1.定义 MMORPG,是英文Massive(或Massively)Multiplayer Online Role-PlayingGame的缩写,即大型多人在线角色扮演游戏. 2.技术与知识 在这系列 ...

  3. MMORPG大型游戏设计与开发(UI SYSTEM SHOW)

    接下来一段时间,这些文件可能不再更新,期间我会学习和掌握一些前端知识.虽然我非常欣赏剑侠网络版叁和九阴真经的画面,但是那是一个庞大的游戏引擎,一般人是无法窥伺的,除非你是天才而且要拥有机器毫无中断的毅 ...

  4. MMORPG大型游戏设计与开发(服务器 游戏场景 核心详述)

    核心这个词来的是多么的高深,可能我们也因为这个字眼望而却步,也就很难去掌握这部分的知识.之所以将核心放在最前面讲解,也可以看出它真的很重要,希望朋友们不会错过这个一直以来让大家不熟悉的知识,同我一起进 ...

  5. MMORPG大型游戏设计与开发(游戏服务器 游戏场景 概述 updated)

    我们在玩游戏的时候,我们进入游戏后第一眼往往都是看到游戏世界中的场景,当然除了个别例外,因为那些游戏将游戏场景隐藏了起来,如文字游戏中的地点一样.既然我们接触了游戏世界的核心,那么作为核心的场景又包括 ...

  6. MMORPG大型游戏设计与开发(客户端架构 part12 of vegine)

    在游戏中的交互过程中输入是一个必不可少的过程,比如登陆的时候需要用户输入用户名与密码,就算是单机游戏很多时候也要求用户输入一个用户名作为存档的依据.网络游戏中没有了输入,只用鼠标来交互是不切实际的,因 ...

  7. MMORPG大型游戏设计与开发(客户端架构 part16 of vegine)

    由于近来比较忙碌和有些困倦的原因,所以关于这部分的文章没有及时更新,一句话:让朋友们久等了!今天所讲的是客户端vengine(微引擎)中最后一个部分,就像上节所说,这一部分的内容比较多.可能有些朋友看 ...

  8. MMORPG大型游戏设计与开发(客户端架构 part9 of vegine)

    时间在人们的生活中是多么重要的东西,如果打乱了时间,不知道这个时间会成什么样子.在客户端中,自然也有时间模块,因为不同的时间可能会处理不同的事情,特别是在追求高度自由化的同时,时间也成为了一个很重要的 ...

  9. MMORPG大型游戏设计与开发(客户端架构)

    首先为所有等待的朋友说一声歉意,实在让大家等的太久.客户端的设计本来就是一个大的工程,而且工作的关系,也没有太多时间在这方面做研究.不过在私下有空的时间,我还是继续着这方面的研究,很遗憾没有用期望的o ...

随机推荐

  1. jPList – 实现灵活排序和分页功能的 jQuery 插件

    jPList 是一个灵活的 jQuery 插件,可以用于任何 HTML 结构的排序,分页和筛选.它支持的数据源包括:PHP + MySQL,ASP.NET + SQL Server,PHP + SQL ...

  2. [js开源组件开发]network异步请求ajax的扩展

    network异步请求ajax的扩展 在日常的应用中,你可能直接调用$.ajax是会有些问题的,比如说用户的重复点击,比如说我只希望它成功提交一次后就不能再提交,比如说我希望有个正在提交的loadin ...

  3. 一行代码如何控制ipunt框里面值的长度

    <input  type="text"  id="你的id" maxlength="你想要的长度" onkeyup="thi ...

  4. [deviceone开发]-模仿Zaker的示例

    一.简介 这个示例模仿zaker这个App,主要的界面基本都完成,用到了各种deviceone提供的ui组件,比如GridView,ListView,ScrollView,ViewShower等等.初 ...

  5. CSS属性之float学习心得

    全文参考:http://www.linzenews.com/program/net/2331.html 我们来看看CSS重要属性--float. 以下内容分为如下小节: 1:float属性 2:flo ...

  6. 手把手系列:实现Nat地址转换

    1.实验目的: 掌握内网中的主机C1连接到Internet时,通过NAT实现私有全局地址转换.   2.实验拓扑: 3.实验步骤: 步骤一:给主机C1和C2配置IP地址.子网掩码和网关.如图: C1: ...

  7. 在ArcGIS中如何进行POI点抽稀

    对POI点添加权重等级类型信息.例如添加短整形字段Weight,并根据业务逻辑设置不同种类的POI的权重值,如分5类,0代表重要性最低的POI,4代表重要性最高. 在ArcMap的标注管理栏中,设置使 ...

  8. Atitit.木马病毒强制强行关闭360 360tray.exe的方法

    Atitit.木马病毒强制强行关闭360 360tray.exe的方法 1. taskkill /im 进程名称1 2. 用 wmic process where name="进程名称&qu ...

  9. OS X EI Capitan 系统 安装cocoapod

    没有废话直接上步骤    (哪一步卡住了 多试几次 可能是网络不好的缘故) 1. 首先安装 home-brew   以下方法转自:http://www.cnblogs.com/lzrabbit/p/4 ...

  10. -[UIViewController _loadViewFromNibNamed:bundle:]

    *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewC ...