Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 492
» Latest member: Feederumn
» Forum threads: 2,829
» Forum posts: 26,518

Full Statistics

Latest Threads
ANSIPrint
Forum: a740g
Last Post: bplus
34 minutes ago
» Replies: 11
» Views: 149
Aloha from Maui guys.
Forum: General Discussion
Last Post: SMcNeill
37 minutes ago
» Replies: 3
» Views: 42
Rock Jockey 2.0 is ready ...
Forum: Games
Last Post: NakedApe
Today, 05:57 AM
» Replies: 18
» Views: 517
Audio Spectrum Analyser
Forum: Programs
Last Post: Jack002
Today, 01:56 AM
» Replies: 7
» Views: 136
_mem
Forum: Help Me!
Last Post: hsiangch_ong
Today, 01:50 AM
» Replies: 13
» Views: 289
pan around a large image ...
Forum: Programs
Last Post: hsiangch_ong
Today, 01:32 AM
» Replies: 0
» Views: 16
trouble building ansiprin...
Forum: Help Me!
Last Post: hsiangch_ong
Today, 12:57 AM
» Replies: 2
» Views: 53
decfloat -- again
Forum: Programs
Last Post: Jack002
Yesterday, 10:30 PM
» Replies: 42
» Views: 2,924
multiplayer spacewar
Forum: Works in Progress
Last Post: madscijr
Yesterday, 07:07 PM
» Replies: 0
» Views: 25
games or graphics for 3-D...
Forum: General Discussion
Last Post: madscijr
Yesterday, 04:39 AM
» Replies: 28
» Views: 1,089

 
  Yet another mouse function
Posted by: eoredson - 10-09-2023, 03:34 AM - Forum: Programs - Replies (8)

Hi,

I know mouse drivers and functions have been discussed 100 times but I am posting this mouse program because I wrote it myself and might be of some use.

It is not an issue or am I declaring any problem.

Erik

Code: (Select All)
Rem Mouse.bas is the sample mouse trap function for QB64 PD 2023.
DefLng A-Z
Dim Shared MouseX As Integer, MouseY As Integer
Dim Shared MouseButton1 As Integer, MouseButton2 As Integer, MouseButton3 As Integer
Dim Shared MouseWheel As Integer, WheelReverse As Integer
Const ClickCount = 10 ' double click loop counter
Const ClickDelay = .1 ' double click loop delay
Color 15
Print "Mouse detect. Press <esc> to exit."
If WheelReverse Then
  Print "  Mouse wheel reverse on."
End If
Do
  x$ = InKey$
  If x$ = Chr$(27) Then Exit Do
  x = MouseDriver
  If MouseButton1 = 2 Then
      Print "Double-Button1": MouseButton1 = 0
  Else
      If MouseButton1 = 1 Then
        Print "Button1": MouseButton1 = 0
      End If
  End If
  If MouseButton2 Then MouseButton2 = 0: Print "Button2"
  If MouseButton3 Then MouseButton3 = 0: Print "Button3"
  If MouseX Or MouseY Then Print "Coor:"; MouseX; MouseY
  If MouseWheel Then
      If MouseWheel = -1 Then
        Print "Mousewheel Up"
      End If
      If MouseWheel = 1 Then
        Print "Mousewheel Down"
      End If
  End If
Loop
End

Function MouseDriver
  Static X1 As Integer, Y1 As Integer ' store old values
  MouseX = 0: MouseY = 0
  If _MouseInput Then
      X = CInt(_MouseX): Y = CInt(_MouseY) ' X,Y return single
      If X <> X1 Or Y <> Y1 Then
        X1 = X: Y1 = Y
        MouseX = Y: MouseY = X ' X,Y are reversed
        While _MouseInput: Wend ' empty buffer
        MousePressed = -1
      End If
      MouseButton1 = _MouseButton(1)
      If MouseButton1 Then
        MouseButton1 = 1
        'MouseX = Y1
        'MouseY = X1
        MousePressed = -1
        MouseCount = 0
        Do
            _Delay ClickDelay
            MouseCount = MouseCount + 1
            If MouseCount >= ClickCount Then Exit Do
            If _MouseInput Then
              If _MouseButton(1) Then
                  MouseButton1 = 2
                  Exit Do
              End If
            End If
        Loop
      End If
      MouseButton2 = _MouseButton(2)
      If MouseButton2 Then
        'MouseX = Y1
        'MouseY = X1
        MousePressed = -1
      End If
      MouseButton3 = _MouseButton(3)
      If MouseButton3 Then
        MousePressed = -1
      End If
      MouseWheel = _MouseWheel
      If MouseWheel Then
        ' reverse mousewheel value
        If WheelReverse Then
            If MouseWheel = -1 Then
              MouseWheel = 1
            Else
              If MouseWheel = 1 Then
                  MouseWheel = -1
              End If
            End If
        End If
      End If
  End If
  MouseDriver = -1
End Function



Attached Files
.bas   mouse.bas (Size: 7.18 KB / Downloads: 40)
Print this item

  QB64 Phoenix Edition v3.9.1 Released!
Posted by: a740g - 10-08-2023, 08:03 PM - Forum: Announcements - Replies (4)

QB64 Phoenix Edition v3.9.1!

https://github.com/QB64-Phoenix-Edition/...tag/v3.9.1

Bug Fixes

  • #387, #389 - Use correct math functions from `std::`. - @mkilgore
  • #385 - Fix menu item `Run #Only (No EXE)`. - @a740g

**Full Changelog**: v3.9.0...v3.9.1

Print this item

  Cheers for RhoSigma and all the Wiki Upkeepers
Posted by: SMcNeill - 10-07-2023, 01:05 AM - Forum: Announcements - Replies (7)

Below is our credit page for the latest release:

(10-05-2023, 06:31 AM)a740g Wrote: QB64 Phoenix Edition v3.9.0!

https://github.com/QB64-Phoenix-Edition/...tag/v3.9.0

Enhancements
  • #368 - Image library enhancements. - @a740g
    • Adds the _SAVEIMAGE `fileName$[, imageHandle&][, requirements$]` statement
      • It can save graphics and text screens / images as `PNG`, `QOI`, `BMP`, `TGA`, `JPG` and `HDR`
    • Adds SVG vector image loading support from files and memory buffers
    • Adds QOI image loading support from files and memory buffers
    • Adds high quality pixel scaler support
      • Scalers can be used only during image loading and thus has zero performance impact when the image is in use
      • Six supported scalers that can be used by specifying the scaler name in _LOADIMAGE's `requirements$` string
        • `SXBR2` - Super-xBR 2x
        • `MMPX2` - MMPX Style-Preserving 2x
        • `HQ2XA` - High Quality Cartoon 2x
        • `HQ2XB` - High Quality Complex 2x
        • `HQ3XA` - High Quality Cartoon 3x
        • `HQ3XB` - High Quality Complex 3x
  • #370, #352, #374 - Audio library enhancements. - @a740g
    • QOA format support
    • Updates `miniaudio` to v0.11.18
    • Includes latest fixes for `Hively Tracker` and `TinySoundFont`
    • Updates `Libxmp-lite` to v4.6.0
    • Removes the legacy LGPL OpenAL audio backend
  • #356, #361 - Adds `Save As` OS-native GUI dialog support to the IDE. - @SMcNeill
  • #373 - IDE editor enhancement. - @RhoSigma
    • Now when the `Home` key is pressed, the cursor will only jump to the `start of line` if its current position is exactly on `start of text`, and from all other positions in the line (including anywhere in the indention space) it will always jump to `start of text`
  • #367 - Adds support for `FNT`, `FON`, `PCF` and `BDF` fixed width bitmap fonts. - @a740g
  • #371 - Updates MinGW. It now supports GCC 13.1.0 with MinGW runtime v11. - @a740g
  • #380 - Adds initial Windows on ARM support using LLVM-MingW. - @a740g
    • For now, Windows on ARM versions of QB64-PE can only be built by locally cloning the repository and then running `setup_win.cmd`
  • #379 - Updates `libstem Gamepad` library to the latest version. - @a740g

Bug Fixes
  • #351 - Fixes an issue where fonts were getting vertically misaligned. - @a740g
  • #367 - Fixes a seg-fault when using fonts on macOS as reported by @grymmjack. - @a740g
  • #353 - Fixes `DECLARE DYNAMIC LIBRARY` path issue. - @a740g
    • QB64-PE will no longer replace `./` with an absolute path
  • #358 - Fixes a bug that was hiding part of the IDE screen by the Window frame when compiled with LLVM-MingW. - @a740g
  • #365 - Patches a compiler function `CopyFile()` to clear the file first before writing. - @SMcNeill
  • #366 - Fixes `CONST Blink` (`$COLOR:0`) and `_BLINK` name collision with `$NOPREFIX` is used. - @SMcNeill
  • #372 - Fixes `PRINT` to print spaces and tabs correctly when `_KEEPBACKGROUND` is set. - @a740g
  • #377 - Fixes wrong KSL (key scale shift) values in `RAD player`. - @a740g

**Full Changelog**: v3.8.0...v3.9.0



One thing that I want to point out that's missing is all the credit that should go to @RhoSigma and everyone else who helps edit, upkeep, and enhance our wiki.  The main thing we track in release notes is who pushed what changes into the language, but everyone take a moment out of your day to remember to thank Rho and the rest for keeping the wiki up to date and valid for us!

After all, how useful would any of these nice new features be, without documentation and examples to show us how to use them??

Let me be the first to say that I'm personally very grateful for RhoSigma's hard work on the wiki and keeping it up and going, and integrating it into the IDE for quick Help for us! 

RhoSigma -- YOU'RE A HERO, EVEN IF YOU DON'T GET HALF THE CREDIT YOU SHOULD MOST OF THE TIME!!  Big Grin

Print this item

  Playing with dragon curve fractal
Posted by: Dav - 10-06-2023, 06:25 PM - Forum: Programs - Replies (11)

Playing around with doing a dragon curve fractal, altering the looks of it, making it animated, produced an interesting effect.  Uses a recursive SUB.

- Dav

Code: (Select All)
'dragoncurve.bas
'A play on a dragon curve fractal
'Adapted by Dav, OCT/2023

Screen _NewImage(800, 600, 32)
Dim Shared a, p: p = .001
Do
    Cls: dragon 400, 300, 90 + (a * 3), a, 16
    If a < 200 Then a = a + .15
    If p < .002 Then p = p + .00000001
    _Limit 15: _Display
Loop Until _KeyHit


Sub dragon (x, y, size, ang, depth)
    If depth < 1 Then
        PSet (x, y), _RGBA(50, 150, 255, 50 + Rnd * 200)
    Else
        size2 = size / 1.414214: ang2 = ang - _Pi / p
        dragon x, y, size2, ang + _Pi / p, depth - 1
        dragon x + size2 * Cos(ang), y + size2 * Sin(ang), size2, ang2, depth - 1
    End If
End Sub

Print this item

  Progress bars for QB64 (Linux)
Posted by: SpriggsySpriggs - 10-06-2023, 02:12 PM - Forum: Works in Progress - Replies (5)

Inspired by my code for pipecom for Linux, which uses popen to read from a process, I decided to write up some code for progress bars using Zenity in Linux. I will not post all the code just yet but I wanted to show it at least working. Here is a small recording of a simple progress bar:


Print this item

  Menu Run (No EXE) Problem
Posted by: GareBear - 10-06-2023, 02:18 AM - Forum: General Discussion - Replies (5)

Version - QB64pe 3.9.0 on Linux.

I get this error when I click the Run (No EXE ) below START (F5):

MENU ITEM [Run #Only (No EXE)] NOT IMPLEMENTED!
...
Press any key to continue

I press any key and the IDE shuts down. Then I restart it and it asked me to recover backup program (already saved).  Any ideas of what is up with it? Huh

P.S. - START (F5) is O.K.

Print this item

  Unable to extract the QB64PE .7z distribution using File Explorer
Posted by: hanness - 10-05-2023, 06:08 PM - Forum: General Discussion - Replies (7)

The Sep 26, 2023 update to Windows 11 22H2 introduced the ability for File Explorer to extract files from archives of types other than just .zip files. This includes .7z files. However, File Explorer cannot extract contents of the QB64PE .7z distribution. Trying to extract the files results in an error:

"An unexpected error is keeping you from copying the file. If you continue to receive this error, you can use the error code to search for help with this problem.

Error 0x8096002A: No error description is available"

I have tried this with both the 3.8.0 and 3.9.0 distributions.

The workaraound is simple - simply use 7-ZIP.

I'm wondering if there is a known cause for this problem. Is it possible that some advanced compression method is being used that File Explorer simply does not understand?

Print this item

  Having a Heck of a Time...
Posted by: SpriggsySpriggs - 10-05-2023, 12:20 PM - Forum: Help Me! - Replies (6)

I feel as though it is probably something I'm doing wrong but I am having so much trouble trying to load a font in Linux QB64pe. I don't know what I am doing wrong. I will provide an absolute path to a TTF file and the font handle is always invalid. Even when using InFormPE, it is unable to load any fonts besides 8 or 16 (the built-in VGA fonts). Is there some mystical-magical thing I need to do in Linux to work around this or are custom fonts not available in Linux? I am very confused and would appreciate any help.

Print this item

  QB64 Phoenix Edition v3.9.0 Released!
Posted by: a740g - 10-05-2023, 06:31 AM - Forum: Announcements - Replies (51)

QB64 Phoenix Edition v3.9.0!

https://github.com/QB64-Phoenix-Edition/...tag/v3.9.0

Enhancements

  • #368 - Image library enhancements. - @a740g
    • Adds the _SAVEIMAGE `fileName$[, imageHandle&][, requirements$]` statement
      • It can save graphics and text screens / images as `PNG`, `QOI`, `BMP`, `TGA`, `JPG` and `HDR`
    • Adds SVG vector image loading support from files and memory buffers
    • Adds QOI image loading support from files and memory buffers
    • Adds high quality pixel scaler support
      • Scalers can be used only during image loading and thus has zero performance impact when the image is in use
      • Six supported scalers that can be used by specifying the scaler name in _LOADIMAGE's `requirements$` string
        • `SXBR2` - Super-xBR 2x
        • `MMPX2` - MMPX Style-Preserving 2x
        • `HQ2XA` - High Quality Cartoon 2x
        • `HQ2XB` - High Quality Complex 2x
        • `HQ3XA` - High Quality Cartoon 3x
        • `HQ3XB` - High Quality Complex 3x
  • #370, #352, #374 - Audio library enhancements. - @a740g
    • QOA format support
    • Updates `miniaudio` to v0.11.18
    • Includes latest fixes for `Hively Tracker` and `TinySoundFont`
    • Updates `Libxmp-lite` to v4.6.0
    • Removes the legacy LGPL OpenAL audio backend
  • #356, #361 - Adds `Save As` OS-native GUI dialog support to the IDE. - @SMcNeill
  • #373 - IDE editor enhancement. - @RhoSigma
    • Now when the `Home` key is pressed, the cursor will only jump to the `start of line` if its current position is exactly on `start of text`, and from all other positions in the line (including anywhere in the indention space) it will always jump to `start of text`
  • #367 - Adds support for `FNT`, `FON`, `PCF` and `BDF` fixed width bitmap fonts. - @a740g
  • #371 - Updates MinGW. It now supports GCC 13.1.0 with MinGW runtime v11. - @a740g
  • #380 - Adds initial Windows on ARM support using LLVM-MingW. - @a740g
    • For now, Windows on ARM versions of QB64-PE can only be built by locally cloning the repository and then running `setup_win.cmd`
  • #379 - Updates `libstem Gamepad` library to the latest version. - @a740g

Bug Fixes
  • #351 - Fixes an issue where fonts were getting vertically misaligned. - @a740g
  • #367 - Fixes a seg-fault when using fonts on macOS as reported by @grymmjack. - @a740g
  • #353 - Fixes `DECLARE DYNAMIC LIBRARY` path issue. - @a740g
    • QB64-PE will no longer replace `./` with an absolute path
  • #358 - Fixes a bug that was hiding part of the IDE screen by the Window frame when compiled with LLVM-MingW. - @a740g
  • #365 - Patches a compiler function `CopyFile()` to clear the file first before writing. - @SMcNeill
  • #366 - Fixes `CONST Blink` (`$COLOR:0`) and `_BLINK` name collision with `$NOPREFIX` is used. - @SMcNeill
  • #372 - Fixes `PRINT` to print spaces and tabs correctly when `_KEEPBACKGROUND` is set. - @a740g
  • #377 - Fixes wrong KSL (key scale shift) values in `RAD player`. - @a740g

**Full Changelog**: v3.8.0...v3.9.0

Print this item

  Working on ways to map images onto balls
Posted by: Dav - 10-04-2023, 11:48 PM - Forum: Works in Progress - Replies (1)

Was adding more textures to my BALL sub Here, and thought why not just use textured images on the balls instead.   Spherical mapping is a little above me, but here's 2 ways I've worked out so far that gives and illusion that an image is wrapped around the ball.  Will post them here for input (advice/help is more like it...)

There are 2 SUBs.  One maps the image in a circular method from the center point, the other SUB just stamps the image it plain jane on the front of the ball.  The demo makes a texture& image to use, but can load one yourself instead.  Image textures look better with the circular method I think.

if anyone have some routines for doing something like this, could you share them?  Thanks!

- Dav

Code: (Select All)
'ImageBalls.bas

'Working on a couple ways to put an image on a ball.
'Two SUB's - either pset it straight, or in a circular method from the center point.
'Coded by Dav, SEP/2023

_Icon

'Get a bird& image from the built-in ICON
bird& = _NewImage(192, 192, 32): _Dest bird&
Cls , _RGB(200, 200, 0)
_PutImage (0, 0)-(192, 192), -11: _Dest 0

Screen _NewImage(800, 600, 32)

'Make sample texture& image to use, or load your own with _LOADIMAGE
texture& = _NewImage(200, 200, 32)
_Dest texture&
Cls , _RGB(33, 66, 99)
For x = 0 To _Width Step 25
    For y = 0 To _Height Step 25
        Line (x, y)-Step(50, 50), _RGBA(Rnd * 255, Rnd * 255, Rnd * 255, Rnd * 255), BF
    Next
Next
'_PutImage (0, 0), bird&
_PrintMode _KeepBackground
_PrintString (50, 90), "QB64-PE POWER"
_Dest 0

'Or load your own image like below
'_FreeImage texture&
'texture& = _LoadImage("brickwall.jpg", 32)

Do
    ImageBall Rnd * _Width, Rnd * _Height, 50 + Rnd * 150, texture&
    ImageBall2 Rnd * _Width, Rnd * _Height, 50 + Rnd * 150, texture&
    ImageBall2 Rnd * _Width, Rnd * _Height, 50 + Rnd * 50, bird&
    _Limit 5
Loop Until _KeyHit

Sub ImageBall (x, y, size, image&)
    'Puts image in a center circle
    orig& = _Source
    _Source image&
    For y2 = y - size To y + size
        For x2 = x - size To x + size
            dis = Sqr((x2 - x) ^ 2 + (y2 - y) ^ 2)
            If dis <= size Then
                ix = ((_Atan2(y2 - y, x2 - x) + _Pi) / (2 * _Pi)) * (_Width(image&) - 1)
                iy = ((_Acos((dis / size) * 2 - 1)) / _Pi) * (_Height(image&) - 1)
                c& = Point(ix, iy): r = _Red32(c&): g = _Green32(c&): b = _Blue32(c&)
                PSet (x2, y2), _RGB(r - dis, g - dis, b - dis)
            End If
        Next
    Next
    _Source orig&
End Sub

Sub ImageBall2 (x, y, size, image&)

    'puts image on straight.
    'To make it look better, make a temp image to match the size of the ball
    temp& = _NewImage(size * 2, size * 2, 32)
    'put the image& into temp&, stretch to fill
    _PutImage (0, 0)-(_Width(temp&), _Height(temp&)), image&, temp&

    orig& = _Source
    _Source temp&
    For y2 = y - size To y + size
        For x2 = x - size To x + size
            If Sqr((x2 - x) ^ 2 + (y2 - y) ^ 2) <= size Then
                clr = (size - (Sqr((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y)))) / size
                c& = Point(x2 - x + size, y2 - y + size): r = _Red32(c&): g = _Green32(c&): b = _Blue32(c&)
                PSet (x2, y2), _RGB(clr * r, clr * g, clr * b)
            End If
        Next
    Next
    _FreeImage temp&
    _Source orig&
End Sub

Print this item