Author Topic: VQB .04  (Read 5309 times)

0 Members and 1 Guest are viewing this topic.

Offline Unseen Machine

  • Forum Regular
  • Posts: 158
  • Make the game not the engine!
    • View Profile
VQB .04
« on: August 13, 2018, 05:28:35 pm »
Hi Guys

Extract files to your QB64 directory.

For an advanced demo....
Open Qb_Desk_03.bas in QB64, run it and hopefully it works. Press ESC to exit the program.

Included is a file called 'VQB_SUB_DUMP' this is a basic reference for commands. Ill make some more documents and demos available soon.

Unseen

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: VQB .04
« Reply #1 on: August 14, 2018, 04:10:49 am »
It's not that I do not trust you, but before adding stuff to my directory(ies), I would like to know what VQB and QBDesk actually do...

J
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: VQB .04
« Reply #2 on: August 14, 2018, 07:41:38 am »
Hi Johnno,

Here is a snap of the Desk and the descriptions:

After extracting both .rar I had to copy VQB into QBDesk folder then I realized I had to eliminate the redundant  folder that extract always adds.

I tried the Desktop Icons and only got 1 Demo of 5 displayed, the Games that looked like they may be ready did nothing when I clicked the buttons.

So far, if this is all there is, I'd say don't waste the space but I am certain Unseen has more to come and this is a teaser he is eager to show us.

  [ You are not allowed to view this attachment ]  

This isn't too long for code window:
Code: QB64: [Select]
  1. #######################################################################################################
  2. ##########################   Visual QB v.04   #########################################################
  3. #######################################################################################################
  4. ######################   SUB/FUNCTION Reference   #####################################################
  5. #######################################################################################################
  6.  
  7.  
  8.  
  9.  
  10.  
  11. SUB VQB_Screen (X%, Y%, Width%, Height%, CLR&, Title$)
  12.  
  13.         - Creates a Screen (Width% * Height), positioned at X%, Y%.
  14.         - CLR& is a _RGB32 value and designates the background colour.
  15.         - Title$ sets the program title.
  16.  
  17.  
  18. SUB VQB_StoreScreen (ImageHandle&)
  19.  
  20.         - Stores a copy of the screen to the given handle.
  21.  
  22.  
  23. SUB VQB_RestoreScreen (ImageHandle&)
  24.  
  25.         - Restores a previously saved screen image
  26.  
  27.  
  28. SUB VQB_Frame (X%, Y%, Width%, Height%, CLR&)
  29.  
  30.         - Draws a graduated frame at X%, Y%
  31.         - CLR& is and _RGB32 value
  32.  
  33.  
  34. SUB VQB_Button_New (Button AS Button, X%, Y%, Width%, Height%, CLR&, TextClr&, Text$, Shape%)
  35.  
  36.         - Creates a new button
  37.         - X%, Y%, Width% and Height% are dicated by the Shape% variable
  38.           1 = Rectangle(X%, Y% are top left, Width% and Height% are obvious)
  39.           2 = Circular (X%,Y% are center, Width% and Height% dictate shape of ellipse)
  40.  
  41.        
  42. SUB VQB_Button_Draw (Button AS Button)
  43.  
  44.         - Draws the button specified
  45.  
  46.  
  47. FUNCTION VQB_Button_Click (Button AS Button, Mouse AS MouseInfo)
  48.  
  49.         - Returns TRUE if the button was clicked by the left mouse button, FALSE if not.
  50.  
  51.  
  52. SUB VQB_CheckBox_New (CBox AS CheckBox, X%, Y%, Width%, Height%, CheckVal%)
  53.  
  54.         - Creates a new check box at X%, Y%, Dimensions are controlled with Width%, Height%
  55.         - CheckVal% is TRUE or FALSE
  56.  
  57.  
  58. SUB VQB_CheckBox_Draw (CBox AS CheckBox)
  59.  
  60.         - Draws a specified checkbox
  61.  
  62.  
  63. FUNCTION VQB_CheckBox_Click (cBox AS CheckBox, Mouse AS MouseInfo)
  64.  
  65.         - Checks if the checkbox has been clicked, returns either TRUE or FALSE
  66.         - DOES NOT CHANGE CHECK VALUE - YOU MUST DO IT MANUALY
  67.  
  68.  
  69. SUB EllipseXS (X%, Y%, XRadius!, YRadius!, Wide%, CLR&, ShadeClr&)
  70.  
  71.         - Only called by VQB_BUTTON_DRAW when round buttons are used.
  72.  
  73.  
  74. SUB VQB_Mouse_GetInfo (Mouse AS MouseInfo)
  75.  
  76.         - Gets the state of the left and right mouse buttons and X, Y position of the mouse, stored in the given MOUSE_INFO array
  77.  
  78.  
  79. SUB VQB_AutoFont (Size%)
  80.  
  81.         - Loads and sets the VQB standard font to the specified Size%
  82.  
  83.  
  84.  
  85. ########################################### NEW FEATURES ##########################################
  86.  
  87. SUB VQB_Dialog_Font_Load (DState AS DIALOG, FontFile$, Size%)
  88.  
  89.         - Internal SUB, NOT USED BY END USER
  90.  
  91.  
  92. SUB VQB_Dialog_Font_Set (Dstate AS DIALOG)
  93.  
  94.         - INTERNAL SUB, NOT USED BY END USER
  95.  
  96.  
  97. SUB VQB_PROGRAM_STATE_NEW (PState AS PROGRAM_STATE, GFX_Mouse%%, TotalApps%%, WSI%, HSI%)
  98.  
  99.         - Sets up the initial program info
  100.         - GFX_Mouse%% - Either TRUE or FALSE, dictates if the program uses the custom mouse pointers
  101.         - TotalApps%% - Total number of dialogs in the program
  102.         - WSI% - Screen Image Width
  103.         - HSI% - Screen Image Height
  104.  
  105.  
  106. FUNCTION VQB_PROGRAM_STATE_UPDATE (PState AS PROGRAM_STATE, Mouse() AS MouseInfo, Dialog() AS DIALOG)
  107.        
  108.         - Updates all active dialogs
  109.         - Draws all active dialogs in order
  110.         - Draws GFX mouse pointer (if in use)
  111.  
  112.  
  113. SUB VQB_DOCK_NEW (Dock AS DOCK, NumItems%%, MaxItems%%, Colour~&, Allign%%, Reflect%%, Hide%%, WSI%, HSI%)
  114.        
  115. SUB VQB_DOCK_ITEM_NEW (DockItem AS DOCK_ITEM, FileName$, Text$)
  116.  
  117. FUNCTION VQB_DOCK_UPDATE (Dock AS DOCK, DockItem() AS DOCK_ITEM, Mouse() AS MouseInfo)
  118.        
  119.        
  120.  
  121. SUB VQB_IMAGE_BUTTON_NEW (ImageButton AS IMAGE_BUTTON, X%, Y%, WIDTH%, HEIGHT%, CLR&, IMAGEFILE$)
  122.  
  123.         - Creates a new image button.
  124.         - CLR& is a _RGB32 value and dicates the buttons colour.
  125.         - IMAGEFILE$ is the given image for the button, no
  126.  
  127.  
  128. SUB VQB_IMAGE_BUTTON_DRAW (Btn AS IMAGE_BUTTON)
  129.  
  130.         - Draws the specified image button     
  131.  
  132.  
  133. SUB VQB_DIALOG_NEW (State AS DIALOG, MultiTaskApp%, X%, Y%, WIDTH%, HEIGHT%, CLR&, Title$, Resizeable%)
  134.  
  135.         - Sets the initial values for the given dialog.
  136.         - MultiTaskApp% is a TRUE or FALSE value and dicates if the given dialog's control
  137.           sub should update even if its not the top window.
  138.         - CLR& is the background colour.
  139.         - Title$ is as 32 character limited string.
  140.         - Resizeable% is a TRUE or FALSE value and dictates if the window can be resized or not.
  141.  
  142.  
  143. SUB VQB_DIALOG_SET_MIN_MAX (PState AS PROGRAM_STATE, DIALOG AS DIALOG, MinWidth%, MinHeight%, MaxWidth%, MaxHeight%)
  144.  
  145.         - Sets the minimum and maximum resize dimensions for the given dialog.
  146.         - Sizes are limited to the folowing
  147.                 - Minimum width. Title$ length (Given by _PRINTWIDTH) + 100 pixels
  148.                 - Minimum height. 28 pixels
  149.                 - Maximum width and height values are dictated by screen image width and screen image height.
  150.                         - These are stored in the PROGRAM_STATE variable
  151.  
  152.  
  153. SUB VQB_DIALOG_DRAW (PState AS PROGRAM_STATE, DIALOG AS DIALOG)
  154.  
  155.         - Draws a given Dialog - CAN be called by end user but is primarily an internal sub.
  156.  
  157.  
  158. SUB VQB_RUN_PROGRAM (PState AS PROGRAM_STATE, ProgramID%, Program() AS DIALOG)
  159.  
  160.         - Controls dialog states and dialog layers.
  161.         - Any programs that have been minimised will return to NORMAL size when Un-Minimised
  162.  
  163.  
  164. SUB DrawRoundedRectangle (X%, Y%, Width%, Height%, Colour AS _UNSIGNED LONG, Radius)
  165.        
  166.         - INTERNAL SUB, NOT CALLED BY END USER
  167.         - WILL BE MADE AND OPTIONAL FEATURE SO THE LIBRARY DRAWS DIALOGS FASTER.
  168.  
  169.  
  170. FUNCTION TRIM$ (StringToTrim$)
  171.  
  172.         - Removes all leading and end spaces from the given string
  173.         - INTERNAL FUNCTION, NOT CALLED BY END USER
  174.  
  175.  
  176. SUB VQB_Mouse_Adjust (DState AS DIALOG, MouseSource AS MouseInfo, MouseDest AS MouseInfo)
  177.  
  178.         - Adjusts Mouse position relative to given DIALOG
  179.         - Called in each control sub at the start of the UPDATE case
  180.        
  181.  
  182. FUNCTION VQB_Mouse_WithinBounds (Position AS MouseInfo, X%, Y%, XX%, YY%)
  183.  
  184.         - Returns TRUE or FALSE if the mouse pointer is within the given area.

Offline Unseen Machine

  • Forum Regular
  • Posts: 158
  • Make the game not the engine!
    • View Profile
Re: VQB .04
« Reply #3 on: August 14, 2018, 12:51:30 pm »
Hey Guys,

So what is it?

VQB is a GUI library for QB64. It has support for simple mouse input methods, buttons, check boxes,  frames, dialog windows (that can be moved, resized and support multitasking) and a MAC OS style dock. 

QB_Desk - A virtual OS that demos VQB's features. Includes a few demos, games and more to come.

Now, as for it not doing much! Thats my bad! i uploaded the wrong version! Ive gone through my current dev version and double checked it for functionality. Attched to this is the new version, maybe bplus could give it a try as he already has the files and report back.

Thanks

Unseen

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: VQB .04
« Reply #4 on: August 14, 2018, 01:18:18 pm »
Ah now the games work! and the 3 demos, there is a problem of the font (for desktop) being cut off at the tops:
  [ You are not allowed to view this attachment ]  


Offline Unseen Machine

  • Forum Regular
  • Posts: 158
  • Make the game not the engine!
    • View Profile
Re: VQB .04
« Reply #5 on: August 14, 2018, 01:32:33 pm »
Sweet, thanks for testing it for me bplus. Glad it works and as for the fonts, it's on the list of things to tweak as is the dis-appearing mouse pointer when you go over the DOCK (I know where the problem is but fixing it without adding more commands is proving problematic).

I'll continue to work on it and post updates in the future. Anyone who wants to have a program added to QB_Desk, feel free to send me your code or...

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

Thanks

Unseen

« Last Edit: August 14, 2018, 01:55:06 pm by Unseen Machine »

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: VQB .04
« Reply #6 on: August 14, 2018, 11:35:28 pm »
Hello Unseen,

Been following this for years - it looks better each time, and (just about) everything worked just now when I tested it - this includes the "feel free to send me your code or..." chunk above. One thing I wondered about was a custom INPUT statement that does everything the same except hang up the whole program like the normal INPUT does...

My mobile hotspot internet connection forbade me from trying out the IRC client or RSS feed feature. These are the kinds of things I would expect a proper member of the cult of QB64 to be running at all times. We want the fix on new forum posts and IRC fights and stuff, right? Everyone?

An actual question I have concerns the maximum number of icons allowed on the dock, namely, will there be a scrolling feature if the number of icons gets huge?

Next question: Do you want a calculator in there? If you or anyone builds the interface where someone can just mash buttons to make a math problem in the form of a string, I will drop in the logic circuit.

Aaaand finally, has keybone seen this?

Take care!

STx
« Last Edit: August 14, 2018, 11:55:09 pm by STxAxTIC »
You're not done when it works, you're done when it's right.