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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 483
» Latest member: aplus
» Forum threads: 2,801
» Forum posts: 26,412

Full Statistics

Latest Threads
Raspberry OS
Forum: Help Me!
Last Post: PerspexSphinx
1 hour ago
» Replies: 5
» Views: 100
GNU C++ Compiler error
Forum: Help Me!
Last Post: RhoSigma
4 hours ago
» Replies: 1
» Views: 45
Merry Christmas Globes!
Forum: Programs
Last Post: SierraKen
Today, 03:46 AM
» Replies: 10
» Views: 125
Text-centring subs
Forum: Utilities
Last Post: Pete
Today, 02:50 AM
» Replies: 3
» Views: 80
Screw Text Centering. How...
Forum: Utilities
Last Post: Pete
Today, 01:44 AM
» Replies: 0
» Views: 38
List of file sound extens...
Forum: Help Me!
Last Post: aplus
Yesterday, 11:50 PM
» Replies: 16
» Views: 283
Merry Christmas Globes!
Forum: Christmas Code
Last Post: SierraKen
Yesterday, 09:58 PM
» Replies: 7
» Views: 77
Tenary operator in QB64 w...
Forum: Utilities
Last Post: Kernelpanic
Yesterday, 06:58 PM
» Replies: 7
» Views: 120
New QBJS Samples Site
Forum: QBJS, BAM, and Other BASICs
Last Post: DANILIN
Yesterday, 04:29 PM
» Replies: 24
» Views: 861
School themes from USSR a...
Forum: Programs
Last Post: DANILIN
Yesterday, 04:19 PM
» Replies: 24
» Views: 1,956

 
Sad Freefont error
Posted by: Kernelpanic - 06-27-2024, 07:57 PM - Forum: Help Me! - Replies (10)

Inspired by @grymmjack's comment about the fonts, I looked at "_LoadFont" in the wiki. The first example works, but I want that the output to return to the standard font at the end. Unfortunately, I get an error message with "_FreeFont"; I looked up what the error number says, but I don't know where the error is.

Can anyone tell me where the error is in the program? Thanks!

Code: (Select All)

'Fontuebung mit _LoadFont aus dem Wiki - 27. Juni 2024

Option _Explicit

Dim As String rootpath, fontfile, style
Dim As Long f

rootpath = Environ$("SYSTEMROOT") 'normally "C:\WINDOWS"

fontfile = rootpath + "\Fonts\cour.ttf" 'TTF file in Windows
style = "monospace" 'font style is not case sensitive

f = _LoadFont(fontfile, 30, style)
_Font f

Print "Hello!"

_FreeFont f

End

Print this item

Heart All _LOADFONT font formats are now supported on the forum
Posted by: grymmjack - 06-27-2024, 02:07 PM - Forum: Announcements - Replies (6)

All font formats supported by _LOADFONT are now supported on the forum as file attachments.

Code: (Select All)
TTF, TTC, OTF, FNT, FON, PCF and BDF

Print this item

Heart All _SNDOPEN file formats are now supported on the forum
Posted by: grymmjack - 06-27-2024, 02:06 PM - Forum: Announcements - No Replies

Hello,

All of the formats used by SNDOPEN are available to use as attachments on the forum.

Code: (Select All)
WAV, AIFF, AIFC, FLAC, OGG, MP3, MID, IT, XM, S3M, MOD, RAD (v1 & v2), AHX, HVL & QOA

Thanks

Print this item

Heart All _LOADIMAGE formats are now supported on forum
Posted by: grymmjack - 06-27-2024, 01:57 PM - Forum: Announcements - No Replies

Hi,

All image formats that _LOADIMAGE uses are now supported as upload enabled file types on the forum.

Some of these formats are so old they don't have an official mimetype, so those are "force download as file" mimetypes.

Some of these are so new they don't have an official mimetype, but I've looked and found a few references to some good guidelines for them.

For example, QOI is image/x-qoi not image/qoi - etc.

Code: (Select All)
JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC, PNM, PCX, SVG and QOI

This includes PCX @macalwen so if you want to upload in future you can.

Thanks all.

Print this item

  Extended KotD #19: _UCHARPOS
Posted by: SMcNeill - 06-26-2024, 12:46 AM - Forum: Keyword of the Day! - Replies (1)

Okies guys, this is one of those keywords that I've kinda been dreading to get to have to cover.  

Why??

Because the *concept* behind this one and what it does for us is rather complex to describe fully.  I have a feeling this is going to be a long arse post, so I'll probably end up wrapping it into spoiler tags so folks can navigate it a little easier, but grab yourself a soda and a snack before delving into this topic.  Tongue

INTRO
Show Content

UTF-8 vs UTF-16 vs UTF-32

Show Content

CODE POINTS vs GLYPHS

Show Content

And THAT gets us to the point where _UCharPos comes into existence for us!!

As I explained above, a string of unicode data may use 1, 2, 3, 4, 5 bytes to generate a codepoint.  And then it might take multiple codepoints and merge them together to make a final glyph/character, before printing it to the screen.

So a string of 20-bytes, in UTF-8 format, might be 20 characters.  Or 19 characters.  Or it might be only 2.   Heck, it might even be formatted wrong and not be any!!

UGHH!!!

So how the BLEEP would someone know how many characters an unicode string has??  How would you underline the word "FOO" in bight red, if you can't even know how many characters are before it, or after it??   

HOW THE FLIP DOES ANYONE DO ANYTHING MUCH AT ALL WITH UTF-8 FORMATTED CRAP???

UGGGHHHHHH!!!



Have no fear, _UCharPos is here!!   Tongue 

(to be continued in the next post below this one, as the forum has text limits and I don't want to write and write and write, just to have it cut me off or lose my work)

Print this item

  real 2-4 player Pong (requires 2-4 USB mice plugged into your PC)
Posted by: madscijr - 06-25-2024, 10:53 PM - Forum: Works in Progress - Replies (1)

See the updated v0.33 at:
https://qb64phoenix.com/forum/showthread.php?tid=2836

The game logic needs some work, but it works: this is use case zero for multiple mice... 

For those who wonder, Whatever happened to Pong?, I hope this can help provide an answer!

We can finally have multiplayer paddle games like Warlords and Video Olympics on the PC - without having to resort to using the keyboard or specialty hardware - programmed in BASIC. No 6502 assembly required. Multiplayer Pong for the common man!


.zip   multimouse-pong.zip (Size: 74.25 KB / Downloads: 20)

Download, unzip and plug in 2-4 USB mice into your PC.

First compile "pongsub27.bas" (or run it, it will briefly run then quit). 

Then run the game "pongmain27.bas". Give it a few seconds to get started. 

NOTE: You will see 2 programs running in your taskbar (the game + the subprogram that reads the mouse input).

Instructions to play will be displayed on the screen.

Enjoy - any input welcome. 

PS thank you to SpriggsySpriggs, Steffan-68, DSMan195276, SMcNeill and the QB64PE community who helped make this possible!

Print this item

  Wave Function Collapse
Posted by: dbox - 06-24-2024, 07:57 PM - Forum: Works in Progress - Replies (10)

In the process of putting together some examples and tutorials for upcoming updates to the GX game engine project I've been working on for a bit, I thought it might be cool to look at some procedural map generation examples.  Historically, I've primarily worked with games that use "hand-drawn" maps.  GX has a map maker program that can be used for this.  There are a whole host of games types though that use procedural generated maps, so that for each play you have a new world to explore.

Anyway, in the process of looking into this further I began experimenting with the wave function collapse algorithm.  It's a pretty neat way to generate maps from a sample one that is created manually.  That map is then analyzed and used as a template or rule set for then generating new maps that have the same basic features.  For a more in depth discussion of how this all works I would recommend this article.

Here is my initial attempt at implementing the algorithm in QB64/QBJS.  You can run it from the embedded version below.  If you want more room to see the output you can also launch it in a new tab from this link.


To try it out in QB64 just download and unzip the wfc.zip file that is attached to a location on your filesystem.  Then compile and run the main.bas file.  (This program uses relative paths, so make sure you have the "Create exe in same directory as source" option selected.)

This is definitely still a work in progress.  For this to be used for generating very large maps, some additional optimization will need to be applied.  I would also like to look at being able to render multiple layers, as well as potentially just generating a specific region of the map at a time which would allow you to potentially create different "biomes".

If it works out and seems useful I may add it as an optional include in future releases of GX.



Attached Files
.zip   wfc.zip (Size: 335.08 KB / Downloads: 330)
Print this item

  GDK2
Posted by: Unseen Machine - 06-24-2024, 07:06 PM - Forum: General Discussion - Replies (8)

Hi everyone.

I have once again found time to code! First job was to re-learn how! 

So....UnseenGDK 2 is what I am currently working on and I took the decision to make it a proper "Engine" rather than a "Kit". 

My main aim was to make it easy to load "Assets" (sprites, models, textures, sounds, etc...), get input, animate, move and detect collisions all automatically. Assets are defined by ID tags and are all stored in a single _MEM block. 

Currently I am working on finishing the 2d library before adding GL features but it's going well. 

Let me know if you guys want a sneaky peak....

Thanks and happy coding!

Unseen

Print this item

  Sudoku Million Games DataSet
Posted by: SMcNeill - 06-24-2024, 06:02 PM - Forum: Utilities - Replies (3)

For folks who may be interested in trying their hands at writing a Sudoku puzzle, but don't have any clue about how to make a puzzle generator, I give you -- ONE MILLION GAMES OF SUDOKU!!

Code: (Select All)
SCREEN _NEWIMAGE(1024, 720, 32)

TYPE Sudoku
Puzzle AS STRING * 81 'the puzzle from left to right, top to bottom
Answer AS STRING * 81 'the solution from left to right, top to bottom
CRLF AS STRING * 1 'chr$(10)
END TYPE

DIM Sudoku(999999) AS Sudoku
DIM m AS _MEM

temp$ = _READFILE$("sudoku.dta") 'read the compressed data file
t$ = _INFLATE$(temp$) ' inflate it

m = _MEM(Sudoku()) ' get the memblock for the data array
_MEMPUT m, m.OFFSET, t$ ' and put the data in it all at once
_MEMFREE m ' free the mem handle as we don't need it any longer


PRINT Sudoku(0).Puzzle
PRINT Sudoku(0).Answer
PRINT
PRINT

PRINT Sudoku(123456).Puzzle
PRINT Sudoku(123456).Answer

Above is the simplest way I could come up with to get that whole dataset and load it into an array for use.

If you don't want to use the memory to store the whole array, or you're wanting to bypass the disk read time to read it all, feel free to extract that file and _INFLATE it. The data is stored in very simple to read and use strings.

81 characters for the puzzle.
81 characters for the answer.
1 character for the End of Line (chr$(10)) character.

You can read those files AS RANDOM and read them one at a time. You can use SEEK and read them in LINE INPUT.

Once you have your games however you want them, all that's left at that point is just to make your interface with the grids, movement, and number input.

The puzzles are all here, along with their answers. What you decide to do with them is up to you. Smile

Print them out, so you can take them on the bus, to the doctors, or wherever you want, to play with them.
Make your own game with them.

I don't care! I just thought I'd share, in case anyone might be interested in a million games of Sudoku! Big Grin



Attached Files
.7z   sudoku.7z (Size: 68.26 MB / Downloads: 29)
Print this item

  Access GPIO pins on Raspberry via QB64 Shell command and raspi-gpio utility
Posted by: Rudy M - 06-24-2024, 03:34 PM - Forum: Works in Progress - Replies (1)

Hello,
I 'm new on this forum and I'm very happy there are a lot of programmers using QB64.

In the past I did a lot of programming with Basic PDS and ASM-routines of AJS (LA) (Multi-user access dbf files).
So I med a lot of manufacturing and color mixing software for paints.
Now retreated, I'm busy to make my own beer-brewing software (I want it good but not to complicated...).
I worked a little time with Freebasic, but it became quiet on their forum, so I switched to QB45

In freebasic I used the well-known WiringPi routines: https://projects.drogon.net/raspberry-pi/wiringpi/

In QB64 I did a lot of test to use c-libs for this purpose, but without 100% succes.

So at a moment I found the raspi-gpio utility (property of the RapsberryPI foundation).

In QB64 I did some test with the QB64 _hideSHELL command, and this works as I want it.

So I'm very glad to post my first test.

It runs on a non RaspberryPI pc, but in that case You see only the ON OFF prints on the screen.

Simple: A led connected to GPIO pin 17 of the RaspberryPI
And... swith ON or OFF with the + or - key.

On a RaspberryPI PC I use always a screw terminal p.e.:
https://www.amazon.com.be/-/nl/GeeekPi-S...uage=en_GB


Rudy M



Attached Files
.bas   LED ON OFF_qb64.bas (Size: 1.61 KB / Downloads: 42)
Print this item