帝国时代是directDraw
directDraw创建了好几个surface来回翻转显示
后台画好后显示到前台、、、、
具体的、、、随便找一个游戏就可以找到类似代码啦!
directDraw创建了好几个surface来回翻转显示
后台画好后显示到前台、、、、
具体的、、、随便找一个游戏就可以找到类似代码啦!
解决方案 »
- CImageList图像索引号问题
- select多线程的问题
- Help me !
- 在VC中调用SQL语句执行SELECT * FROM table为什么速度奇慢(Postgres数据库)?160分相送!!!!!!急!!!!
- 使用WINIO控制并口通信的高手看过来,小弟有一小问题想问???
- 请问:一个端口已经和一个套接字绑定了,我还能用另一个套接字使用这个端口发UDP么?
- 散分!!!200分!!!!求源程序!!
- 能不能用movewindow(rect)改变视的大小?
- 用TEXTOUT输出1串字符,怎么确定当前的位置,接着刚才输出的字符后接着输出
- crystal report问题,高手们,快帮帮忙啊!
- EXE文件中的资源信息如何修改?
- 请问如何在一个程序中运行另一个应用程序
背景图片的加入:
//////////////////////////////////
先定义一个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);
/////////////////////////////////
另外滚动字幕的类我还没有测试,测试成功后再贴
//#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_)