socketref,再见!高德

https://github.com/adoggie

  C++博客 :: 首页 :: 联系 :: 聚合  :: 管理
  246 Posts :: 4 Stories :: 312 Comments :: 0 Trackbacks

常用链接

留言簿(54)

我参与的团队

搜索

  •  

最新评论

阅读排行榜

评论排行榜

#


2008-05-13
开始看opengl,利用 opengl es 在 wince5.0环境做些应用测试
opengl没有啥经验,之前只对 2D的一些图形算法有些研究,所以慢慢来吧
nehe的opengl 基础教程还可以,说学就开始学




posted @ 2008-05-13 01:01 放屁阿狗 阅读(2464) | 评论 (1)编辑 收藏


2008-05-13 已经完成移植的模块:

CEGUIBase
CEGUIExpatParser
CEGUIFalagardWRBase
CEGUILua
tolua++

移植OpenGLGUIRenderer
render 选择opengl es,可是在编译时发现opengl es这个版本未能实现opengl规范的所有函数,导致以下编译错误提示:
error C2065: 'GL_T2F_C4UB_V3F' : undeclared identifier
error C3861: 'glInterleavedArrays': identifier not found
error C2065: 'GL_CLIENT_ALL_ATTRIB_BITS' : undeclared identifier
error C3861: 'glPushClientAttrib': identifier not found
error C2065: 'GL_ALL_ATTRIB_BITS' : undeclared identifier
error C3861: 'glPushAttrib': identifier not found
error C2065: 'GL_FILL' : undeclared identifier
error C3861: 'glPolygonMode': identifier not found
error C3861: 'gluOrtho2D': identifier not found
error C2065: 'GL_TEXTURE_GEN_S' : undeclared identifier
error C2065: 'GL_TEXTURE_GEN_T' : undeclared identifier
error C2065: 'GL_TEXTURE_GEN_R' : undeclared identifier
error C3861: 'glTexEnvi': identifier not found
error C3861: 'glPopAttrib': identifier not found
error C3861: 'glPopClientAttrib': identifier not found
error C3861: 'glInterleavedArrays': identifier not found
对于opengl得api没能好好研究1,2,所以所列函数无法通过修改代码使编译通过
请 cegui、opengl 的高手指点一二

DevIL(1.6.17)移植:
ILUT模块的编译问题
1>ilut_states.obj : error LNK2019: unresolved external symbol iGLSetMaxH referenced in function ilutSetInteger
1>ilut_states.obj : error LNK2019: unresolved external symbol iGLSetMaxW referenced in function ilutSetInteger
1>ilut_win32.obj : error LNK2019: unresolved external symbol SetDIBits referenced in function ilutConvertSliceToHBitmap

前两个在ilut_opengl.c,ilut_directx9.c中有所定义
devil没好好琢磨,所以是否必须编译时要加入 opengl或者directx的支持呢?

posted @ 2008-05-13 00:55 放屁阿狗 阅读(2443) | 评论 (6)编辑 收藏

一种编写lua扩展的c++工具
posted @ 2008-05-11 02:24 放屁阿狗 阅读(969) | 评论 (1)编辑 收藏

去sf.net下个了最新版本CEGUI-0.6.0.tar.gz
解开了开始了解cegui
freetype,pcre是两个必须具备的库
考虑到我个人应用的需求,就是需要一种script的扩展能力,以便可以灵活的改写我的ui,我选择了Lua,所以先搞定 ScriptingModules\CEGUILua
编译CEUIGLua需要tolua++,而后者又需要scons

scons: 号称下一代的自动化项目build 工具(http://www.scons.org/),类同 cmake,bake,ant,make/autoconf之类的东东 ,引用其介绍:

   "Doom3's Linux build system uses SCons.
CC="ccache distcc g++-3.3" JOBS=8 rocks!"
看来这个东西确实有点牛,等有时间用用看.


posted @ 2008-05-11 02:20 放屁阿狗 阅读(658) | 评论 (0)编辑 收藏

了解了一些CEGUI 基础的东西,觉得确实是个好东西,咋以前没早用她呢
cegui的widget一般都是texture绘制吧,也就是将 raster-image render到widget面。
之前正好把librsvg移植到wince上,看看是否能将svg扩展为cegui::drawable 对象, backend就采用 opengl

准备cegui到wince的移植工作

posted @ 2008-05-10 03:55 放屁阿狗 阅读(2521) | 评论 (0)编辑 收藏

note: This page only applies to CEGUI >= 0.4.0

The unified metrics system in CEGUI 0.4.0 and up, allows you to have both a relative and absolute component of a coordinate / dimension. This gives you alot more flexibility in how you layout your windows. For example you can use relative metrics for the height and absolute metrics for the width. Or simply mix and match.

There are three different forms in unified metrics:

  • UDim - a single dimension.
  • UVector2 - a two dimensional UDim vector
  • URect - four UDims describing a rectangle by its left, top, right and bottom edges.

The property system in CEGUI uses a special syntax for unified dimensions.

Contents

[hide]

UDim

The UDim is the simplest.

{''scale'',''offset''}   fx:   {1,0}

The scale component relative to the parent window, after it has been translated to pixels the offset is added. So if we used the example above as value for the UnifiedWidth property we would get a window exactly the width of its parent.

Another example could be
{0.5,25}
which would make it half the width of its parent plus 25 pixels.

The properties that take a single UDim like the ones used above are:

  • UnifiedXPosition
  • UnifiedYPosition
  • UnifiedWidth
  • UnifiedHeight

UVector2

The UVector2 is used for position and size if you want avoid specifying each single dimension seperately (x,y,w,h).

{{''x-scale'',''x-offset''},{''y-scale'',''y-offset''}}   fx:   {{1,0},{1,0}}

Besides the extra {..} around its two UDims it's very similar. Let's say we use the example above as value for the UnifiedSize property of a window, we would get a window that had exactly the same size as its parent.

{{1,0},{0,100}}
would yield a window width the same width as its parent but an absolute height of 100 pixels.

The properties that take UVector2 values are:

  • UnifiedPosition
  • UnifiedSize
  • UnifiedMinSize
  • UnifiedMaxSize

URect

The last type is URect. It's a little special in that it specifies the left, top, right and bottom edges instead of position and size. As there is alot of parameters I'll write ls instead of left-scale, to instead of top-offset etc.

{{ls,lo},{ts,to},{rs,ro},{bs,bo}}   fx:   {{0,0},{0,0},{1,0},{1,0}}

The example above is the default rectangle for a DefaultWindow type window. It will cover the entire area of it's parent window. There is only one property that takes a URect. UnifiedAreaRect.

The fact that we are specifying edges instead of size, can be useful. For example if we want a window to cover its entire parent, but leave a 10 pixel border a value like this could be used:
{{0,10},{0,10},{1,-10},{1,-10}}

The x and y position are simple absolute-only dims with a value of 10 pixels. The right and bottom edges are 100% relative components with a offset of -10 which will make it "move back" 10 pixels relative to the parent's right and bottom edges.

XML examples

<Property Name="UnifiedPosition" Value="{{0.1,10},{1.0,-30}}" />

X-position: 10% of the width of the parent window + 10 pixel 父窗体1/10+ 10个像素

Y-position: 30 pixel above the bottom of the parent window 父窗体高度差30个像数


<Property Name="UnifiedSize" Value="{{0.6,5},{0.3,20}}" />

Width: 60% of the width of the parent window + 5 pixel

Height: 30% of the height of the parent window + 20 pixel


<Property Name="UnifiedXPosition" Value="{0.25,-5}" />

X-position: 25% of the width of the parent window minus 5 pixel


<Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.1,0},{0.9,0},{0.9,0}}" />

X-position: 10% of the width of the parent window.

Y-position: 10% of the height of the parent window.

Width: 80% of the width of the parent window.

Height: 80% of the height of the parent window.

posted @ 2008-05-10 03:04 放屁阿狗 阅读(310) | 评论 (0)编辑 收藏

The purpose of this tutorial is to show you how to create a simple window and get it on screen. Before continuing here, it is very important that you have already read and fully understood the articles The Beginner Guide to Getting CEGUI Rendering and The Beginner Guide to Loading Data Files and Initialisation; this is important because this tutorial builds upon the basic ideas introduced in those tutorials.


Contents

[hide]

Introduction to window and widget concepts

Before we get the the meat of this tutorial there are some essential ideas that you must first consider.

Every widget is a window

This is the most central concept that must be grasped when working with CEGUI. Every widget within the system is derived from the same Window base class; so for the purposes of this tutorial, whenever I mention a window, the same ideas could just as easily be applied to a push button or scrollbar widget.

Many settings are inherited

Many of the settings and properties available for windows in CEGUI are passed down the window hierarchy. For example, if you set the alpha transparency on a particular window to 0.5, then by default, all window and widgets attached to that window will also be affected by the change applied at the higher level; although note also that the actual setting on the child window remains unchanged - the final values and/or settings used are usually some combination of the setting values from all windows in the hierarchy down to the current window. This also applies to things such as window destruction; by default, a window will destroy attached child windows and widgets when it is destroyed. The main advantages of this arrangement are that you can easily affect a the whole GUI by making changes to the root window settings for things like alpha, visibility, enabled / disabled state, and can easily 'clean up' an entire GUI layout by simply destroying the root window. The default 'inherited' behaviours can be overridden on a per window basis where more fine grained control is needed, or where certain advanced management techniques are to be used.


Creating the windows

Enough of the waffle! Lets create a window.

There are two ways of doing this, via C++ code and XML layout files. Each approach is discussed below.

GUI Creation via C++ code

All windows in CEGUI are created by the WindowManager singleton object. You can get access to this object via the usual getSingleton method as follows:

using namespace CEGUI;
WindowManager& wmgr = WindowManager::getSingleton();

In general, you will be using what is known as a DefaultWindow (or to use it's old name, DefaultGUISheet) as the 'root' window in your GUI. This is not required, but is the accepted pattern of usage for CEGUI and, once you start adding more top-level windows, helps simplify laying things out.

So, to get the ball rolling, we'll create a DefaultWindow as set it as the root 'GUI Sheet' for the GUI:

Window* myRoot = wmgr.createWindow( "DefaultWindow", "root" );
System::getSingleton().setGUISheet( myRoot );

The createWindow method of the WindowManager takes two strings as its parameters. The first one, "DefaultWindow" in this example, tells the system the type or class of the window you wish to create. Generally, the windows you have available are those which were registered when you loaded your scheme file, although some, like DefaultWindow, are global types and are always available. The second parameter, "root" in this example, is a unique name which will be assigned to the window; this name can be used to retrieve a pointer to the window from the WindowManager at a later time. Note that naming your root window "root" is not required, but is a common convention.

The setGUISheet method in the System singleton object is used to specify a given window as the root of the GUI. This will replace any current sheet / root window, although do note that the previous window hierarchy is not actually destroyed; it is just unlinked from the display - you can easily switch between GUI 'pages' by simply flipping between them using the setGUISheet method.

Now you have created your first window and attached it to the GUI system, and the system will use this window as the root of the GUI when it draws the GUI. But, if you were to compile a simple program using this code, you still can't see anything; what gives? There's nothing wrong with your application, the DefaultWindow which we created above is just totally invisible! This is what makes the DeafultWindow ideally suited as a root window; it serves as a blank canvas onto which other window and widgets can be attached. So, lets do that now...

Here we will create a frame window; this is a window that functions in a similar manner to the windows on your desktop UI, it has a title bar and can be moved and re-sized.

FrameWindow* fWnd = (FrameWindow*)wmgr.createWindow( "TaharezLook/FrameWindow", "testWindow" );

here we are creating a "TaharezLook/FrameWindow" window. This name uses a convention seen throughout the system, whereby a window type is prefixed by the name of the widget set (if you were to load the WindowsLook scheme, you could create a "WindowsLook/FrameWindow" object instead). We have given our new window the simple test name of "testWindow". One final thing to note is the use of the cast, this is required since the createWindow method always returns a base Window type; in this, and many other cases a basic Window pointer will suffice, but there are times when you'll want to access methods introduced in the window and widget sub-classes, so the use of the cast as shown is common when using CEGUI.

In order for the system to be able to do something useful with our new window, we must perform a few additional steps.

First, we must attach the window to the root window we established above:

myRoot->addChildWindow( fWnd );

Now, we can set an initial position and size for our window. CEGUI uses a 'unified' co-ordinate system enabling the use of relative (scale) and absolute (offset) components at the same time - this is why each co-ordinate you will see has two parts. For a slightly extended introduction of this concept see Introduction and overview of core "Falagard" support systems. Back to the example:

// position a quarter of the way in from the top-left of parent.
fWnd->setPosition( UVector2( UDim( 0.25f, 0 ), UDim( 0.25f, 0 ) ) );

// set size to be half the size of the parent
fWnd->setSize( UVector2( UDim( 0.5f, 0 ), UDim( 0.5f, 0 ) ) );

Finally, we set a caption for the frame window's title bar:

fWnd->setText( "Hello World!" );

And that's it! When compiled into an application, you will now see a simple frame window in the middle of the display.


XML layouts

All of the above is very nice, but there is one major drawback; any time you wish to adjust the GUI layout, you need to edit your code and recompile. This will get old pretty quick, so what you really want is to be able to specify your GUI layout externally, and have your code load the layout via a file. This is the purpose of the CEGUI layout XML files.

The system supports XML layout files, which can be loaded via the WindowManager using the loadWindowLayout method. This method creates all the windows for you and returns a pointer to the root window of the loaded hierarchy; which is ideal for assigning as the root of the GUI!

So, first of all we need a layout file. The following XML saved as a text file, is a layout file equivalent to the code we discussed above:

<?xml version="1.0" ?>
<GUILayout>
<Window Type="DefaultWindow" Name="root">
<Window Type="TaharezLook/FrameWindow" Name="testWindow">
<Property Name="UnifiedPosition" Value="{{0.25,0},{0.25,0}}" />
<Property Name="UnifiedSize" Value="{{0.5,0},{0.5,0}}" />
<Property Name="Text" Value="Hello World!" />
</Window>
</Window>
</GUILayout>

The Window elements show an obvious mapping to the createWindow method from the WindowManager object; they take a type and a name which directly correspond to the parameters discussed previously.

Nesting of the Window elements is used to attach certain windows to others. Note that you may only have one 'root' level window in a layout file, which is another reason you'll usually see the DefaultWindow used as a canvas on which other windows and widgets are placed.

The Property elements are used to set properties on the Window being defined. There are many properties available for each window/widget class, and each class also inherits all properties from it's parent class. See the <element>Properties namespaces in the API reference for documentation on the available hard-coded properties and their 'value string' formats. Since 'Falagard' skins can create their own properties, it is likely that the windows you are using contain many more properties than listed in the previous link - for these 'soft' properties, you need to consult whichever documentation is provided with the skin you are using (for the sample skins see TaharezLook and WindowsLook).

If saved as a file called "test.layout", you could load this layout and set it as the GUI root as follows:

using namespace CEGUI;
Window* myRoot = WindowManager::getSingleton().loadWindowLayout( "test.layout" );
System::getSingleton().setGUISheet( myRoot );

The end result is exactly the same as what was done in C++ code earlier, except that now you can modify and enhance the GUI layout without the need for constant editing and recompilation of the application code.




理解以上教程很是简单,提供了两种创建widget的方法


posted @ 2008-05-10 02:58 放屁阿狗 阅读(735) | 评论 (0)编辑 收藏

     摘要: Bookmarks 863 上海瀚讯无线技术有限公司 ARM Download GNU Toolchain BlueTooth Bluetooth.org - Welcome to Bluetooth.org Welcome to CSR - Changing the way the world co...  阅读全文
posted @ 2008-05-08 20:29 放屁阿狗 阅读(1743) | 评论 (2)编辑 收藏


Image Decoder:
    libpng,libjpeg,libtiff,

Image库:
    cimg, devil,python-pil,agg,cximage,gdk-pixbuf,wxImage(wxWidget),magic-image

cimg: 采用template技术,整个库就一个cimg.h,使用起来确实方便其内在功能确实强大,只是简单应用了一下
pil: 用python写过4国军旗的游戏,采用的就是这个image库
agg: 采用template技术,几乎涵盖了2d image操作的所有功能,也是弱耦合,使用起来非常灵活
cximage: 做导航设备的图片浏览软件时采用image 库,基本还是比较好用
gdk-pixbuf: gdk/gtk标准的image 库,gnome的大量软件均采用其库。移植 librsvg时使用过
wxImage: 依赖 wxWidget库,类似 Qt的 QtImage类
posted @ 2008-05-08 20:07 放屁阿狗 阅读(2106) | 评论 (0)编辑 收藏


windows下发时经常会碰到诸如c运行库函数与win32 Api对文件资源的公用的问题

很简单的方法:
    FILE *f = fopen (...);
    HANDLE h = (HANDLE)_get_osfhandle (_fileno (f));
    WriteFile( h,....);
    f = fdopen ( (int)h,"w");
    fwrite(f,...)

posted @ 2008-05-07 01:40 放屁阿狗 阅读(1196) | 评论 (0)编辑 收藏

仅列出标题
共25页: First 17 18 19 20 21 22 23 24 25