游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1957|回复: 2

裁剪器的问题LPRGNDATA结构用法??

[复制链接]

13

主题

46

帖子

52

积分

注册会员

Rank: 2

积分
52
发表于 2006-10-29 19:14:00 | 显示全部楼层 |阅读模式
各位,小弟正在学ddraw的时候对这里这段程序有所不解。
1,这里
region_data->rdh.rcBound.left    =  64000;
region_data->rdh.rcBound.top     =  64000;
region_data->rdh.rcBound.right   = -64000;
region_data->rdh.rcBound.bottom  = -64000;
为什么要设置为64000??这些值是什么意思。

2。这里
if (clip_list[index].left < region_data->rdh.rcBound.left)
       region_data->rdh.rcBound.left = clip_list[index].left;

    if (clip_list[index].right > region_data->rdh.rcBound.right)
       region_data->rdh.rcBound.right = clip_list[index].right;

    if (clip_list[index].top < region_data->rdh.rcBound.top)
       region_data->rdh.rcBound.top = clip_list[index].top;

    if (clip_list[index].bottom > region_data->rdh.rcBound.bottom)
       region_data->rdh.rcBound.bottom = clip_list[index].bottom;
这里
  region_data->rdh.rcBound.left 与 clip_list[index].left等分别指的是什么??

望大家能帮帮我。十分感激!
================================

下面是给一个交完整的代码:
LPRGNDATA region_data;             // pointer to the region data that contains
                                   // the header and clip list

// first create the direct draw clipper
if (FAILED(lpdd->CreateClipper(0,&lpddclipper,NULL)))
   return(NULL);

// now create the clip list from the sent data

// first allocate memory for region data
region_data = (LPRGNDATA)malloc(sizeof(RGNDATAHEADER)+num_rects*sizeof(RECT));

// now copy the rects into region data
memcpy(region_data->Buffer, clip_list, sizeof(RECT)*num_rects);

// set up fields of header
region_data->rdh.dwSize          = sizeof(RGNDATAHEADER);
region_data->rdh.iType           = RDH_RECTANGLES;
region_data->rdh.nCount          = num_rects;
region_data->rdh.nRgnSize        = num_rects*sizeof(RECT);

region_data->rdh.rcBound.left    =  64000;
region_data->rdh.rcBound.top     =  64000;
region_data->rdh.rcBound.right   = -64000;
region_data->rdh.rcBound.bottom  = -64000;

// find bounds of all clipping regions
for (index=0; index<num_rects; index++)
    {
    // test if the next rectangle unioned with the current bound is larger
    if (clip_list[index].left < region_data->rdh.rcBound.left)
       region_data->rdh.rcBound.left = clip_list[index].left;

    if (clip_list[index].right > region_data->rdh.rcBound.right)
       region_data->rdh.rcBound.right = clip_list[index].right;

    if (clip_list[index].top < region_data->rdh.rcBound.top)
       region_data->rdh.rcBound.top = clip_list[index].top;

    if (clip_list[index].bottom > region_data->rdh.rcBound.bottom)
       region_data->rdh.rcBound.bottom = clip_list[index].bottom;

    } // end for index

9

主题

45

帖子

49

积分

注册会员

Rank: 2

积分
49
发表于 2006-10-30 13:02:00 | 显示全部楼层

Re:裁剪器的问题LPRGNDATA结构用法??

WINDOWS游戏编程大师技巧 (2D的那一本) 上有详细的说明

13

主题

46

帖子

52

积分

注册会员

Rank: 2

积分
52
 楼主| 发表于 2006-10-30 15:23:00 | 显示全部楼层

Re: Re:裁剪器的问题LPRGNDATA结构用法??

ricyangliu: Re:裁剪器的问题LPRGNDATA结构用法??

WINDOWS游戏编程大师技巧 (2D的那一本) 上有详细的说明


我看的也正是这本书啊,只是我没有看到它对这两个问题的说明。 [em24]
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-25 18:11

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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