Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO - Event System 3.0] Resolution Changer


GodWar
 Share

Recommended Posts

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:**
[![](http://www.freemmorpgmaker.com/files/imagehost/pics/bf8096b85a741f4c3f4b98d50d253717.png)](http://www.freemmorpgmaker.com/files/imagehost/#bf8096b85a741f4c3f4b98d50d253717.png)

**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

```To:
```
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
```To:
```
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 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
```Add:
```
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 :)
Link to comment
Share on other sites

@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!
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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?
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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. :]
Link to comment
Share on other sites

Nice job bro, *sigh* if only i had waited for this, i changed my resolution manually and edited gui to it QQ.
good tutorial :)
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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!
Link to comment
Share on other sites

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
Link to comment
Share on other sites

^^ 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
```To:

```
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
```To:

```
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?
Link to comment
Share on other sites

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?
Link to comment
Share on other sites

  • 3 weeks later...
I don't know why, but **in 960x768 when the x map size = 30 , there is a scrolling bug**.
If you **set x = 29 or x = 31 there is no bug**.

1 map size = 32px
30 x 32 = 960px, but it seems the game tries to scroll..

I guess you can find the **same scrolling bug with y map size = 24**
(24 x 32 = 768)
Link to comment
Share on other sites

  • 2 months later...
  • 5 months later...
Wasnt looking for anything custom just for default moved out to properdistances..

I did it it just took some time and still does not match up 100 percent.

Also if any one has added anything from default (quest or anything)

be sure to find

imgButton(6).Left = 683 + (ComboResolution.ListIndex * 160)

picParty.Left = 541 + (ComboResolution.ListIndex * 160)

and add

YOURWINDOWNAME.Left = YOUR NUMBER + (ComboResolution.ListIndex * 160)

or button Notice the number that is the ZERO offset (default gui)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...