Author Topic: Recreating VBDOS  (Read 5234 times)

0 Members and 1 Guest are viewing this topic.

Offline BigPete

  • Newbie
  • Posts: 3
    • View Profile
Recreating VBDOS
« on: September 03, 2020, 10:06:27 am »
Hi All

This must be the most unnecessary question ever.
I Program in other Windows platforms, but something that stuck with me was old VBDOS.
That is where Form dragging etc started, long before windows.
I would love to just make something like that, or emulate that functionality.

Probably stupid, and no need ever for it, but if i would like to work in a Dos screen (Screen 0) how would one go about making a form you can drag?
They did it back then, so it can be done.
I still long for those days and the simplicity of the old Dos screen wares. Imagine powering it up with QB64?
Any thoughts would be great

Pete

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Recreating VBDOS
« Reply #1 on: September 03, 2020, 12:04:49 pm »
@BigPete welcome to the forum!

VBDOS released in 1991, was a great PL coming at a time when Windows graphics were still running too slow on older chips so VBWIN wasn't too impressive. Great easy to use GUI integrated with editor for event programming. I just read up that it was interpreted, didn't remember that part.

@FellippeHeitor has developed a GUI forms maker that works with QB64 called InForm, it runs outside the editor to create forms and starts SUBs for events like VBDOS did that you finish coding in QB64. You might want to check it out from QB64.org Homepage and the InForm Board at this forum.

« Last Edit: September 03, 2020, 12:07:44 pm by bplus »

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Recreating VBDOS
« Reply #2 on: September 03, 2020, 01:03:48 pm »
Yeah, if inform is possible then there's no reason why a SCREEN 0 variant isn't.  Along with inform, I and a few others have examples of GUI elements including windowing, resizing, dragging, etc.  I've made a simple SCREEN 0 windowing engine before in QB and I was relying on SCREEN and PCOPY for page flipping and double buffering for smooth drags and resizes given that QB doesn't have _DISPLAY.  Not sure about SCREEN 0 in QB64.

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: Recreating VBDOS
« Reply #3 on: September 03, 2020, 11:12:17 pm »
Another way to get fast display with old QB is to use SCREEN 9.  It has two pages - write to
the one in the background and flip to it.  But it's only 640*350*16.  QB64 faithfully recreates
this screen mode.
It works better if you plug it in.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Recreating VBDOS
« Reply #4 on: September 03, 2020, 11:39:25 pm »
Another way to get fast display with old QB is to use SCREEN 9.  It has two pages - write to
the one in the background and flip to it.  But it's only 640*350*16.  QB64 faithfully recreates
this screen mode.

ALL QB64 screens have multiple pages you can make use of, if you want to employ screen flipping.  You don't have to stick to just SCREEN 9.

A simple demo of page flipping while in 32-bit color mode.

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(640, 480, 32)
  2.  
  3. SCREEN , , 1, 0
  4. LINE (100, 100)-(200, 200), Red, BF
  5. PRINT "Page 1"
  6. SCREEN , , 0, 0
  7. PRINT "Page 0"
  8.  
  9.     x = NOT x
  10.     SCREEN , , 0, x
  11.     SLEEP
  12.  

In fact, you're not limited to only using 2 pages either, with QB64.  You can use as many pages as you have memory, as highlight below with this simple demo which creates and flips between 11 different pages (0 to 11).

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(640, 480, 32)
  2.  
  3. FOR i = 0 TO 10
  4.     SCREEN , , i, 0
  5.     LINE (100 + 10 * i, 100 + 10 * i)-STEP(100, 100), Red, BF
  6.     PRINT "Page"; i
  7.  
  8.     SCREEN , , 0, x
  9.     x = (x + 1) MOD 11
  10.     SLEEP
  11.  
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline BigPete

  • Newbie
  • Posts: 3
    • View Profile
Re: Recreating VBDOS
« Reply #5 on: September 04, 2020, 06:10:08 am »
Thanks guys

I was wondering about how they declared an object in vbdos back then.
I would love to have seen their code for a forms drag.

Its weird how the old, no longer relevant things stick with you.
Suppose its much like a classic car, you have a better one now, but there is just something about the classic one that makes you take it out for a spin.

Nowadays its visual designers, .net , and Java, but I still remember my old VBdos.

Regards- Pete

Offline Unseen Machine

  • Forum Regular
  • Posts: 158
  • Make the game not the engine!
    • View Profile
Re: Recreating VBDOS
« Reply #6 on: September 04, 2020, 09:06:06 am »
Quote
That is where Form dragging etc started, long before windows.
I would love to just make something like that, or emulate that functionality.

Here's my effort,

Code: QB64: [Select]
  1. '//////////////////////////////////////////////////////////////
  2.  
  3. '// VQB 04 - BASE CODE v.01
  4. '// By John Onyon a.k.a Unseen Machine
  5.  
  6. '// Include library TYPE defs and CONSTANTS
  7. REM $INCLUDE:'VQB\VQB.bi'
  8.  
  9. '// Set root directory to load all VQB required files (icons, mouse pointers, fonts, etc...)
  10. '// Only needed if youre using dialogs
  11. CHDIR "VQB\"
  12.  
  13. '// You wanna use the mouse so create a MouseInfo array to handle mouse events
  14. DIM Mouse(1) AS MouseInfo
  15.  
  16. '// Create a screen at position at 0,0, size of 1024 * 768  and set title
  17. VQB_Screen 0, 0, 1024, 768, _RGB32(120, 110, 100), "VQB 04 Base Code" '// Set title to whatever your program is called
  18.  
  19. '// The state of the program, generic icons and mouse pointer icons are stored in a predefined type array PROGRAM_STATE
  20. '// The update call for this handles all window events, moving, layers and resizing.
  21.  
  22. '// so lets create the array
  23. DIM ProgState AS PROGRAM_STATE
  24.  
  25. '// Variables are - Use GFX Mouse, Total windows, Screen width, Screen height
  26. VQB_PROGRAM_STATE_NEW ProgState, TRUE, 2, 1024, 768
  27.  
  28. '// Each element of your program can have it's own window (DIALOG).
  29. '// Create the DIALOG array
  30. DIM Program(1) AS DIALOG
  31. '// Now set up each window
  32. '// Set's MultiTask, X,Y,Width,height,background colour,Window title and Resize true/false
  33. VQB_DIALOG_NEW Program(0), FALSE, 0, 0, 640, 480, _RGB32(0, 0, 0), "New Program", FALSE
  34. VQB_DIALOG_NEW Program(1), FALSE, (ProgState.WSI / 2) - 320, (ProgState.HSI / 2) - 240, 640, 480, _RGB32(0, 0, 0), "New Program 2", FALSE
  35.  
  36. '// Create two buttons, one to launch each window
  37. DIM WndBtn(1) AS Button
  38.  
  39. '// Set the buttons up
  40. VQB_Button_New WndBtn(0), 20, 20, 120, 40, _RGB(255, 0, 0), _RGB(0, 0, 0), "YOUR New App", 1
  41. VQB_Button_New WndBtn(1), 160, 20, 120, 40, _RGB(255, 0, 0), _RGB(0, 0, 0), "Another App", 1
  42.  
  43.  
  44.  
  45. '###########################################################################################################################
  46.  
  47.  
  48.  
  49.  
  50.   CLS
  51.  
  52.   _LIMIT 45
  53.  
  54.   '// get the current state iof the mouse and store it in the array
  55.   VQB_Mouse_GetInfo Mouse(0)
  56.  
  57.   '// Check for button clicks
  58.   FOR i% = 0 TO 1
  59.     IF VQB_Button_Click(WndBtn(i%), Mouse(0)) AND NOT Mouse(1).LMB THEN
  60.       IF Program(i%).Running = FALSE THEN '// program has not been started
  61.  
  62.         SELECT CASE i%
  63.  
  64.           CASE 0 '// New program 1
  65.  
  66.             New_Program Program(0), Mouse(), START_PROGRAM
  67.  
  68.           CASE 1 '// new program 2
  69.  
  70.             New_Program_2 Program(1), Mouse(), START_PROGRAM
  71.  
  72.         END SELECT
  73.  
  74.         '// update it's position in the stack
  75.         VQB_RUN_PROGRAM ProgState, i%, Program()
  76.  
  77.       ELSE '// program has been started but either closed or minimised
  78.  
  79.         VQB_RUN_PROGRAM ProgState, i%, Program()
  80.  
  81.       END IF
  82.  
  83.  
  84.     END IF
  85.   NEXT
  86.  
  87.  
  88.   '// Draw the buttons
  89.   VQB_Button_Draw WndBtn(0)
  90.   VQB_Button_Draw WndBtn(1)
  91.  
  92.   '// Check for any changes in the state of the program (switching between windows/window events)
  93.   '// Also renders opn dialog windows in order and renders GFX mouse pointers
  94.   ProgramEvent% = VQB_PROGRAM_STATE_UPDATE(ProgState, Mouse(), Program())
  95.  
  96.   '// Run through open apps and update the top level window
  97.   FOR i% = 0 TO ProgState.TotalApps - 1
  98.  
  99.     IF Program(i%).Running = TRUE THEN
  100.  
  101.       IF Program(i%).Layer = ProgState.CurrentLayer - 1 THEN '// program on the top layer
  102.  
  103.         SELECT CASE i%
  104.  
  105.           CASE 0
  106.             New_Program Program(i%), Mouse(), UPDATE_PROGRAM
  107.  
  108.           CASE 1
  109.             New_Program_2 Program(i%), Mouse(), UPDATE_PROGRAM
  110.  
  111.         END SELECT
  112.  
  113.       END IF
  114.  
  115.     ELSE '// Not top window but need to check for multitask apps (for a future tutorial)
  116.  
  117.     END IF
  118.  
  119.   NEXT
  120.  
  121.  
  122.   '// Copy mouse state for future comparisons
  123.   Mouse(1) = Mouse(0)
  124.  
  125.   '// Update the display
  126.  
  127.  
  128. '###########################################################################################################################
  129. REM $INCLUDE:'VQB\VQB_04.bm'
  130. '###########################################################################################################################
  131.  
  132.  
  133.  
  134. SUB New_Program (DState AS DIALOG, Mouse() AS MouseInfo, ACTION%)
  135.   SELECT CASE ACTION%
  136.     CASE START_PROGRAM
  137.  
  138.  
  139.       '// Any variable you need to store needs to be set as STATIC
  140.       '// These are DIM'd here
  141.       STATIC App_Mouse(1) AS MouseInfo
  142.  
  143.  
  144.  
  145.     CASE UPDATE_PROGRAM
  146.  
  147.       '// Handle input
  148.  
  149.       '// Clone mouse data
  150.       App_Mouse(0) = Mouse(0)
  151.  
  152.       '// - Make mouse position relative to window
  153.       VQB_Mouse_Adjust DState, Mouse(0), App_Mouse(0)
  154.  
  155.       '// Logic here
  156.  
  157.  
  158.  
  159.  
  160.       '// Draw the output
  161.       '// Switch to dialogs image
  162.       _DEST DState.Image
  163.       CLS
  164.       PAINT (0, 0), DState.CLR
  165.  
  166.       '// Do all your rendering here
  167.  
  168.  
  169.  
  170.       '// switch back to desktop
  171.       _DEST 0
  172.  
  173.  
  174.     CASE UPDATE_PROGRAM_NO_INPUT '// For multitask apps
  175.  
  176.  
  177.     CASE END_PROGRAM
  178.  
  179.   App_Mouse(1) = App_Mouse(0)
  180.  
  181. '###########################################################################################################################
  182.  
  183. SUB New_Program_2 (DState AS DIALOG, Mouse() AS MouseInfo, ACTION%)
  184.   SELECT CASE ACTION%
  185.     CASE START_PROGRAM
  186.  
  187.       STATIC App_Mouse(1) AS MouseInfo
  188.  
  189.  
  190.  
  191.     CASE UPDATE_PROGRAM
  192.  
  193.       '// Handle input
  194.  
  195.       '// Clone mouse data
  196.       App_Mouse(0) = Mouse(0)
  197.  
  198.       '// - Make mouse position relative to window
  199.       VQB_Mouse_Adjust DState, Mouse(0), App_Mouse(0)
  200.  
  201.  
  202.       '// Perform logic here
  203.  
  204.  
  205.       '// Draw the output
  206.       '// Switch to dialogs image
  207.       _DEST DState.Image
  208.       CLS
  209.       PAINT (0, 0), DState.CLR
  210.  
  211.       '// Do all your rendering here
  212.  
  213.  
  214.  
  215.       '// switch back to desktop
  216.       _DEST 0
  217.  
  218.  
  219.     CASE UPDATE_PROGRAM_NO_INPUT '// For multitask apps
  220.  
  221.  
  222.     CASE END_PROGRAM
  223.  
  224.   App_Mouse(1) = App_Mouse(0)
  225.  
  226.  

Unzip the attached files to your qb64 folder.

Unseen

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Recreating VBDOS
« Reply #7 on: September 04, 2020, 11:21:57 am »
Hi BigPete
on www.[abandoned, outdated and now likely malicious qb64 dot net website - don’t go there] I posted a RAD program in ASCII 0 that  I named DRAW BASIC and you can draw window with components by mouse, all in ASCII. But it is lost on a my old HDD and in the [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]/forum. The code is pure QB45 adapted to QB64.
But it is a joke in respect of Unseen library VBQ!
Programming isn't difficult, only it's  consuming time and coffee

Offline BigPete

  • Newbie
  • Posts: 3
    • View Profile
Re: Recreating VBDOS
« Reply #8 on: September 08, 2020, 06:37:31 am »
That is pretty neat work.
All of you.

Regards- Pete