News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

Stretching the window automatically

Started by Laskiapina, August 05, 2010, 02:45:13 AM

Previous topic - Next topic

Laskiapina

Since you can drag the corners of the window to stretch it, is it possible to stretch it automatically say to double size?
I'm working on a project that uses 320x240 resolution and it would be nice to stretch it so you can see it more clearly.
I know you can just draw bigger pictures and make it look more like it has bigger pixels, that's what I used on my project Meals of the Dragon, but I just thought would this be possible.
Finished projects so far: Kumiankka, Meals of the Dragon, Fisut, Draw Old, Reikäkopio, Blindage, Escape from Millmier

Homepage: Not yet named project

kevin

#1
   You can stretch window modes using the windows API, but it's not a built in thing.  But probably should be.

  Try this -> Full Screen Window and see if you can tweak it into something like what you're after.


   Another way is creating a FX buffer, then stretching that to the window size.

 
   
ScreenWidth=320
ScreenHeight=240

ScalerX=2
ScalerY=2

openscreen ScreenWidth*scalerX,ScreenHeight*ScalerY,32,1


Buffer=newfximage(Screenwidth,Screenheight)


Do

rendertoimage Buffer

if Timer()>ClearTime
Cls 0
ClearTime=timer()+1000
endif


ink rndrgb() | $ff000000
text rnd(ScreenWidth),Rnd(ScreenHeight),"Hello World"


Show(Buffer)
loop


Function Show(Buffer)
rendertoscreen
SW=GetScreenWidth()
SH=GetScreenWidth()

tw=GetImageWidth(buffer)
th=GetImageHeight(buffer)

TextureQuad BUffer,0,0,0,0,sw,0,tw,0, sw,sh,tw,th, 0,sh,0,th,false

Sync
EndFunction

   


Laskiapina

The code snippet didn't do anything for some reason. Isn't it supposed to show text in random places?
Anyway the FullScreenWindow worked just fine when I assembled this together:

linkdll "user32.dll"
SetWindowLong(hWnd,Offset,Value) alias "SetWindowLongA"
GetWindowLong(hWnd,Offset) alias "GetWindowLongA" as integer
   SetWindowPos(hwnd,hWndInsertAfter,x,y,cx,cy,wFlags) alias "SetWindowPos" As integer
Endlinkdll

//  Get the Desk top width/height
dtw=GetDesktopWidth()
dth=GetDesktopHeight()

// Get the PB screens window Handle
hwnd=GetScreenHandle()

; Stretch the window to the size users display size
          SetWindowPos(hwnd,hWndInsertAfter,0,0,dtw,dth,wFlags)


Do all people on different Windows' have that user32.dll by the way? I'm not that familiar with dlls.
Finished projects so far: Kumiankka, Meals of the Dragon, Fisut, Draw Old, Reikäkopio, Blindage, Escape from Millmier

Homepage: Not yet named project

kevin

QuoteThe code snippet didn't do anything for some reason.

It's written in PBV1.64M.   Which supports windows fonts to be drawn onto FX buffers.  Older versions can't do this.


QuoteDo all people on different Windows' have that user32.dll by the way? I'm not that familiar with dlls.

   Yep..