DX7

directx7编程,下面是一个卷屏和角色移动的例子-------------Sunday,8.30
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
While True
DoEvents
Sleep 40
dd2.SetForeColor vbRed
x = x + 15: y = y + 1
If x >= 500 Then x = 500: aaa = True
If y >= 8 Then y = 2
aa

Wend
End Sub

Private Sub Form_Load()
setbb
aaa = False
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
End
End Sub
mudule中:
Public a As New DirectX7
Public b As DirectDraw7
Public dd1 As DirectDrawSurface7
Public dd2 As DirectDrawSurface7
Public dd3 As DirectDrawSurface7
Public dd4 As DirectDrawSurface7
Public d1 As DDSURFACEDESC2
Public d2 As DDSURFACEDESC2
Public d3 As DDSURFACEDESC2
Public d4 As DDSURFACEDESC2
Public r1 As RECT
Public r2 As RECT
Public r3 As RECT
Public r4 As RECT
Public r5 As RECT
Public r6 As RECT
Public r7 As RECT
Public r8 As RECT
Public k As DDCOLORKEY
Public x, y As Long
Public aaa As Boolean
Public Sub setbb()
Set a = New DirectX7
Set b = a.DirectDrawCreate("")
b.SetCooperativeLevel Form1.hWnd, DDSCL_ALLOWMODEX Or DDSCL_EXCLUSIVE Or DDSCL_FULLSCREEN
b.SetDisplayMode 800, 600, 32, 0, DDSDM_DEFAULT
d1.lFlags = DDSD_CAPS Or DDSD_BACKBUFFERCOUNT
d1.ddsCaps.lCaps = DDSCAPS_COMPLEX Or DDSCAPS_FLIP Or DDSCAPS_PRIMARYSURFACE
d1.lBackBufferCount = 1
Set dd1 = b.CreateSurface(d1)
d2.ddsCaps.lCaps = DDSCAPS_BACKBUFFER
Set dd2 = dd1.GetAttachedSurface(d2.ddsCaps)
d3.lFlags = DDSD_CAPS Or DDSD_WIDTH Or DDSD_HEIGHT
d3.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
d3.lWidth = 800: d3.lHeight = 600
Set dd3 = b.CreateSurfaceFromFile(App.Path & "/segs/mitch0.bmp", d3)
r1.Bottom = 90: r1.Left = 400: r1.Right = 640
dd2.BltFast 100, 300, dd3, r1, DDBLTFAST_WAIT
dd2.BltFast 500, 300, dd3, r1, DDBLTFAST_WAIT
r2.Bottom = 85: r2.Left = 160: r2.Right = 400
dd2.BltFast 100, 220, dd3, r2, DDBLTFAST_WAIT
dd2.BltFast 500, 220, dd3, r2, DDBLTFAST_WAIT
d4.lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH
d4.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
d4.lWidth = 640: d4.lHeight = 448
Set dd4 = b.CreateSurfaceFromFile("aa.bmp", d4)

r7.Bottom = 600: r7.Right = 800: r7.Left = 0: r7.Top = 0
dd3.BltFast 0, 0, dd2, r7, DDBLTFAST_WAIT
aa
End Sub
Public Sub aa()
dd2.BltFast 0, 0, dd3, r7, DDBLTFAST_WAIT
If y = 1 Or y = 0 Then r6.Bottom = 64: r6.Right = 64: r6.Left = 0
If y >= 2 Then r6.Bottom = 128: r6.Top = 64: r6.Right = 64 * (y - 1): r6.Left = 64 * (y - 2)
If x = 500 Then

r8.Bottom = 600: r8.Left = 0: r8.Right = 15: r8.Top = 0
r5.Bottom = 600: r5.Left = 15: r5.Right = 800: r5.Top = 0
dd2.BltFast 785, 0, dd3, r8, DDBLTFAST_WAIT
dd2.BltFast 0, 0, dd3, r5, DDBLTFAST_WAIT
dd3.BltFast 0, 0, dd2, r7, DDBLTFAST_WAIT

End If
kk
End Sub
Public Sub kk()

dd2.DrawText 10, 10, Str(x) , False

k.high = 0
k.low = 0
dd4.SetColorKey DDCKEY_SRCBLT, k
dd2.BltFast x, 250, dd4, r6, DDBLTFAST_SRCCOLORKEY
dd1.Flip Nothing, DDFLIP_WAIT
End Sub

weixin151云匹面粉直供微信小程序+springboot后端毕业源码案例设计 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值