Page 1 of 1

CreateDisplay, what options should I use?

Posted: Wed Dec 04, 2024 7:55 am
by Bugala
Can someone give some more explanation about CreateDisplay options, as in, which options should I use, and clarifications on some of them too.

Like there is this ScaleWidth and ScaleHeight. Which way does this work. Does it mean that If my game runs on 1920x1080, then if I set ScaleWidth and Height as 800x600, it will scale down that 1920x1080 to 800x600, or does it mean that Scalewidth and Height tells the original size, as in this case should be 1920x1080?

Then more importantly comes the question of what options should I use when I am opening display for AOS3, AOS4, MorphOS, Windows?

If I correctly remember, Andreas in one topic here said that Mode="ask" is not necessarily a good idea to use anymore, since it is so old implementation.

Basically what I am wanting to achieve, is a display that has some original dimensions of, for example, 1920x1080, but which in the end can be opened to any size, and then is scaled to that size from the 1920x1080.

Re: CreateDisplay, what options should I use?

Posted: Wed Dec 04, 2024 7:17 pm
by plouf
scalewidth/height

scales (software resize) hollywood display in case you have specify ScaleMode , to actual size of display

in CreateDisplay()
- Width, Height creates a hollywood dispaly ( a canva which we draw) and this is its size
- ScrWidth, ScrHeight is the resolution of the display, in case of fullscreen this is equal to SCREEN (aka actual monitor display)
- ScaleWidth,ScaleHeight this is the size of the RESIZED (stretched) canva (width/height) in these new dimensions (ScaleMode must ALSO be specified)

so in case of opening a 640*480 display in a 800*600 fullscreen screen, its like opening a borderless "window" in this new (full black) screen
Hollywood by default center's its position but you can also position this "window" with X,Y parameters

scaling does as you have understand!
for fullscreen for example, you can create a hollywood display at any resolution you like, i.e.
Width=800, Height=600, draw at these dimensions ONLY, but open a SCREEN
ScrWidth=1920, ScrHeight=1080 , which is the resolution monitor will open and scale (resize) it fullscreen
ScaleWidth=1920,ScaleHeight=1080, so hollywood will use resize its display (canva) to fit screen exacly in this case

also in this example
its also possible to resize it at ScaleWidth=1440,ScaleHeight=768, in this case balck border with 240pixels left//240pixels right/156 top/156 down
its also possible to resize to smaller dimension ScaleWidth=320,ScaleHeight=240 , yes hollywood will shrink its display

however scalling in AOS3, may NOT be a good idea , since scalling uses GPU, where is practically unavailable there, so switch to softwre and becomes slower
also scalling loses some quality (except vector but...usually we go with bitmaps all :))


the following example it may be helpfull (some of these have now cleared to my mind too )

Code: Select all

Function ScreenModeRequest(DisplayModes,CustomTitle$,CustomText$)
	Local Screensizes = CreateList()
	For Local k = 0 To ListItems(DisplayModes) - 1
		 InsertItem(ScreenSizes,DisplayModes[k].Width.." x "..DisplayModes[k].Height)
	Next
	If CustomTitle$=Nil
		CustomTitle$="Screen Mode Request"
	EndIf
	If CustomText$=Nil
		CustomText$="Please Select Screen Size"
	EndIf
	selected = ListRequest(CustomTitle$,CustomText$,ScreenSizes)
	Return(DisplayModes[selected].Width,DisplayModes[selected].Height)
EndFunction

p_Width,p_Height           = ScreenModeRequest(GetDisplayModes(),Nil,"for HOLLYWOOD DISPLAY")
p_scrWidth,p_scrHeight     = ScreenModeRequest(GetDisplayModes(),Nil,"for MONITOR SCREEN")
p_ScaleWidth,p_ScaleHeight = ScreenModeRequest(GetDisplayModes(),Nil,"for SCALING RESIZE")

CreateDisplay(3, {Width=p_Width,Height=p_Height,scrWidth=p_scrWidth,scrHeight=p_scrHeight,scalemode=#SCALEMODE_AUTO,ScaleWidth=p_ScaleWidth,ScaleHeight=p_ScaleHeight,Mode="FullScreen", Active=True})

OpenDisplay(3)

SelectDisplay(3)
BeginDoubleBuffer()

Cls(#GREEN)
SetFontColor(#YELLOW)

For i=0 To p_Height Step 20
	Line(0,i,p_Width,i)
	TextOut(0,i,StrStr(i))
Next 

For i=0 To p_Width Step 20
	Line(i,0,i,p_Height)
	TextOut(i,(i/20)*10,StrStr(i))
Next

Flip()
	
DebugPrint("Current."..GetAttribute(#DISPLAY, 3, #ATTRRAWWIDTH).. " x " ..GetAttribute(#DISPLAY, 3, #ATTRRAWHEIGHT))
DebugPrint("MAX ...."..GetAttribute(#DISPLAY, 3,#ATTRMAXWIDTH ).. " x " ..GetAttribute(#DISPLAY, 3, #ATTRMAXHEIGHT))
DebugPrint("HOST...."..GetAttribute(#DISPLAY, 3,#ATTRHOSTWIDTH).. " x " ..GetAttribute(#DISPLAY, 3, #ATTRHOSTHEIGHT))
WaitLeftMouse()

Re: CreateDisplay, what options should I use?

Posted: Thu Dec 05, 2024 8:11 am
by Bugala
Thanks a lot from this one!

The example was good to explain the difference on those, and in addition, I have never realised before there is this List Request command, I think that might be useful in the future.