游戏开发论坛

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

[求助]Windows游戏编程快速入门里的SelectPen,build的时候说

[复制链接]

1

主题

1

帖子

3

积分

新手上路

Rank: 1

积分
3
发表于 2005-3-17 18:59:00 | 显示全部楼层 |阅读模式
我在网上也找不到关于SelectPen的说明,DeletePen也是这样

作者用的是Visual Studio 2003.net,我用的是6.0,是不是和版本有关系?
// 画线
void CGDISurface:ine( int x1, int y1, int x2, int y2, COLORREF c )
{
    HPEN hPen = CreatePen(PS_SOLID, 1, c );
    //HPEN hOldPen = SelectPen( m_hDC, hPen );
    HPEN hOldPen = SelectPen( m_hDC, hPen );

    MoveToEx( m_hDC, x1, y1, (LPPOINT) NULL );
    LineTo( m_hDC, x2, y2 );

    SelectPen( m_hDC, hOldPen );
    DeletePen( hPen );
}


还有传送位图这一段

E:\C project\abc001\GDISurface.cpp(204) : error C2061: syntax error : identifier 'BltMode'
E:\C project\abc001\GDISurface.cpp(205) : error C2511: 'Blt' : overloaded member function 'void (class CGDISurface *,int,int,int,int,int,int)' not found in 'CGDISurface'
        e:\c project\abc001\gdisurface.h(10) : see declaration of 'CGDISurface'

实在看不懂

GDISurface.h
    // 位图传送
    void Blt( CGDISurface *pSurface, int x, int y, int rx, int ry, int w, int h, SurfaceBltMode sbmMode );


GDISurface.cpp:
// 位图传送
void CGDISurface::Blt( CGDISurface *pSurface, int x, int y, int rx, int ry, int w, int h, BltMode iMode )
{
    HDC hdcDst = pSurface->GetDC();
    switch( iMode )
    {
    case BLT_BLOCK:
        // 基本复制方式传送位图
        BitBlt( hdcDst, x, y, w, h, m_hDC, rx, ry, SRCCOPY );
        break;
    case BLT_ALPHATEST:
        // 带透明色方式传送位图
        SetBkColor( hdcDst, RGB(255,255,255) );
        SetTextColor( hdcDst, RGB(0,0,0) );
        BitBlt( hdcDst, x, y, w, h, m_hMaskDC, rx, ry, SRCAND );
        BitBlt( hdcDst, x, y, w, h, m_hDC, rx, ry, SRCPAINT );
        break;
    case BLT_ALPHABLEND:
        break;
    }
}

7

主题

29

帖子

29

积分

注册会员

Rank: 2

积分
29
QQ
发表于 2005-12-16 13:56:00 | 显示全部楼层

Re:[求助]Windows游戏编程快速入门里的SelectPen,build的时候

1. 没有SelectPen函数,用SelectObject(m_hDC,hPen);
2. 声明里的Blt函数最后一个参数跟定义的最后一个参数类型不一样啊,当然编译不通!

38

主题

96

帖子

148

积分

注册会员

Rank: 2

积分
148
发表于 2005-12-21 21:19:00 | 显示全部楼层

Re:[求助]Windows游戏编程快速入门里的SelectPen,build的时候

恩,不错。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-1-23 01:20

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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