Never mind on my question - I figured it out (I forgot to set 2 variables).
I am still curious why I cannot post in the Q&A section, though.
Hey all, First off, let me apologize if this is in the wrong section - for some reason it would not let me start a new thread in the Q&A section. So my issue is as follows. I have been trying to convert my game over to EO 4.2.3, from an old Mirage/Konfuze based system that I heavily modified back in 2006/2007. I am still relatively early in the process, so I have been dabeling with different aspects of the engine to get a real feel for it. I am very familiar with VB6 (having re-written much of the source from the Konfuze engine), but I am not a graphics person by any means. I am not sure if my issue is with the code, with my graphics, or a combination of both. So I have been trying to implement aspects of my old GUI into the system, while to get a handle on it. However for some reason the graphics tend to be VERY finicky when changing GUI item dimensions. Here is the current example I am struggling with: 3.png is a very simple news background. It is 300x90 pixels. I use the following code, inside of Sub LoadGUI, in the client:
NewsPanelX = 100 NewsPanelY = 200 NewsPanelWidth = 300 NewsPanelHeight = 90 NumTextures = NumTextures + 1 ReDim Preserve gTexture(NumTextures) NewsPanelImage.filepath = App.path & GFX_PATH & "gui\3.png" NewsPanelImage.Texture = NumTextures
Then I use the following code in Sub CacheInterfaceBounds:
dX = NewsPanelX dY = NewsPanelY dw = NewsPanelWidth dH = NewsPanelHeight If dw > 0 And dH > 0 And (dw + dX) > 0 And (dY + dH) > 0 Then If dX < GUIContainerWidth And dY < GUIContainerHeight Then If dX + dw > GUIContainerWidth Then dw = dw - ((dX + dw) - GUIContainerWidth) End If If dY + dH > GUIContainerHeight Then dH = dH - ((dY + dH) - GUIContainerHeight) End If If dX < 0 Then sx = dX * -1 dw = dw + dX dX = dX + sx End If If dY < 0 Then sy = dY * -1 dH = dH + dY dY = dY + sy End If dX = dX + GUIContainerX dY = dY + GUIContainerY sW = dw
sH = dH
If NewsPanelImage.Texture > 0 Then
NewsPanelBounds.Left = dX NewsPanelBounds.Right = dw NewsPanelBounds.Top = dY NewsPanelBounds.Bottom = dH NewsPanelSrcBounds.Left = sx NewsPanelSrcBounds.Right = sW NewsPanelSrcBounds.Top = sy NewsPanelSrcBounds.Bottom = sH End If sx = 0 sy = 0 End If
~~ And then finally I modified Sub DrawNewsPanel to the following:~~
Sub DrawNewsPanel(bx As Long, by As Long, bw As Long, bh As Long) Dim dX As Long, dY As Long, dw As Long, dH As Long, sx As Long, sy As Long, sW As Long, sH As Long Dim NewsText As String, a() As String, i As Long On Error GoTo errorhandler dX = NewsPanelBounds.Left dY = NewsPanelBounds.Top dw = NewsPanelBounds.Right dH = NewsPanelBounds.Bottom sx = NewsPanelSrcBounds.Left sy = NewsPanelSrcBounds.Top sW = NewsPanelSrcBounds.Right sH = NewsPanelSrcBounds.Bottom If dw > 0 And dH > 0 And (dw + dX) > 0 And (dY + dH) > 0 Then If NewsPanelImage.Texture > 0 Then RenderTexture NewsPanelImage, dX, dY, sx, sy, dw, dH, sW, sH End If NewsText = WordWrap(News, dw - 4) NewsText = LimitTextLines(NewsText, Fix(dH / 14), 0) a = Split(NewsText, vbNewLine) If UBound(a) > 0 Then For i = 0 To UBound(a) RenderText Font_Georgia, a(i), dX + (dw / 2) - (EngineGetTextWidth(Font_Georgia, a(i)) / 2), dY + i * 12, FontColor Next End If End If On Error GoTo 0 Exit Sub errorhandler: HandleError "DrawNewsPanel", "modUserInterface", Err.Number, Err.Description, Erl Err.Clear End Sub
Attached is bug.png - this is how the image ends up displaying. It is the correct ‘size’ (300x90) however it appears as if DX8 is grabbing hold of the upper left corner of the image, and then pulling from the right side of the image, causing this very odd distortion. Any insight into this issue would be very much appreciated. Again, sorry if this should be in the Q&A section, however I was unable to start a topic there. Thanks all for your help!