ViewScreenArea(xPos,yPos,xSize,ySize)

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

I think that a ViewScreenArea command would be a great thing.
When you code something like:

Code: Select all

If OpenWindow(0,0,0,1024,768, #PB_Window_SystemMenu, "Screen Test Window")

  InitSprite(0) 
  OpenWindowedScreen(WindowID(),10,68,1600,1200,1,10,10)
  ...
you are able to create a screen with the resolution of 1600x1200.

Now you have the intention to create a jump and run game and with the command

Code: Select all

ViewScreenArea(0,0,800,600)
you are able to view only 1 quarter of your screen und jump around and when you go to the an edge you switch to the next 'Area' without moving all objects or to create new ones.
You can also leave your 'Mario' allways in the middle of your window and smoothly move the environment.

Or you have the intention to create a CAD files viewer (gerber files) like I do, you are able to zoom in or out, to pan your view to any side and so on (without move or resize your objects around). PureBasic must be fast enough to have a smooth panning or zooming.
And the best of all, with a minimized amount of code!

This would be excellent.

BTW: does anybody know the maximal resolution of a screen? I suppose there must be one...




Have a nice day...
Franco
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

If I understand well, you want to create a virtual screen where you just scroll the x,y edge offset to move it (like on Amiga, cheers :). Unfortunately, the PC GFX cards does do hardware scrolling (or, more precisely, some does it but DirectX doesn't support it). But you have a solution: create a big sprite (1600*1200) which will reside in memory and... use DisplaySprite() x,y to display the background in one go. It's the faster way you can implement scrolling.

BTW, I've done some game test the last days, as I'm writing a nice 2D vertical shoot-em-up engine (800*600*16 with 3 parallax scrolls and alphablending effects, running at 75 fps !) I'm doing and fixing all the PureBasic game commands. And it was some bug left. If some of you want the updated libs, just fire me a mail.

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

Yes this should work for a fixed background sprite (image).

But for an technical application there is no image to move.

I try to explain it better:
Well Fred, I started to play with windowed screen and found out (it was new for me) that a windowed screen can be bigger (virtually resolution) than the resolution of the desktop.
(the last code I wrote contained a virtually screen resolution of 8000x6000)

This is great for coding CAD software (CAD means computer aided design).
And as the first step (wanted to figure out if it is possible with PB) I wanted to code a gerber file viewer. Gerber files are ascii files that contains coordinates of lines, squares and other stuff which are used to build printed circuits boards.

I thought it must be possible to create a 2D coordinate area with OpenWindowedScreen and to draw all the stuff that is in a gerber file. For now I draw stuff 'hard' coded without reading a input file (proof of concept...)

I can draw stuff and if I change the size of OpenWindowedScreen I can zoom in and out.
Circles with a fixed size are bigger or smaller depends if I increase or decrease the size of a windowed screen.

Unfortunately to change the resolution of a windowed screen is not useful for this, and you always start at 0,0.

To see only a part of a complete printed circuit board a zooming/panning function like ViewScreenArea is needed, but I don't know if this is possible.
Hope I explained it better as the first time.




Have a nice day...
Franco
Post Reply