[EO - Event System 3.0] Resolution Changer

How to add a resolution change support! At the moment i add 4 resolutions. After hours of calculation these 4 are the best. Its strange to add more resolution because off the calculation of the background 🙂 But it is possible to add more. But my monitor don’t allow more ^^. What i notice is that the EXE takes a little bit longer to load.

Screenshot:

WAY 1
Client:
modContants

Change:

Private Direct3D_Window As D3DPRESENT_PARAMETERS 'Backbuffer and viewport description.
```To:

Public Direct3D_Window As D3DPRESENT_PARAMETERS 'Backbuffer and viewport description.


* * *

Change:

Public Const MAX_MAPX As Byte = 14
Public Const MAX_MAPY As Byte = 11

Public MAX_MAPX As Byte
Public MAX_MAPY As Byte


* * *

Change:

Public Const HalfX As Integer = ((MAX_MAPX + 1) / 2) * PIC_X
Public Const HalfY As Integer = ((MAX_MAPY + 1) / 2) * PIC_Y
Public Const ScreenX As Integer = (MAX_MAPX + 1) * PIC_X
Public Const ScreenY As Integer = (MAX_MAPY + 1) * PIC_Y
Public Const StartXValue As Integer = ((MAX_MAPX + 1) / 2)
Public Const StartYValue As Integer = ((MAX_MAPY + 1) / 2)
Public Const EndXValue As Integer = (MAX_MAPX + 1) + 1
Public Const EndYValue As Integer = (MAX_MAPY + 1) + 1

Public HalfX As Integer
Public HalfY As Integer
Public ScreenX As Integer
Public ScreenY As Integer
Public StartXValue As Integer
Public StartYValue As Integer
Public EndXValue As Integer
Public EndYValue As Integer


* * *

Change:

Direct3D_Window.BackBufferWidth = 800 ’ frmMain.picScreen.ScaleWidth 'Match the backbuffer width with the display width
    Direct3D_Window.BackBufferHeight = 600 'frmMain.picScreen.ScaleHeight 'Match the backbuffer height with the display height

Direct3D_Window.BackBufferWidth = 960 ’ frmMain.picScreen.ScaleWidth 'Match the backbuffer width with the display width
    Direct3D_Window.BackBufferHeight = 768 'frmMain.picScreen.ScaleHeight 'Match the backbuffer height with the display height

And replace the frmMain.frm with yours in "\client\src\". (Before make secure copy of yours)

And copy the your main images to "\client\data files\graphics\gui\main\"

**WAY 2**
Do the same like in Way 1 but **DON'T** replace the frmMain.

Add a ComboBox wherever you wan't with the (Name) = "ComboResolution". I add it into the "picOptions" pictureBox.

**Client:**
frmMain

Below:

picCover.Width = picScreen.Width + 2

ComboResolution.AddItem “480x384”
ComboResolution.AddItem “640x480”
ComboResolution.AddItem “800x600”
ComboResolution.AddItem “960x768”
ComboResolution.ListIndex = 0


* * *

At the end of the frmMain add:

’ New Resolution BEGIN
Private Sub ComboResolution_Click()
Dim resWidth, resHeight As Long
Dim res() As String

res() = Split(ComboResolution.List(ComboResolution.ListIndex), “x”)

Direct3D_Window.BackBufferWidth = res(0)
    Direct3D_Window.BackBufferHeight = res(1)

MAX_MAPX = res(0) / 32 - 1
    MAX_MAPY = res(1) / 32 - 1

HalfX = ((MAX_MAPX + 1) / 2) * PIC_X
    HalfY = ((MAX_MAPY + 1) / 2) * PIC_Y
    ScreenX = (MAX_MAPX + 1) * PIC_X
    ScreenY = (MAX_MAPY + 1) * PIC_Y
    StartXValue = ((MAX_MAPX + 1) / 2)
    StartYValue = ((MAX_MAPY + 1) / 2)
    EndXValue = (MAX_MAPX + 1) + 1
    EndYValue = (MAX_MAPY + 1) + 1

’ Change Background
    frmMain.Picture = LoadPicture(App.Path & “\data files\graphics\gui\main\main” & ComboResolution.ListIndex & “.jpg”)

picScreen.Width = res(0)
    picScreen.Height = res(1)

’ Move GUI
    imgHPBar.Left = 518 + (ComboResolution.ListIndex * 160)
    imgMPBar.Left = 518 + (ComboResolution.ListIndex * 160)
    imgEXPBar.Left = 518 + (ComboResolution.ListIndex * 160)
    lblHP.Left = 632 + (ComboResolution.ListIndex * 160)
    lblMP.Left = 632 + (ComboResolution.ListIndex * 160)
    lblEXP.Left = 632 + (ComboResolution.ListIndex * 160)
    lblGold.Left = 568 + (ComboResolution.ListIndex * 160)
    lblPing.Left = 568 + (ComboResolution.ListIndex * 160)

imgButton(1).Left = 523 + (ComboResolution.ListIndex * 160)
    imgButton(2).Left = 603 + (ComboResolution.ListIndex * 160)
    imgButton(3).Left = 683 + (ComboResolution.ListIndex * 160)
    imgButton(4).Left = 523 + (ComboResolution.ListIndex * 160)
    imgButton(5).Left = 603 + (ComboResolution.ListIndex * 160)
    imgButton(6).Left = 683 + (ComboResolution.ListIndex * 160)

picParty.Left = 541 + (ComboResolution.ListIndex * 160)
    picOptions.Left = 541 + (ComboResolution.ListIndex * 160)
    picSpells.Left = 541 + (ComboResolution.ListIndex * 160)
    picInventory.Left = 541 + (ComboResolution.ListIndex * 160)
    picCharacter.Left = 541 + (ComboResolution.ListIndex * 160)

picSSMap.Left = 800 + (ComboResolution.ListIndex * 160)
    picCover.Left = 824 + (ComboResolution.ListIndex * 160)

picAdmin.Left = 544 + (ComboResolution.ListIndex * 160)

picTrade.Left = picScreen.Left + (picScreen.Width / 2 - picTrade.Width / 2)
    picShop.Left = picScreen.Left + (picScreen.Width / 2 - picShop.Width / 2)
    picBank.Left = picScreen.Left + (picScreen.Width / 2 - picBank.Width / 2)

If (ComboResolution.ListIndex = 0) Then
        picHotbar.Top = 399
        picEventChat.Top = 442
        txtMyChat.Top = 565
        txtChat.Top = 442
        frmMain.Width = 11865
        frmMain.Height = 9315
    ElseIf (ComboResolution.ListIndex = 1) Then
        picHotbar.Top = 399 + 96
        picEventChat.Top = 442 + 96
        txtMyChat.Top = 565 + 96
        txtChat.Top = 442 + 96
        frmMain.Width = 14250
        frmMain.Height = 10770
    ElseIf (ComboResolution.ListIndex = 2) Then
        picHotbar.Top = 399 + 216
        picEventChat.Top = 442 + 216
        txtMyChat.Top = 565 + 216
        txtChat.Top = 442 + 216
        frmMain.Width = 16665
        frmMain.Height = 12570
    ElseIf (ComboResolution.ListIndex = 3) Then
        picHotbar.Top = 399 + 384
        picEventChat.Top = 442 + 384
        txtMyChat.Top = 565 + 384
        txtChat.Top = 442 + 384
        frmMain.Width = 18975
        frmMain.Height = 15080
    End If
End Sub
’ New Resolution END

At me it works so far! I hope i moved all windows :)

Hope you enjoy it :)

And to jcsnider :)
You can use it in your next release if you wan't :)

this script work for eo_2_0_0 ? or only [EO - Event System 3.0] Resolution Changer ?

@DepTa:

this script work for eo_2_0_0 ? or only [EO - Event System 3.0] Resolution Changer ?

Than use WAY 2!!! I think it can work but i hope a moderator can answer this 🙂 I personaly don’t know the differents between these both!

The theory works with EO 2.0, the code itself does not, specifically this part:

Direct3D_Window.BackBufferWidth = 960 ' frmMain.picScreen.ScaleWidth 'Match the backbuffer width with the display width
    Direct3D_Window.BackBufferHeight = 768 'frmMain.picScreen.ScaleHeight 'Match the backbuffer height with the display height

Because EO 2.0 runs off of DirectDraw7, not Direct3D8.

BUT there in 2.0 a different line? I think it can be the same… Or only a little different? I look wait 🙂

EDIT
Maybe here?

    With DDSD_BackBuffer
        .lFlags = DDSD_CAPS Or DDSD_WIDTH Or DDSD_HEIGHT
        .ddsCaps.lCaps = DDSD_Temp.ddsCaps.lCaps
        .lWidth = (MAX_MAPX + 3) * PIC_X
        .lHeight = (MAX_MAPY + 3) * PIC_Y
    End With

lWidth and lHeight?

I almost asked how to make it display in 1080p but that would just be too much… lol nice job tho! im gonna try it out now. Thanks  for the tutorial! Soo far it works fine ill see if i can find any bugs k?

isnt it possible to put all the ui elements on the picscreen now that we are working with directx 8?

Also damn dude! 14 posts and your already better at this than me.

Actually with the theory behind this it should be easy to make it adjust to ANY screensize, just grab the user’s native resolution with an API, adjust the backbuffer to it and go from there. Would need to put all the UI elements on the picscreen for that to work properly though. :]

Nice job bro, sigh if only i had waited for this, i changed my resolution manually and edited gui to it QQ.
good tutorial 🙂

hey set your resolution in the game to the low one then walk all the way to the left edge of the map, then set the resolution to the highest one, does your guy go off screen to>?

Maybe when the map ich to small… or? that a little problem with  the engine 🙂 I watch this and see what i can do 🙂

No, it’s because your backbuffer is set to ALWAYS render at full size, so the camera doesn’t work properly on scrolling maps. You’ll need to adjust the resolution of what’s rendered and the camera to the actual current size, not the largest available.

OK i add a fix!

TO ALL:
For the WAY 1 user: Download the new frmMain and make the first change i add to Post 1!

For the WAY 2 user: Do the first change io add in Post 1 and replace the whole “Private Sub ComboResolution_Click()”

The only thing i doesn’t know is what we do when the map is 14x11 (the smallest) and use the highest resolution. At the moment he renders at the bottom right!

in Eclipse Nightly when i search : Private Direct3D_Window As D3DPRESENT_PARAMETERS 'Backbuffer and viewport description.

it didn’t found in Modconstants 😕
and when i research in the whole sources i found 2
Please help me tell me exactly the code and where i have to place it into eclipse nightly

Search for “Direct3D_Window” there are only one declaration 😉 Maybe you have another comment behind or something…

^^ Thank you ! watch i did :

Change:

Private Direct3D_Window As D3DPRESENT_PARAMETERS 'Backbuffer and viewport description.
```To:

Public Direct3D_Window As D3DPRESENT_PARAMETERS 'Backbuffer and viewport description.


Change:

Public Const MAX_MAPX As Byte = 14
Public Const MAX_MAPY As Byte = 11


Public MAX_MAPX As Byte
Public MAX_MAPY As Byte

Change:

Public Const HalfX As Integer = ((MAX_MAPX + 1) / 2) * PIC_X
Public Const HalfY As Integer = ((MAX_MAPY + 1) / 2) * PIC_Y
Public Const ScreenX As Integer = (MAX_MAPX + 1) * PIC_X
Public Const ScreenY As Integer = (MAX_MAPY + 1) * PIC_Y
Public Const StartXValue As Integer = ((MAX_MAPX + 1) / 2)
Public Const StartYValue As Integer = ((MAX_MAPY + 1) / 2)
Public Const EndXValue As Integer = (MAX_MAPX + 1) + 1
Public Const EndYValue As Integer = (MAX_MAPY + 1) + 1


Public HalfX As Integer
Public HalfY As Integer
Public ScreenX As Integer
Public ScreenY As Integer
Public StartXValue As Integer
Public StartYValue As Integer
Public EndXValue As Integer
Public EndYValue As Integer


Change:

   ```
Direct3D_Window.BackBufferWidth = 800 ' frmMain.picScreen.ScaleWidth 'Match the backbuffer width with the display width
    Direct3D_Window.BackBufferHeight = 600 'frmMain.picScreen.ScaleHeight 'Match the backbuffer height with the display height
```To:

   ```
Direct3D_Window.BackBufferWidth = 960 ' frmMain.picScreen.ScaleWidth 'Match the backbuffer width with the display width
    Direct3D_Window.BackBufferHeight = 768 'frmMain.picScreen.ScaleHeight 'Match the backbuffer height with the display height

and after this i didn’t replaced the frmain , i just did everything in the way 2
and when i compile it highlight : “Combo” 😕 what wrong i did?

Did you do all in Way 2? Also add the Private Sub ComboResolution_Click() Is the Combobox filled with the 4 resolutions? Does he anything when you change?

Ohhh my bad i didn’t noticed 😕
It would be nice to put it in quote haha !

Thank you GodWar i’m going to try it

EDIT : Working P-e-r-f-e-c-t-l-y , thanks GodWar to remind me this ^^
But there is another problem when i change the resolution there is the map , but also there is blank on the sides when i try to map this i can’t only i need to resize the map , to map it is it normal?

Yes this is because the map is smaller than the resolution. If you use higher resolutions it is good to maker all maps minimum the maximum resolution 🙂

Oh ok 😛 Thanks!

hey does anyone know how to get the changes to save after logout? so  after you ste your resolution its always like that?

Log in to reply