June 17, 2019, 04:45:11 PM

Author Topic: My BLITZ3D game in 320x240... fullscreen ?  (Read 791 times)

Offline drfloyd

  • Jr. Member
  • **
  • Posts: 35
My BLITZ3D game in 320x240... fullscreen ?
« on: November 15, 2018, 07:31:09 PM »

How are you !?

My name is Dr FLoyd, french "casual" coder ! :)

Some of my games in BLTZ3D

I am about to finish my new game in BLITZ 3D... in full 2D :

But this time my game is in 320x240 pixels ! So Windowed only... Our screens do not accept this resolution.

Is there a possibility/tips to transform the game in fullscreen ???? Virtualisation ?

Thank you for your help

PS : in the past, I have already see that but It was complicate :

Offline Naughty Alien

  • Hero Member
  • *****
  • Posts: 590
Re: My BLITZ3D game in 320x240... fullscreen ?
« Reply #1 on: November 16, 2018, 12:54:08 AM »
..hello man...everything is possible here...welcome mann..

Offline RemiD

  • Hero Member
  • *****
  • Posts: 805
Re: My BLITZ3D game in 320x240... fullscreen ?
« Reply #2 on: November 17, 2018, 01:42:35 PM »
@drfloyd>>i have posted a code example to do exactly that,
the idea was to stretch a 320x200 image on a quad mesh (using a texture and specific UVs), the code is somewhere on this forum...
https://www.syntaxbomb.com/index.php/topic,3658.327.html (#327)

i have used this method for the 320x200 compo last year... see : https://www.syntaxbomb.com/index.php/topic,3991.0.html

DualCore AMD E-450, 1646 MHz - 6 Go DDR3 1333 SDRAM - AMD Radeon HD 6320 Graphics (384 Mo) - Windows 7 Home Premium - DirectX 11.0

Offline Dan

  • Jr. Member
  • **
  • Posts: 2
Re: My BLITZ3D game in 320x240... fullscreen ?
« Reply #3 on: November 20, 2018, 08:56:28 AM »
with blitzbasic, you can setup low res graphic mode, but use hardware stretching to make the window size bigger.

To do this you would set, first the desired window size e.g 800x600. Then you set the Graphic mode of 320x200. This will be resized to the 800x600 automatically.

Code: [Select]
Graphics 800,600,32,2
Graphics 320,200,32,3

Print "hi"

For testing purpose, i do use following function:

Code: [Select]
Function Screen(defaultx=320,defaulty=240,Stretchx=640,Stretchy=480)
;bits=api_GetDeviceCaps(api_GetDC( api_GetDesktopWindow()),12)   ;Userlib function - Get Desktop Bit size
bits=32  ;Set color depth manually
Graphics Stretchx,Stretchy,bits,2
Graphics defaultx,defaulty,bits,3
End Function

or following function, which uses user32 and gdi32 userlib:

Code: [Select]

;.lib "gdi32.dll"
;api_GetDeviceCaps% (hdc%, nIndex%) : "GetDeviceCaps"

;.lib "user32.dll"
;api_GetActiveWindow% () : "GetActiveWindow"
;api_GetDC% (hwnd%) : "GetDC"
;api_GetDesktopWindow% () : "GetDesktopWindow"
;api_GetSystemMetrics% (nIndex%) : "GetSystemMetrics"
;api_MoveWindow% (hwnd%, x%, y%, nWidth%, nHeight%, bRepaint%) : "MoveWindow"
;api_SetWindowLong% (hwnd%, nIndex%, dwNewLong%) : "SetWindowLongA"

Function Screen(x,y,full=0)
;fill <0 = Fulldesktop, borderless window
;full =0 = Fulldesktop
;full =1 = original x,y
;full >1-5 = x*full,y*full size
;full >5 = 0
If x>DeskX Then x=DeskX
    If x<64 Then x=64
If y>DeskY Then y=DeskY
    If y<64 Then y=64
    bits=api_GetDeviceCaps(api_GetDC( api_GetDesktopWindow()),12)
Graphics x,y,bits,6
Graphics x,y,bits,7
If full<=0 Or full>5
If full<0 Then api_SetWindowLong(api_GetActiveWindow(), -16, $10000000)
If full>1 And full<=5 Then api_MoveWindow(api_GetActiveWindow(),0,0,x*full,y*full,True)
End Function

There is another way to display low res Graphic in bigger window, but it can be a bit slow on lower end machines.
Instead using 3d function, this ones uses software resizing.

You draw the game happenings on a imagebuffer instead of backbuffer.
Then after changing to backbuffer you resize the game image and after resizing you paste it on the backbuffer.

Code: [Select]
Function DrawSizeImage(image,x%,y%,w%,h%)
;Global scratch%=CreateImage(SW,SH)                ; create a scratch image
     Local ih%=ImageHeight(image)
     Local iw%=ImageWidth(image)

     Local sw%=Abs(w)
     Local sh%=Abs(h)
     Local xr#=(Float(iw)/Float(sw))
     Local yr#=(Float(ih)/Float(sh))
     Local vf=-1+((h>0)*2)
     Local fw=(w<0)*w
     Local fh=(h<0)*h
     If w>=0
          For ix=0 To sw
               CopyRect ix*xr,0,1,ih,ix,0,fromimg,toimg
          For ix=0 To sw
               CopyRect ix*xr,0,1,ih,sw-ix,0,fromimg,toimg

     For iy=0 To sh
          CopyRect 0,iy*yr,sw,1,x+fw,y+(iy*vf),toimg
End Function

eh, Déjà vu ??

Offline peteswansen

  • Jr. Member
  • **
  • Posts: 52
Re: My BLITZ3D game in 320x240... fullscreen ?
« Reply #4 on: December 04, 2018, 07:46:05 PM »
on my 1920x1080 monitor 320 by 240 does not work but 640x480 in mode 1 (fullscreen) produces a image with a large black border..

Offline MagosDomina

  • Full Member
  • ***
  • Posts: 121
    • Aspiring game developer website.
Re: My BLITZ3D game in 320x240... fullscreen ?
« Reply #5 on: January 04, 2019, 11:55:35 PM »
I would seriously consider scaling your games graphics to use a more modern resolution (at least 800x600) but maintain the look of 320x240 by either realtime scaling or simply compensate by scaling your actual art files to be larger.

320x240 works fine on Analog displays but will cause nothing but issues on digital displays.
Central hub for my Game Design related activities.

Windows 7 PRO 64-bit, 48Gb RAM, CPU: Dual Hexacore Intel Xeon 3.33 GHZ, Nvidia Quadro 5800FX 4Gb x 2 SLI.