Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 485
» Latest member: zenevan
» Forum threads: 2,803
» Forum posts: 26,442
Full Statistics
|
|
|
QB64 3.10.0 can't be copied. |
Posted by: MystikShadows - 01-03-2024, 03:29 PM - Forum: General Discussion
- Replies (19)
|
|
all of the predecessor i would just open the archive and copy everything to qb64 folder. this version tells me I'll need to give administrative right for a 3.10.0 folder of some sort. anybody got a clue? And I can't compile a thing either.
|
|
|
New EMBED keywords |
Posted by: SpriggsySpriggs - 01-03-2024, 02:40 PM - Forum: General Discussion
- Replies (1)
|
|
These new keywords are dang cool, man. I remember trying to use PowerShell to make small scripts that I would call from within QB64 to generate my files at runtime, which was ALWAYS a pain in the butt due to the quotes and such. Then Dav had his algorithm for doing it and it made it easy but still a pain for multiple files. Now we've got RhoSigma to thank for making this whole thing headache-free. It's probably one of the most game-changing things I've seen from QB64 in a long time. Bravo, guys. Bravo.
|
|
|
Execute ??? |
Posted by: Dimster - 01-02-2024, 09:21 PM - Forum: Help Me!
- Replies (12)
|
|
Has anyone head of a command "EXECUTE" in basic?? I have been trying to write a routine which will create a number of arrays with similar names however the name is to end with a unique number. After creating the arrays, each one is to have a difference upper limit. For example, the array names would look like - Array1(1 to 25), Array2(1 to 85), Array3(1 to 15) etc. I have tried this before and there is no way QB64PE can create array names on the fly using concatenation. Recently I was told I needed to use EXECUTE and this would create a new array name with a number concated to it. The example I was given is
EXECUTE "DIM SHARED DataHistory" + STR$(Number) + "(" + STR$(EVENT(Number)) + ") AS INTEGER"
Is Execute in some other basic syntax??
|
|
|
Sex Symbols |
Posted by: SMcNeill - 01-02-2024, 12:19 PM - Forum: SMcNeill
- Replies (4)
|
|
Code: (Select All)
SCREEN _NEWIMAGE(640, 480, 32)
$COLOR:32
NoSymbol 100, 100, Black, White
SLEEP
CLS
MaleSymbol 100, 100, Black, Red
SLEEP
CLS
FeMaleSymbol 100, 100, Black, Pink
SLEEP
CLS
InterSexSymbol 100, 100, Purple, Pink
SLEEP
CLS
SYSTEM
SUB NoSymbol (x AS INTEGER, y AS INTEGER, kolor AS _UNSIGNED LONG, background AS _UNSIGNED LONG)
LINE (x, y)-STEP(150, 255), background, BF
ThickCircle 55 + x, 100 + y, 50, 5, kolor
ThickLine 15 + x, 135 + y, 90 + x, 65 + y, 5, kolor
END SUB
SUB MaleSymbol (x AS INTEGER, y AS INTEGER, kolor AS _UNSIGNED LONG, background AS _UNSIGNED LONG)
LINE (x, y)-STEP(150, 255), background, BF
ThickCircle 55 + x, 100 + y, 50, 5, kolor
ThickLine 90 + x, 65 + y, 130 + x, 25 + y, 5, kolor
TriangleFill 145 + x, 10 + y, 142 + x, 35 + y, 117 + x, 15 + y, kolor
END SUB
SUB FeMaleSymbol (x AS INTEGER, y AS INTEGER, kolor AS _UNSIGNED LONG, background AS _UNSIGNED LONG)
LINE (x, y)-STEP(150, 255), background, BF
ThickCircle 55 + x, 100 + y, 50, 5, kolor
ThickLine 55 + x, 150 + y, 55 + x, 250 + y, 5, kolor
ThickLine 5 + x, 200 + y, 105 + x, 200 + y, 5, kolor
END SUB
SUB InterSexSymbol (x AS INTEGER, y AS INTEGER, kolor AS _UNSIGNED LONG, background AS _UNSIGNED LONG)
LINE (x, y)-STEP(150, 255), background, BF
ThickCircle 55 + x, 100 + y, 50, 5, kolor
ThickLine 55 + x, 150 + y, 55 + x, 250 + y, 5, kolor
ThickLine 5 + x, 200 + y, 105 + x, 200 + y, 5, kolor
ThickLine 90 + x, 65 + y, 130 + x, 25 + y, 5, kolor
TriangleFill 145 + x, 10 + y, 142 + x, 35 + y, 117 + x, 15 + y, kolor
END SUB
SUB ThickLine (x1, y1, x2, y2, thk, kolor AS _UNSIGNED LONG)
'draw a line of thickness thk on color klr from x1,y1 to x2,y2
'orientation of line is set in the middle of line thickness
STATIC tempimage AS LONG, m AS _MEM
IF tempimage = 0 THEN tempimage = _NEWIMAGE(1, 1, 32): m = _MEMIMAGE(tempimage)
$CHECKING:OFF
_MEMPUT m, m.OFFSET, kolor
$CHECKING:ON
cang = _ATAN2((y2 - y1), (x2 - x1)) 'get the angle from x1,y1 to x2,y2
ta = cang + _PI(.5)
tb = ta + _PI
tax1 = x1 + (thk / 2) * COS(ta): tay1 = y1 + (thk / 2) * SIN(ta)
tax4 = x1 + (thk / 2) * COS(tb): tay4 = y1 + (thk / 2) * SIN(tb)
tax2 = x2 + (thk / 2) * COS(ta): tay2 = y2 + (thk / 2) * SIN(ta)
tax3 = x2 + (thk / 2) * COS(tb): tay3 = y2 + (thk / 2) * SIN(tb)
_MAPTRIANGLE (0, 0)-(0, 0)-(0, 0), tempimage TO(tax1, tay1)-(tax2, tay2)-(tax4, tay4)
_MAPTRIANGLE (0, 0)-(0, 0)-(0, 0), tempimage TO(tax2, tay2)-(tax3, tay3)-(tax4, tay4)
END SUB
SUB ThickCircle (x AS SINGLE, y AS SINGLE, radius AS SINGLE, thickness AS SINGLE, colour AS _UNSIGNED LONG)
DIM rp AS SINGLE, rm AS SINGLE, rp2 AS SINGLE, rm2 AS SINGLE
DIM sm AS SINGLE, rpi2 AS SINGLE, rmi2 AS SINGLE, sp AS SINGLE
DIM i AS SINGLE
rp = radius + thickness / 2
rm = radius - thickness / 2
rp2 = rp ^ 2
rm2 = rm ^ 2
FOR i = -rp TO -rm STEP .2
rpi2 = rp2 - i ^ 2
sp = SQR(rpi2)
LINE (x + i, y)-(x + i, y + sp), colour, BF
LINE (x + i, y)-(x + i, y - sp), colour, BF
NEXT
FOR i = -rm TO 0 STEP .2
rpi2 = rp2 - i ^ 2
rmi2 = rm2 - i ^ 2
sm = SQR(rmi2)
sp = SQR(rpi2)
LINE (x + i, y + sm)-(x + i, y + sp), colour, BF
LINE (x - i, y + sm)-(x - i, y + sp), colour, BF
LINE (x + i, y - sm)-(x + i, y - sp), colour, BF
LINE (x - i, y - sm)-(x - i, y - sp), colour, BF
NEXT
FOR i = rm TO rp STEP .2
rpi2 = rp2 - i ^ 2
sp = SQR(rpi2)
LINE (x + i, y)-(x + i, y + sp), colour, BF
LINE (x + i, y)-(x + i, y - sp), colour, BF
NEXT
END SUB
SUB TriangleFill (x1, y1, x2, y2, x3, y3, K AS _UNSIGNED LONG)
$CHECKING:OFF
STATIC a&, m AS _MEM
IF a& = 0 THEN a& = _NEWIMAGE(1, 1, 32): m = _MEMIMAGE(a&)
_MEMPUT m, m.OFFSET, K
_MAPTRIANGLE _SEAMLESS(0, 0)-(0, 0)-(0, 0), a& TO(x1, y1)-(x2, y2)-(x3, y3)
$CHECKING:ON
END SUB
Homemade sex symbols which you can quickly color as you want and toss into any program wherever you'd want them. Default size for these is 150x255 pixels, but the way I suggest using them is to just draw them on a _NEWIMAGE that size, and then you can _PUTIMAGE that image wherever you want at, at whatever size you want it.
Note that these all have the same amount of whitespace to them, so that they'd overlap perfectly so they can be used as a simple image to visually indicate sex on a form or document. Even if you print them with a clear/transparent background, just keep in mind that they center *AS A WHOLE* and not as individual images. You may need to add some offsets (or trim some unneeded whitespace) for independent centering, if that's something you're interested in for your usage.
|
|
|
very long pathnames and _DirExists (prob ?) |
Posted by: doppler - 12-31-2023, 12:14 PM - Forum: General Discussion
- Replies (2)
|
|
Just saying _DirExists does not work with long pathnames won't cut it, so: (a semi-short justification)
I collect manga (read into it as comics not from the usual sources). Many languages are used. Among them is Japanese. A very likely encounter is a very long pathname. The Japanese authors tend to name a manga, with a history of it's content. When the kanji romanized title is created it could get long. When a translation group decide to translate (remember it's in Japanese) the manga title maybe English translated to something even longer.
example:
JP: A very long kanji title how Superman went to the beach with Lois, but meets up Lex Luthor / gang and a big battle ensues. <-- mind you this is long already.
would be translated to English as:
Eng: Superman is asked to go to the beach by Lois Lane and have a picnic. After they setup, Lex Luthor and is ominous gang show up and fight starts. After long battle Superman wins but asks Luthor to stay and enjoy the picnic. Lex agrees and says he will buy the steaks.
This is a silly problem, trans groups should more aware how long the titles get and shorten them. My problem they are stupid and I have a title with a 277 characters long pathname.
_DirExists fails on something that long.
final note: Why use _DirExists. Simple! To detect special characters (umlauts and such) in directory names. Shell out and capture the directory names. Do a _DirExists on the list. Anything that exists but still can't be tested with _DirExists. Contains special characters. I have to treat them specially different.
If you have read to this point you are either. 1) Bored with the New Years weekend. or 2) Really love QB64pe and want it to work correctly. I suspect a little of both.
The problem exists on windows. Windows will allow very long pathnames and many sub directories exceeding the 257 character limit. Won't complain until you try to copy or move it.
Thanks for reading this far.
ps. Newer versions of windows allow longer than 257, the caveat losing backwards compatibility to earlier versions.
|
|
|
Wallpaper creator from repeated polygon patterns |
Posted by: mnrvovrfc - 12-30-2023, 11:13 PM - Forum: Programs
- Replies (5)
|
|
I was inspired by a program for Linux called Kali that allows creating wallpapers from simple polygons. Basically it repeated a pattern over the whole screen, by flipping or replication. The program is quite good and I installed it into one of my Debian "Bookworm" installations.
I don't give the link to the program because the GUI appears to be FLTK and some of you aren't familiar or aren't comfortable with that style. The FLTK is an older GUI programming toolkit than GTK and Qt. Also it might be installable via a "dot-DEB" file only, which some people have become as suspicious as Windows installers. :/
Also the Kali program doesn't straight out save to JPEG or PNG or other popular format, but in EPS Postscript format. This might not be sufficient importing the EPS into GIMP converting to another format with Imagemagick.
Just look it up in search service, but write "kali drawing" because just putting down "kali" might give entries about Kali Linux. Which is not what I was talking about here.
Anyway, here's a program that creates 20 pictures that could be used as wallpapers for a 15-inch laptop (1366x768 resolution). Feel free to adjust it to your tastes. For each pass, it creates polygons from triangle to octagon inclusive and draws them repeatedly according to fixed horizontal and vertical offsets. Each polygon is given an initial 32-bit color value, then one of the registers is "bounced" back and forth like in a gradient to increase interest in the picture. The actual screen to save is hidden but written to, because it's too big to fit into my screen including the window titlebar and frame. Instead a 67%-scale screen is shown of what it was like.
Note the line with ```_SAVEIMAGE``` is commented out. In my version it saves in QOI format because I wanted to check out the plug-in for GIMP which could save and load those files. This plug-in cannot be used in Debian "Bullseye" or earlier, unfortunately. In the open file requester in GIMP, must check enabled "Show all files" to be able to see and select a QOI file.
Happy New Year to all members of this forum and to everybody.
Code: (Select All)
'by mnrvovrfc 30-Dec-2023
$IF VERSION < 3.10 THEN
$ERROR Must compile in QB64 Phoenix Edition v3.10 or later!
$END IF
OPTION _EXPLICIT
DIM polyg(1 TO 8) AS LONG, x(1 TO 8) AS INTEGER, y(1 TO 8) AS INTEGER
DIM AS LONG thisp, displayp, cu
DIM AS INTEGER j, u, w, wd, ht, wi, hi, xx, yy, rr, gg, bb, x1, y1
DIM AS INTEGER ri, gi, bi, v
DIM afile$, goahead AS _BYTE, nn AS DOUBLE
RANDOMIZE TIMER
wd = 200
ht = 150
thisp = _newimage(1366, 768, 32)
displayp = _NEWIMAGE(915, 515, 32)
SCREEN displayp
FOR w = 1 TO 20
_DEST thisp
CLS
FOR j = 3 TO 8
DO
FOR u = 1 TO 7
polyg(u) = Random1(359)
NEXT
DO
goahead = 1
FOR u = 1 TO 6
IF polyg(u) < polyg(u + 1) THEN
SWAP polyg(u), polyg(u + 1)
goahead = 0
EXIT FOR
END IF
NEXT
LOOP UNTIL goahead
goahead = 1
FOR u = 1 TO 6
IF ABS(polyg(u) - polyg(u + 1)) <= 30 THEN goahead = 0: EXIT FOR
NEXT
LOOP UNTIL goahead
FOR u = 1 TO 7
nn = polyg(u) * 1E+6
polyg(u) = INT(_D2R(nn))
NEXT
polyg(j) = polyg(1)
DO
rr = Rand(8, 85) * 3
gg = Rand(8, 85) * 3
bb = Rand(8, 85) * 3
LOOP UNTIL rr >= 96 OR gg >= 96 OR bb >= 96
IF rr > 127 THEN ri = -2 ELSE ri = 2
IF gg > 127 THEN gi = -2 ELSE gi = 2
IF bb > 127 THEN bi = -2 ELSE bi = 2
v = INT(RND * 3 + 1)
SELECT CASE v
CASE 1
gg = 0: bb = 0
CASE 2
rr = 0: bb = 0
CASE 3
rr = 0: gg = 0
END SELECT
wi = (wd \ 2) + Random1(wd \ 2) - (wd \ 4)
hi = (ht \ 2) + Random1(ht \ 2) - (ht \ 4)
FOR u = 1 TO j
x(u) = _CEIL(COS(polyg(u) / 1E+6) * wi)
y(u) = _CEIL(SIN(polyg(u) / 1E+6) * hi)
NEXT
xx = -1366
DO UNTIL xx > 1366
yy = -768
DO UNTIL yy > 768
goahead = 0
FOR u = 1 TO j
x1 = x(u) + xx
y1 = y(u) + yy
IF ((x1 < 0) OR (x1 > 1366)) AND ((y1 < 0) OR (y1 > 768)) THEN goahead = goahead + 1
NEXT
IF goahead < j THEN
cu = _RGB(rr, gg, bb)
IF ri THEN
rr = rr + ri
IF rr < 48 OR rr > 255 THEN
ri = ri * -1
rr = rr + ri
END IF
END IF
IF gi THEN
IF gg < 48 OR gg > 255 THEN
gi = gi * -1
gg = gg + gi
END IF
END IF
IF bi THEN
IF bb < 48 OR bb > 255 THEN
bi = bi * -1
bb = bb + bi
END IF
END IF
x1 = x(1) + xx
y1 = y(1) + yy
PSET (x1, y1)
FOR u = 2 TO j
x1 = x(u) + xx
y1 = y(u) + yy
LINE -(x1, y1), cu
NEXT
END IF
yy = yy + hi
LOOP
xx = xx + wi
LOOP
NEXT
_DEST displayp
_PUTIMAGE (0, 0)-(914, 514), thisp, displayp, (0, 0)-(1365, 767)
'afile$ = ENVIRON$("HOME") + "/Pictures/mirrorbagli" + Zeroes$(w, 2) + ".qoi"
'_SAVEIMAGE afile$, thisp
_DELAY 3
NEXT
SYSTEM
FUNCTION Rand& (fromval&, toval&)
DIM sg%, f&, t&
IF fromval& = toval& THEN
Rand& = fromval&
EXIT FUNCTION
END IF
f& = fromval&
t& = toval&
IF (f& < 0) AND (t& < 0) THEN
sg% = -1
f& = f& * -1
t& = t& * -1
ELSE
sg% = 1
END IF
IF f& > t& THEN SWAP f&, t&
Rand& = INT(RND * (t& - f& + 1) + f&) * sg%
END FUNCTION
FUNCTION Random1& (maxvaluu&)
DIM sg%
sg% = SGN(maxvaluu&)
IF sg% = 0 THEN
Random1& = 0
ELSE
IF sg% = -1 THEN maxvaluu& = maxvaluu& * -1
Random1& = INT(RND * maxvaluu& + 1) * sg%
END IF
END FUNCTION
FUNCTION Zeroes$ (num AS LONG, numdig AS INTEGER)
DIM b$, v AS LONG
DIM AS INTEGER sg, hx
IF num < 0 THEN sg = -1: num = num * -1
IF numdig < 0 THEN hx = 1: numdig = numdig * -1 ELSE hx = 0
IF hx THEN
b$ = HEX$(num)
ELSE
b$ = LTRIM$(STR$(num))
END IF
v = numdig - LEN(b$)
IF v > 0 THEN b$ = STRING$(v, 48) + b$
IF sg = -1 THEN b$ = "-" + b$
Zeroes$ = b$
END FUNCTION
|
|
|
|