帝国时代是directDraw
directDraw创建了好几个surface来回翻转显示
后台画好后显示到前台、、、、
具体的、、、随便找一个游戏就可以找到类似代码啦!

解决方案 »

  1.   

    有没有简单的方法,我对directDraw不了解,  也不是作游戏,只是达到他的效果就可以了。
      

  2.   

    我是想作个内存位图, 全屏显示,然后作个透明的矩形,在矩形内写字。不知这种方法可行否?   用不用加上屏蔽 热启动 键,和windows键的功能??
      

  3.   

    先郑重声明:我是菜鸟
    背景图片的加入:
    //////////////////////////////////
    先定义一个CBitmap 对象m_MyBitmap
    从类构造函数里装载你要作为背景的图片m_MyBitmap.LoadBitmap(yourbmpID);
    在OnEraseBkgnd(CDC* pDC) 中加入下列代码,
    BITMAP bmp; 
    m_MyBitmap.GetBitmap (&bmp); CRect rect; 
    pDC->GetClipBox (&rect); CPoint org (0, 0); 
    pDC->DPtoLP (&org); CDC dcMem; 
    dcMem.CreateCompatibleDC (pDC); 
    CBitmap *pOldBitmap = dcMem.SelectObject (&m_MyBitmap); dcMem.SetMapMode (pDC->GetMapMode ()); pDC->StretchBlt (rect.left, rect.top, rect.Width (), rect.Height (), 
    &dcMem, org.x, org.y, bmp.bmWidth, bmp.bmHeight, SRCCOPY); pDC->SelectObject (pOldBitmap); 
    /////////////////////////////////
    另外滚动字幕的类我还没有测试,测试成功后再贴
      

  4.   

    zhaowuqing()的方法很,还修改return
      

  5.   

    // 111222.cpp : Defines the entry point for the application.
    //#include "stdafx.h"
    HBITMAP hBmp = 0;
    int x=0;
    int y=0;LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
        HDC hdc;
        PAINTSTRUCT ps;
        switch (message) 
        {      case WM_TIMER:
       x=x+10;
       if(x>GetSystemMetrics(SM_CYSCREEN))
       {y=y+10;
       x=0;
       }
           hdc=GetDC(hWnd);
        SetBkMode(hdc,TRANSPARENT);
                    SetTextColor(hdc,RGB(255,0,0));
                    TextOut(hdc,x,y,"滚动的文字",10);
        break;        case WM_PAINT:
                    hdc = BeginPaint (hWnd, &ps);
                    {
                        HDC memdc = CreateCompatibleDC(hdc);
                        HBITMAP h = (HBITMAP)SelectObject(memdc, hBmp);
    StretchBlt(hdc,0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),memdc,0,0,520,316,SRCCOPY);
    SelectObject(memdc, h);
                        DeleteDC(memdc);

                    }
                    EndPaint (hWnd, &ps);
                break;
              case WM_KEYDOWN:
                if (wParam = VK_ESCAPE)
    SendMessage(hWnd,WM_DESTROY,0,0);
                 break;
               case WM_DESTROY:
        KillTimer(hWnd,1);
                    PostQuitMessage(0);
                break;        default:
                return (DefWindowProc(hWnd, message, wParam, lParam));
        }
        
        return (0);
    }
    int APIENTRY WinMain(HINSTANCE hInstance,
                         HINSTANCE hPrevInstance,
                         LPSTR     lpCmdLine,
                         int       nCmdShow)
    {
      // TODO: Place code here. WNDCLASSEX wc;
        HWND hWnd;
        MSG msg;
    HRESULT    hr=S_OK;     ZeroMemory( &wc, sizeof( wc ) );
        wc.cbSize = sizeof( wc );
        wc.style            = CS_HREDRAW | CS_VREDRAW;
        wc.lpfnWndProc      = (WNDPROC)WndProc;
    wc.cbClsExtra = 0;
        wc.cbWndExtra = 0;
        wc.hInstance        = hInstance;
        wc.hIcon            = NULL;
        wc.hCursor          = LoadCursor( NULL, IDC_CROSS );
        wc.hbrBackground    = GetSysColorBrush( COLOR_3DFACE );
        wc.lpszMenuName     = NULL;
        wc.lpszClassName    = "fullscreen";
        wc.hIconSm          = NULL;       hBmp = (HBITMAP)LoadImage(NULL, "backgroundpicture.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);        
     if (RegisterClassEx(&wc))
       {
               hWnd = CreateWindowEx(WS_EX_TOPMOST|WS_EX_TOOLWINDOW,"fullscreen", NULL, WS_POPUP,0,0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), NULL, NULL, hInstance, NULL);
               SetTimer(hWnd,1,100,NULL);
     }               ShowWindow(hWnd, SW_SHOWNORMAL);
                   UpdateWindow(hWnd);            while (GetMessage(&msg, NULL, 0, 0)) 
                {
                    TranslateMessage(&msg);
                    DispatchMessage(&msg);
                }            return (msg.wParam); return 0;
    }// stdafx.cpp : source file that includes just the standard includes
    // 111222.pch will be the pre-compiled header
    // stdafx.obj will contain the pre-compiled type information#include "stdafx.h"// TODO: reference any additional headers you need in STDAFX.H
    // and not in this file
    // stdafx.h : include file for standard system include files,
    //  or project specific include files that are used frequently, but
    //      are changed infrequently
    //#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
    #define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_#if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers#include <windows.h>
    // TODO: reference additional headers your program requires here//{{AFX_INSERT_LOCATION}}
    // Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)