Runtime Error 5 при вызове BltFast (DirectDraw) - VB
Формулировка задачи:
Добрый день. Выдает ошибку "Invalid procedure call or argument" на строке
Не могу догадаться, в чем дело, как будто бы все правильно. Наверняка что-нибудь тривиальное.
Вот код класса:
Листинг программы
- ddsBack.BltFast CartToIsoX(dx, dy, W), CartToIsoY(dx, dy, H), Tiles(TileNo).Surface, Tiles(TileNo).TRect, DDBLTFAST_SRCCOLORKEY
Листинг программы
- Option Explicit
- 'размер карты в тайлах
- Private mvarWidth As Integer, mvarHeight As Integer
- 'структура тайла. поверхность, ректангл
- Private Type Tile
- Surface As DirectDrawSurface7
- TRect As RECT
- End Type
- 'габариты тайла
- Private mvarTileWidth As Integer, mvarTileHeight As Integer
- 'массив используемых на карте тайлов
- Private Tiles() As Tile
- 'двухмерный массив карты тайлов
- Private TileMap() As Integer
- 'количество используемых типов тайлов
- Private mvarTilesQuantity As Integer
- Public Property Let Height(ByVal vData As Integer)
- mvarHeight = vData
- End Property
- Public Property Get Height() As Integer
- Height = mvarHeight
- End Property
- Public Property Let Width(ByVal vData As Integer)
- mvarWidth = vData
- End Property
- Public Property Get Width() As Integer
- Width = mvarWidth
- End Property
- Private Sub LoadTiles(MapFile As String)
- SetConfigurationFile MapFile
- SetSection "Tiles"
- mvarTilesQuantity = Int(LoadValue("Quantity"))
- mvarTileWidth = Int(LoadValue("Width"))
- mvarTileHeight = Int(LoadValue("Heigh"))
- Dim i As Integer, j As Integer
- ReDim Tiles(mvarTilesQuantity)
- For i = 0 To mvarTilesQuantity - 1
- Set Tiles(i).Surface = CreateDDSFromFile(App.Path + LoadValue("Tile" + CStr(i + 1)))
- SetRect Tiles(i).TRect, 0, 0, mvarTileWidth, mvarTileHeight
- Next i
- ReDim TileMap(mvarWidth, mvarHeight)
- Dim S As String
- SetSection "TileMap"
- 'i - y; j - x
- For i = 0 To mvarHeight - 1
- S = LoadValue("Y" + CStr(i + 1))
- For j = 0 To mvarWidth - 1
- TileMap(j, i) = Int(Left(S, 1))
- S = Right(S, mvarWidth - j - 1)
- Next j
- Next i
- End Sub
- Public Sub LoadMap(MapFile As String)
- SetConfigurationFile MapFile
- SetSection "Size"
- mvarWidth = Int(LoadValue("Width"))
- mvarHeight = Int(LoadValue("Height"))
- LoadTiles (MapFile)
- End Sub
- Public Sub DrawMap()
- DrawTiles
- End Sub
- Private Sub DrawTiles()
- Dim i As Integer, j As Integer
- For i = 0 To mvarWidth - 1
- For j = 0 To mvarWidth - 1
- 'DrawTile i, j, Tiles(TileNo).Surface, Tiles(TileNo).TRect, mvarTileWidth, mvarTileHeight
- DrawTile i, j
- Next j
- Next i
- End Sub
- Private Sub DrawTile(X As Integer, Y As Integer)
- Dim TileNo As Integer
- TileNo = TileMap(X, Y)
- Dim dx As Long, dy As Long, W As Long, H As Long
- dx = CLng(X)
- dy = CLng(Y)
- W = CLng(mvarTileWidth)
- H = CLng(mvarTileHeight)
- ddsBack.BltFast CartToIsoX(dx, dy, W), CartToIsoY(dx, dy, H), Tiles(TileNo).Surface, Tiles(TileNo).TRect, DDBLTFAST_SRCCOLORKEY
- End Sub
Решение задачи: «Runtime Error 5 при вызове BltFast (DirectDraw)»
textual
Листинг программы
- ?App.Path + LoadValue("Tile" + CStr(i + 1))
- E:\_Workspace\game\data\tiles\tile1.gif
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д