Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Colonel_Panic

Pages: [1]
1
Programs / Custom Image Format ***with compression***
« on: December 29, 2021, 09:55:43 pm »
Here's my NOTES I kept fooling around... I am gonna post the couple of sample programs now, I dont know HOW long I will be here (and have internet) before I leave again.

By next time I'm here and I can post again... I should have this "genericized" into a couple of SUBs

anyways, heres my notes I kept...
==================================================
NOTESx

Why?

   Several reasons. First and foremost, I have a recent interest in images and working with them in most of my projects. I have the classic quandary; I can make neat stuff on the screen, creatively reading in and displaying whole and parts of images... but I cant SAVE this cool and novel image.

   Yes, I know, I am aware there are routines developed to save in "one format". And that its a STANDARD format.

   The 'problem' is that I want to TINKER. I thought I was going to read about the "structure" of several popular image file formats, pick one, and start reading it in and writing it out as/when i felt like it.

   This logic, while techincally sound, had one fatal flaw: I'm not on the "same wavelength" with the file format. ANY file format, there are hard ones, and impossible ones... there doesnt seem to be a single "easy" format for me, the programmer.

What can I do about this?

   Well... I simply make up my own image format. I spaghetti-coded a couple of untitled hot mess proof-of-concept programs. I decided I needed a custom image I would recognize... I decided 640x480 was fine for a test.

   A certain number of random lines and random circles, in random colors. HEY, a recognizeable 32 bit "image" on the screen.

640x480 yields exactly 307,200 pixels
they are RIGHT there on my screen, I need each pixels COLOR.
I simply make a big array of the image dimensions, its type ~& for not losing the blue component the manual said I think.
I fill up the array by sampling the pixels with POINT(x,y)
now I have an array filled with color values i can work with.

For now, I just need to utilitize this as best i can.

the original format I called .imap (image map?)
the first 2 lines are read in, how wide and how tall, respectively.
after that? follows (640 x 480) = 307200 lines, each line representing a color
since the Y loop is inside the overall x loop... it gets done by vertical stripes
this could be reversed though I dont see how it matters

each color is represented by 2 hex characters, so 6 hex characters on each line represent the 3 color components of that pixel.

since I used a black background, I decided to use a "0" instead of " 0 0 0" for ZERO color, this made some savings. though file was still huge for its image size.

it WORKS though. the MAKE program makes a sample 640x480 image of random lines and citrcles, and saves it in .imap format

the OPEN program, proves the system works by reading it in, and displaying it. YES, its very slow and more slow given its relatively small 640x480 test size. BUT, I have no "hardware acceleration", I have no "commercial compression", nothing.

so, if it just WORKS at all, I'm happy. If it works just fast enough I can actually sort of use it? great!

next, I need some kind of compression. I dont want ANY loss of any kind, so any strategy canonly be "loss-less". Well, there are a LOT of "0" entries in the file, since it was a black background I painted on.

My basic compresion strategy is as follows:

I sweep through the file. Any time the NEXT LINE is the same as the PRESENT LINE? I keep track of it, and keep reading forward, line by line, until I hit the spot its finally a different color line.

there is NO REASON to have that many identical lines, I decided to make a "postprocessor" character "+", followed by the number of identical lines to follow.
The first 345 lines of my sample image? were zero color. After running POST, the post-processed .imap2 file contains none of the skipped (identical) lines.

My final sweep through, put out to .imap3 file, looks for " 0 0 0" entries and replaces them with the "preprocessor" character "@".

its a big savings, and its completely "lossless" of a format.
All I need now is a .imap3 OPEN demo, and I am golden for a start.

====================================

what can I do with this?

well, I can open any image file, and scale and display it any way I want to.
mirror images, text added, whatever.

now, if i WANT to? I can easily experiment with making some kind of "GIMP filter"
type of deal. This gets me STARTED, allows me to make a sample interface, do whatever I want (crop, go B+W, whatever) and save it out.

Later ON, if i can get more comfortable with any real file structures, I can convert to them. I want to know how to work with stuff, this is the best way for me to learn I figure.

I figure no matter WHAT format I end up maybe getting into? I will STILL need an easy internal representation of what each pixel is doing, this format IS that representation. The fact I can save and load and edit it easily myself is just a side benefit.

SIZES @ image size 640x480:
.imap  =  2.5MB     ;raw file, zero compression
.imap2 =  20.2 kB  ;compression by duplication skip-tracking
.imap3 =  17.9 kB  ;every instance " 0 0 0" replaced with "@"


NOTE: this is 100% loss-less compression. not one pixel, not one color, has been molested from the original.
NOTE: if i draw less or more random lines and circles? the sizes of the compressed files inches up and down with it. Reason why being, a few less lines and circles, means bigger and longer "zero gaps" of black background, thatget replaced bya single entry at a time. The more single color back ground showing, the smaller the compression gets.
NOTE: I chose " 0 0 0" (black) to switch to "@" on final compression pass, simply because it was the background color and a lot of it.
in the future, i will probably add a line in the file up front, indicating what color is to be replaced by the @.

EG, if you know your background is for instance WHITE, then, obviously you would want to replace THAT color with the "@" shortener symbol.

=========================================================================

As a sample image, I switched over from "some lines and circles" to "giant text font".
In this case? the "compression" numbers are actually pretty great !

no matter WHAT the image is? its ALWAYS 2.5MB for the .imap file, it has no choice. If i write out the colors to every pixel? Thats simply "the size" and thats all there is to it.

20k and 17k are "very respectable" I feel, as rolled-at-home compression alogrithms, given that it is 100 percent "no loss"

2
QB64 Discussion / adding in library when building the C program??
« on: December 26, 2021, 06:45:08 pm »
I am (maybe) learning how to ask what i actually "want".

look at the following short text? Doesnt matter WHAT it is, whats important, is the part where they explain "this is so we BUILD the executable, and it contains everything, because we want it to run without any external libraries..." (paraphrasing)

Because the 'building' is just compiling a C program, its linux

I want the... "graphics stack" (??) compiled "into" a regular C program??

I want to have the QB64 "graphics commands" available for use when I execute, can i put the stuff in there at compile time? so I dont have to depend on some "window manager application"?

because right now, I need a certain "amount" (size...) of linux to be able to run graphics executables on it.... cant i just "bind" the damned graphics commands" into a (bigger) c-compilation?

I know I am not asking the exact right questions, but, maybe now you guys will have some perhaps better idea what I am asking for.

3
QB64 Discussion / Our own version of Linux
« on: December 26, 2021, 05:57:13 pm »
I am always wondering about "how Linux works".

Descriptions of files and folders is ONE thing, finding a few things ina  few folders is another thing... I find myself asking questions like "what is the minimum LInux I need?" to install QB64, and then to EXECUTE and DEPLOY my executables.

I get no answers, because i know i didnt know how to phrase the question.

SO, I found "Minimal Linux Live" and its a true "minimalist" linux.

Okay, so now BETTER question...
whats the minimum to get the "graphics stack" running, and I am seeing i think i must choose a "window manager". (I want a BASIC one, nothing fancy)

distro-hopping, I have several LINUX distros that i "like" and by that i mean, I like the fact I can just cut and paste executables/folders from a USB onto the desktop, set the "run as exe" flag... and BANG! I am off and running.

I need to identify, what is SIMILAR about these LINUX, so I can figure out "which" window manager I "like". Because? QB64 executables LIKE the same Linux distros.

curiously? this ONE distro, not only does everything install and run perfect? It has a neat trick... its the ONLY linux i have FOUIND yet... that I can specify a 32-bit newimage and screen it, and if its bigger than desktop width and desktop height? SLIDERS automatically appear on that window.

its the ONLY linux distro, on my short list, that does that...

=========================================

I realize I cant just copy and paste "GhettoWindowManager" and magically expect my environment to appear instantly, as if i am copying over a NOTEPAD program.

But, this is a great tool for LEARNING whats going on.

the resulting absolute minimum linux shell it makes? weird. There ARE no users, reminds me of DOS.

===================================

I figure a first demo would be simply booting the given image, but having removed the "hello" stuff and replaced it with my own "hello QB64" message, proving i can control "something" and move from there.

apparently, I could (probably) already "run" a qb64 "program" I placed in the file structure at scripting time, but it would be CONSOLE ONLY.

I need "graphics stack" and whatever basic windowing manager my GUI likes to run in.

if i can slowly add JUST whats needed for QB64 IDE + runtime... i could end up with a "lean and mean" system. (plus, I figure there's no WAY this won't teach me SOMETHING about whats going on in Linux.)

4
QB64 Discussion / different C compilation things ?
« on: December 24, 2021, 01:44:30 pm »
okay... I read about the part where you can add "debug" information at compile time
and it exposes variable names and increases file size

why cant  run from a "minimalist" linux setup? shouldnt my "freestanding" exe
fire up and execute even on some "micro" or "nano" linux?

a online buddy suggested I could "compile" in such a manner as to include the "graphics stuff" into the compilation??
to MY ears, it sounded similar to the DEBUG flags in the IDE...

I mean, why cant i make a graphical application, and its the little GUI for some tiny linux??
is what i am asking sane and coherent? i just want to run my C executable on (minimalist) linux

5
Programs / scaled graphics / window management
« on: December 24, 2021, 02:06:19 am »
okay, this is a weird one.

I scale this listbox to ANY size
clickable and accurate to the pixel at any size.
(it reports which folder clicked on, see if you can get it to be "wrong", I cant, i gave up and called it "accurate")

its got 777 folders for the demo.

just read the instructions...

6
Programs / river-raid style demo
« on: December 24, 2021, 01:27:15 am »
I am fooling around with "large internal images" and how to use them.

there are 2 programs in the folder...
milliontest2 and milliontest3

#2 is a river-raid style demo of a vertical scroller.
Use the 4 arrow keys for other movement, but, the vertical "pull" is constant, like gravity
NOT a game, just the scrolling engine

#3 is a "SUB HUNT" type demo...
same IDEA, different image, you move around the sea map.

NOTE: I included a bunch of extra "maps" to play with
if you peek at the first couple lines of code? you will see where you change
how many vertical tiles and how many horizontal tiles

<esc> to exit both programs

7
Programs / text file browser
« on: December 24, 2021, 12:26:16 am »
I wanted to make one of these things for a while.
last time i was on the internet? I *almost* got it working enough to post it, but...
knew to wait until I had the bug worked out.

very basic and straight-forward.
this TEXT version works out of CWD$

this is a linux only deal, due to the way I SHELL out.



8
QB64 Discussion / smallest LINUX that will run compiled QB64 ?
« on: November 08, 2021, 12:53:30 am »
I mean, QB64 creates a standalone executable, a C executable.
the holy grail of linux.

question --- smallest LINUX distro anyone got QB64 executables to run on?

9
Programs / Language
« on: November 07, 2021, 10:23:19 pm »
This is the first place online where I have *seen* stuff just like mine.
which makes me feel sort of "at home" I suppose.

LANGUAGE
=======
I have seen stuff like this called a "math module", and its a good description.
it continually asks you for an "expression to evaluate".

you are making variable assignments;
 the variable list "grows" at the top of the screen
if you enter:
x=2
y=3
z=((x*2)+(y*4))/2

you can watch as it keeps track and performs the evaluation(s)

this module, one just like it... is always my "ground zero" if I
am going to do any kind of "make my own language" work. Which is
why its called "language". I have used these routines several times in the past, they never fail me.

this is a stripped down special version, where it stops and shows you, step by step,
each "pass" as it reduces the math expression. In real life, it just SPITS it back out,
it seems instantaneous.

In one of my projects, I might have to calculate algebraic expressions, out of a $string.
this module will obviously be re-purposed for that.

LINUX MINT executable:
 

got code?

Code: QB64: [Select]
  1. NumVars = 0
  2. DIM VN$(128), VV(128)
  3.  
  4. AnotherExpression:
  5. FOR t = 1 TO NumVars
  6.   PRINT VN$(t); " ="; VV(t)
  7. PRINT "Enter expression to evaluate :";
  8. PRINT "-----------------------------"
  9. 'strip the spaces; meaningless in a math expression
  10. N1$ = ""
  11. FOR t = 1 TO LEN(z$)
  12.   IF MID$(z$, t, 1) <> " " THEN N1$ = N1$ + MID$(z$, t, 1)
  13. z$=N1$
  14. 'check for assignment
  15. VarFlag = 0
  16. FOR t = 2 TO LEN(z$)
  17.   IF MID$(z$, t, 1) = "=" THEN
  18.     GOSUB Assign:
  19.     IF VarFlag > 0 THEN z$ = EXP$: GOTO Start:
  20.   END IF
  21.  
  22. Start:
  23. pErrL = 0: pErrR = 0 'checks L's = R's
  24. pErr = 0 'other error(s)
  25. FOR t = 1 TO LEN(z$) 'check # of P's match
  26.   IF MID$(z$, t, 1) = "(" THEN pErrL = pErrL + 1
  27.   IF MID$(z$, t, 1) = ")" THEN pErrR = pErrR + 1
  28. IF (pErrL <> pErrR) THEN
  29.   PRINT "Fatal Error; (="; pErrL; "and )="; pErrR
  30.   PRINT "press <ENTER> :";: LINE INPUT nothing$
  31.   CLS: GOTO AnotherExpression:
  32. pErrL = 0: pErrR = 0
  33. FOR t = 1 TO LEN(z$)
  34.   IF MID$(z$, t, 1) = "(" THEN pErrL = pErrL + 1
  35.   IF MID$(z$, t, 1) = ")" THEN pErrR = pErrR + 1
  36.   IF pErrL = 0 AND pErrR = 1 THEN
  37.     PRINT "Fatal Error; 1st Paren must be a ("
  38.     PRINT "press <ENTER> :";: LINE INPUT nothing$
  39.     CLS: GOTO AnotherExpression:
  40.   END IF
  41.  
  42. pErrL = 0: pErrR = 0
  43. FOR t = LEN(z$) TO 1 STEP -1
  44.   IF MID$(z$, t, 1) = "(" THEN pErrL = pErrL + 1
  45.   IF MID$(z$, t, 1) = ")" THEN pErrR = pErrR + 1
  46.   IF pErrL = 1 AND pErrR = 0 THEN
  47.     PRINT "Fatal Error; last Paren must be a )"
  48.     PRINT "press <ENTER> :";: LINE INPUT nothing$
  49.     CLS: GOTO AnotherExpression
  50.   END IF
  51.  
  52. 'done error trapping;
  53. ' add Paren's to force one pass and contain any ops
  54. z$ = "(" + z$ + ")"
  55.  
  56. RunAgain:
  57. hasP = 0
  58. FOR t = 1 TO LEN(z$)
  59.   IF (MID$(z$, t, 1) = "(") OR (MID$(z$, t, 1) = ")") THEN hasP = 1
  60. IF hasP = 1 THEN GOTO Find_inner_paren:
  61. IF hasP = 0 THEN
  62.   PRINT "done, final value ="; z$
  63.   IF VarFlag > 0 THEN
  64.     VV(VarFlag) = VAL(z$)
  65.   END IF
  66. PRINT "press <ENTER> :";
  67. LINE INPUT nothing$
  68. CLS: GOTO AnotherExpression:
  69.  
  70. Find_inner_paren:
  71.  
  72. Find_left_paren:
  73. FOR t1 = 1 TO LEN(z$) - 1
  74.   IF MID$(z$, t1, 1) = "(" THEN
  75.     GOSUB Find_Right_Paren:
  76.     IF rpFlag <> 0 THEN
  77.       lft$ = LEFT$(z$, t1 - 1)
  78.       rht$ = RIGHT$(z$, LEN(z$) - rpFlag)
  79.       ' PRINT "."; lft$; "."; rht$; ".": END
  80.       GOSUB Eval:
  81.       z$ = lft$ + LTRIM$(STR$(zval)) + rht$
  82.       GOTO RunAgain:
  83.     END IF
  84.   END IF
  85. NEXT t1
  86.  
  87. '--------------------subroutine Find_Right_Paren:-------------
  88. 'driven entirely by Find_Left_Paren:
  89. Find_Right_Paren:
  90. rpFlag = 0
  91. FOR t2 = t1 + 1 TO LEN(z$)
  92.   IF MID$(z$, t2, 1) = "(" THEN
  93.     rpFlag = 0
  94.     RETURN
  95.   END IF
  96.   IF MID$(z$, t2, 1) = ")" THEN
  97.     rpFlag = t2
  98.     RETURN
  99.   END IF
  100. NEXT t2
  101. rpFlag = 0: RETURN
  102. '--------------------END subroutine Find_Right_Paren:----------
  103.  
  104. '------------------subroutine Eval:----------------------------
  105. 'we are always working at the innermost Paren's
  106. 'this routine reduces it to a value one operation at a time
  107. Eval:
  108. z1$ = MID$(z$, t1, t2 - t1 + 1)
  109. EvalAgain:
  110.  
  111. FOR t3 = 1 TO LEN(z1$)
  112.   IF MID$(z1$, t3, 1) = "^" THEN op$ = "^": GOSUB EvalAdd:: GOTO EvalAgain:
  113. NEXT t3
  114.  
  115. FOR t3 = 1 TO LEN(z1$)
  116.   IF MID$(z1$, t3, 1) = "*" THEN op$ = "*": GOSUB EvalAdd:: GOTO EvalAgain:
  117.   IF MID$(z1$, t3, 1) = "/" THEN op$ = "/": GOSUB EvalAdd:: GOTO EvalAgain:
  118. NEXT t3
  119.  
  120. FOR t3 = 1 TO LEN(z1$)
  121.   IF MID$(z1$, t3, 1) = "+" THEN op$ = "+": GOSUB EvalAdd:: GOTO EvalAgain:
  122.   IF MID$(z1$, t3, 1) = "-" THEN op$ = "-": GOSUB EvalAdd:: GOTO EvalAgain:
  123. NEXT t3
  124. GOSUB ReplaceVar:
  125. PRINT "no more ops; value = "; z1$
  126. zval = VAL(MID$(z1$, 2, LEN(z1$) - 2))
  127. '--------------------END subroutine Eval:---------------------
  128.  
  129. '--------------------subroutine EvalAdd:----------------------
  130. 'performs the actual OPeration(s) when called by Eval:
  131. EvalAdd:
  132. FOR t5 = t3 - 1 TO 2 STEP -1
  133.   IF INSTR("^*/+-", MID$(z1$, t5, 1)) <> 0 THEN
  134.     Lend = t5 + 1: GOTO GotLeft:
  135.   END IF
  136. NEXT t5
  137. Lend = 2
  138. GotLeft:
  139. L1$ = MID$(z1$, Lend, t3 - Lend)
  140. FOR t4 = t3 + 1 TO LEN(z1$)
  141.   IF INSTR("^*/+-", MID$(z1$, t4, 1)) <> 0 THEN
  142.     Rend = t4: GOTO GotRite:
  143.   END IF
  144. NEXT t4
  145. Rend = LEN(z1$)
  146. GotRite:
  147. R1$ = MID$(z1$, t3 + 1, Rend - (t3 + 1))
  148. GOSUB ReplaceVars:
  149. PRINT L1$; " "; op$; " "; R1$; " = ";
  150. IF op$ = "+" THEN res$ = LTRIM$(STR$(VAL(L1$) + VAL(R1$)))
  151. IF op$ = "-" THEN res$ = LTRIM$(STR$(VAL(L1$) - VAL(R1$)))
  152. IF op$ = "*" THEN res$ = LTRIM$(STR$(VAL(L1$) * VAL(R1$)))
  153. IF op$ = "/" THEN res$ = LTRIM$(STR$(VAL(L1$) / VAL(R1$)))
  154. IF op$ = "^" THEN res$ = LTRIM$(STR$(VAL(L1$) ^ VAL(R1$)))
  155.  
  156. z1$ = LEFT$(z1$, Lend - 1) + res$ + RIGHT$(z1$, LEN(z1$) - Rend + 1)
  157. PRINT z1$
  158.  
  159. '--------------------END EvalAdd:-----------------------------
  160.  
  161. '--------------subroutine Assign:-----------------------------
  162. 'sets up a variable assignment to the expression
  163. Assign:
  164. VarFlag = 0
  165. Epl = t
  166. NAM$ = LEFT$(z$, Epl - 1)
  167. EXP$ = RIGHT$(z$, LEN(z$) - Epl)
  168.  
  169. namErr = 0
  170. FOR t1 = 1 TO LEN(NAM$) 'legal var names are A-Z, 0-9, a-z, and _ ;cant start with a #
  171.   ch$ = MID$(NAM$, t1, 1)
  172.   IF t1 > 1 AND ch$ >= "0" AND ch$ <= "9" THEN GOTO DuLast: 'cant start with #
  173.   IF ch$ >= "A" AND ch$ <= "Z" THEN GOTO DuLast:
  174.   IF ch$ >= "a" AND ch$ <= "z" THEN GOTO DuLast:
  175.   IF ch$ = "_" THEN GOTO DuLast:
  176.   namErr = namErr + 1
  177.   DuLast:
  178. NEXT t1
  179. IF namErr > 0 THEN
  180.   VarFlag = 0
  181.   PRINT "Fatal Error; illegal variable name"
  182.   PRINT "press <enter> :";
  183.   LINE INPUT nothing$
  184.  
  185. IF NumVars = 0 THEN
  186.   NumVars = NumVars + 1
  187.   VN$(NumVars) = NAM$
  188.   VarFlag = NumVars
  189.   GOTO DuLast2:
  190. IF NumVars > 0 THEN
  191.   FOR t1 = 1 TO NumVars
  192.     IF NAM$ = VN$(t1) THEN
  193.       VarFlag = t1
  194.       GOTO DuLast2:
  195.     END IF
  196.   NEXT t1
  197. 'add new variable
  198. NumVars = NumVars + 1
  199. VN$(NumVars) = NAM$
  200. VarFlag = NumVars
  201. DuLast2:
  202. '------------------END subroutine Assign:----------------------
  203.  
  204.  
  205. '--------------subroutine ReplaceVars:-------------------------
  206. 'checks for operands being variables
  207. ReplaceVars:
  208. FOR t9 = 1 TO NumVars
  209.   IF VN$(t9) = L1$ THEN L1$ = LTRIM$(STR$(VV(t9)))
  210.   IF VN$(t9) = R1$ THEN R1$ = LTRIM$(STR$(VV(t9)))
  211. NEXT t9
  212. '-----------------END subroutine ReplaceVars:------------------
  213.  
  214.  
  215. '----------------subroutine ReplaceVar:------------------------
  216. 'catches case of a variable not being an operand
  217. ReplaceVar:
  218. chNam$ = MID$(z1$, 2, LEN(z1$) - 2)
  219. FOR t9 = 1 TO NumVars
  220.   IF VN$(t9) = chNam$ THEN z1$ = "(" + LTRIM$(STR$(VV(t9))) + ")"
  221. NEXT t9
  222. '-------------------END subroutine ReplaceVar:-----------------
  223.  
  224.  

10
Programs / Space Invaders
« on: November 07, 2021, 08:27:16 pm »
pretty sure "CLOCK" was my first "graphics program".
I wanted to see if I could do a retro video game.

SPACE INVADERS
 
NOTES:
linux has sound issues (for me) so, no sound
press ENTER when it starts; I forgot I would ever deploy it.
Z and X are left and right, SPACEbar to fire
I'm on LINUX MINT? and... it's a little faster than the original.

11
Programs / RANDOM and URANDOM bytes on demand
« on: November 07, 2021, 06:53:56 pm »
About a year ago, I got into a cryptology suite program.

I had FITS trying to make LINUX give me "CPU random bytes" that I *knew* were there, and all the big cryptology progs run off of the same bytes I am going to get...

I only needed to, periodically, stop and get a "new key pool".
IE, I need "x" bytes of completely random, mathematically random, distribution.
(software can bust you immediately, if you only PRETEND and use a RND statement, BTW)

so, this little GEM? took me *longer* than I will admit to publicly, to get
(learning LINUX as I go)

yeah, I know, your AI is *fine* with RND*256 random choices, yields 0-255;
this is for when you need "mathematically pure" random bytes. on demand.

PROGRAM:
1) runs perfect on LINUX MINT
2) most LINUX's should be okay
3) creates a couple files:

ddd, eee, fff, ggg

these contain the 1k / 4k / 64k / 1,000,000    bytes (respectively)

NOTE: if you are like me? and want to open and SEE the bytes are indeed "changing" each run?
          use "ddd" or "eee".....
          if you click on ggg, and open up 1,000,000 random bytes of gobbledygook? your little text editor might complain (mine does)

linux MINT executable :
 

got code?
Code: QB64: [Select]
  1. Print "attempting to extract 1k+4k+64k+1mb of bytes...": Print
  2. Shell "head -c 1024 /dev/urandom > ddd.dat"
  3. Print "1k successful; attempting 4k..."
  4. Shell "head -c 4096 /dev/urandom > eee.dat"
  5. Print "4k successful; attempting 64k..."
  6. Shell "head -c 65536 /dev/urandom > fff.dat"
  7. Print "64k successful; attempting 1,000,000 bytes..."
  8. Shell "head -c 1000000 /dev/urandom > ggg.dat"
  9. Print "1,000,000 bytes successful...": Print
  10. Print "check the file(s) now; program will terminate."
  11.  

NOTE: it goes w/o saying, this is LINUX only...  some windows API guy can explain how to do this in windows, please have them make a post

12
Programs / watchcat --- LINUX "fun-tility"
« on: November 07, 2021, 02:07:18 am »
I think any Linux guy has seen or heard of (or runs, lol) "conky"

its a cool... "thing to watch" that people "design" cool looks for.
really neat, like a executive magnetic sculpture.

anyways, I couldnt figure out where CONKY "gets" the thermal temperatures and stuff like that.
so... I found "CPU stuff" and PROCesses ifo and stuff, so, I made a little...
in WINDOWS it would be similar to a task VIEWer I suppose.

EDIT: I plan to add stuff if i can later on. I plan on the user can enter "watch these" entries, and...

those ones? I want to HIGHLIGHT with either color or graphics, or... both?
anyways, this is just silly fun, and, I am learning to get bytes out of "weird special linux files"
which is why I am doing this. Learning where stuff is in Linux. Cant hurt I figure.

LINUX executable...
 

13
Programs / CODENAME:Takky
« on: November 06, 2021, 11:45:51 pm »
This is my "big project" I have been working on, for about 2 months. In the evenings, when i can.

CODENAME:Takky

screenshots:
http://i.imgur.com/VcMYC5G.png
http://i.imgur.com/VrKzL6Z.png
http://i.imgur.com/vlhpJCm.png

1,983 lines of code, almost all of it inside FUNCtions and SUBs.
monolithic GUI
basically, a *working* VisualBasic "clone"... but... "preBETA" I call it...

*rough*
but? it demonstrates the almighty DATA STRUCTURE works fine, and for multiple forms.
I have...
buttons, labels, listboxes, textboxes, forms
I can...
auto-generate the "event" procedures,

working demo, like i said "pre"beta, a little rough.

PROBLEMS:
I have z-e-r-o idea how to... deploy this thing to anyone thats interested in seeing it.
you have to imagine? I have a SET of folders that surround this thing. Fonts folders, projects folders, etc etc
I have z-e-r-o experience... making downloadable.. installable... *stuff*

WORK I HAVE LEFT:
to be "finished" and by finished I mean "lets call this a beta"... not FINISHED finished....
1) I need arrays of controls, aiming for single DIMension. I *think* I got this, but, we'll see.
2) better project maker, better IDE
3) better and more controls. SLIDER buttons will be a PITA maybe.

1983 lines of GUI code, produces about 3MB per EXE of overhead.
I make NO windows calls, NO linux calls... I draw everything, i mouse everything.

14
Programs / CLOCK.BAS
« on: November 06, 2021, 10:57:25 pm »
CLOCK.BAS
---------------

my first program post on QB64... CLOCK.BAS

its, well... its yet another CLOCK program.
I wanted to "learn graphics" as I have always been a "business programmer".

NOTE:  I cut and pasted example HELP code, because the DRAW command impressed me with the TA thing.
           then I wasn't happy until I did "ghetto 360 degrees" fake-LED rotating numbers

apologies for the 'code style' which is "did not know I would eventually post it"

PS: screenshot... http://i.imgur.com/EkNLjfN.png


Code: QB64: [Select]
  1. maxx = 420
  2. maxy = 420
  3. x = INT(maxx / 2)
  4. y = INT(maxy / 2)
  5. SCREEN _NEWIMAGE(maxx, maxy, 32)
  6. _title "Clock"
  7. GOSUB draw_clock:
  8.  
  9. again:
  10. 'LOCATE 1, 1: PRINT "hours:";: LINE INPUT hour$: hour = VAL(hour$)
  11. 'LOCATE 1, 1: PRINT STRING$(64, " ")
  12. 'LOCATE 1, 1: PRINT "minutes:";: LINE INPUT minute$: minute = VAL(minute$)
  13.  
  14. z$ = TIME$
  15. GOSUB draw_digital: ': PRINT z$
  16. hour = VAL(LEFT$(z$, 2))
  17. IF hour > 12 THEN hour = hour - 12
  18. minute = VAL(MID$(z$, 4, 2))
  19. second = VAL(MID$(z$, 7, 2))
  20. 'IF second = 0 THEN _SCREENCLICK _SCREENX, _SCREENY
  21. GOSUB draw_clock:
  22. GOSUB draw_hands:
  23. loop1:
  24. IF TIME$ <> z$ THEN GOTO again: ELSE GOTO loop1:
  25.  
  26.  
  27. 'draw hands
  28. draw_hands:
  29. DRAW "TA0"
  30. 'hour hand (thicker little hand)
  31. 'IF hour = 0 THEN SYSTEM
  32. PSET (x, y), colr&
  33. DRAW "TA " + STR$((-30 * hour) + INT(minute / -2))
  34. DRAW "U15L1D15R2U15L1 L7U100R14D100L7 L6U99R12D98L12"
  35.  
  36. 'minute hand (thinner big hand)
  37. DRAW "TA0"
  38. PSET (x, y), colr&
  39. DRAW "TA " + STR$(-6 * minute)
  40. DRAW "U20L1D20R2U20L1 L5U120R10D120L5 L6U121R12D120L12"
  41.  
  42. 'second hand
  43. DRAW "TA0"
  44. PSET (x, y), colr&
  45. DRAW "TA " + STR$(-6 * second)
  46. DRAW "U145L1D145R2U145"
  47. 'try rotating seconds display
  48. DRAW "TA0"
  49. PSET (x, y), _RGB32(255, 0, 0) 'colr&
  50. DRAW "TA " + STR$(-6 * second)
  51. DRAW "bU183 bL15bU10"
  52. zecs$ = RIGHT$(STR$(100 + second), 2)
  53. zecs$ = LTRIM$(zecs$)
  54. zecs$ = RTRIM$(zecs$)
  55. ch$ = LEFT$(zecs$, 1): GOSUB draw_digit:
  56. DRAW "TA0"
  57. PSET (x, y), _RGB32(255, 0, 0) 'colr&
  58. DRAW "TA " + STR$(-6 * second)
  59. DRAW "bU183 bR5bU10"
  60. ch$ = RIGHT$(zecs$, 1): GOSUB draw_digit
  61.  
  62.  
  63. draw_clock:
  64. 'colr& = _RGB32(128, 128, 128)
  65. colr& = _RGB32(95, 95, 95)
  66. FOR csize = 150 TO 152
  67.   CIRCLE (x, y), csize, colr&
  68. NEXT csize
  69. FOR csize = 158 TO 160
  70.   CIRCLE (x, y), csize, colr&
  71. NEXT csize
  72. FOR csize = 197 TO 202
  73.   CIRCLE (x, y), csize, colr&
  74. NEXT csize
  75. CIRCLE (x, y), 7, colr&
  76. PAINT (x, y), colr&
  77. 'DRAW "U10D20U10R10L20"
  78. colr& = _RGB32(128, 128, 55)
  79. FOR Ang = 0 TO 360 STEP 6
  80.   PSET (x, y), colr&
  81.   DRAW "TA " + STR$(Ang) + "BU150" + "U10L1D10R2U10"
  82. NEXT Ang
  83.  
  84. colr& = _RGB32(128, 188, 61)
  85. FOR Ang = 0 TO 360 STEP 30
  86.   PSET (x, y), colr&
  87.   DRAW "TA " + STR$(Ang) + "BU150" + "U20L1D20R2U20L1" + "BU15"
  88.   FOR csize = 4 TO 5
  89.     CIRCLE STEP(0, 0), csize, colr&
  90.   NEXT csize
  91. NEXT Ang
  92.  
  93. FOR csize = 1 TO 3
  94.   CIRCLE (x, y), csize, _RGB32(0, 0, 0)
  95. NEXT csize
  96. 'face numbers
  97. COLOR _RGB32(6, 255, 255)
  98. _PRINTSTRING (x - 8, y - 140), "12"
  99. _PRINTSTRING (x + 62, y - 122), "1"
  100. _PRINTSTRING (x + 62, y + 106), "5"
  101. _PRINTSTRING (x - 70, y + 106), "7"
  102. _PRINTSTRING (x - 74, y - 122), "11"
  103. _PRINTSTRING (x + 112, y - 71), "2"
  104. _PRINTSTRING (x + 112, y + 62), "4"
  105. _PRINTSTRING (x - 120, y + 62), "8"
  106. _PRINTSTRING (x - 120, y - 71), "10"
  107. _PRINTSTRING (x - 4, y + 130), "6"
  108. _PRINTSTRING (x + 130, y - 8), "3"
  109. _PRINTSTRING (x - 138, y - 8), "9"
  110.  
  111.  
  112.  
  113. draw_digital:
  114. PSET (0, 0), _RGB32(255, 0, 0)
  115. DRAW "BR10BD10"
  116. ch$ = LEFT$(z$, 1): GOSUB draw_digit:
  117. PSET (0, 0), _RGB32(255, 0, 0)
  118. DRAW "BR30BD10"
  119. ch$ = MID$(z$, 2, 1): GOSUB draw_digit:
  120. PSET (0, 0), _RGB32(255, 0, 0)
  121. DRAW "BR50BD10"
  122. ch$ = MID$(z$, 4, 1): GOSUB draw_digit:
  123. PSET (0, 0), _RGB32(255, 0, 0)
  124. DRAW "BR70BD10"
  125. ch$ = MID$(z$, 5, 1): GOSUB draw_digit:
  126. PSET (0, 0), _RGB32(255, 0, 0)
  127. DRAW "BR340BD10"
  128. ch$ = MID$(z$, 7, 1): GOSUB draw_digit:
  129. PSET (0, 0), _RGB32(255, 0, 0)
  130. DRAW "BR360BD10"
  131. ch$ = RIGHT$(z$, 1): GOSUB draw_digit:
  132.  
  133.  
  134.  
  135. draw_digit:
  136. IF ch$ = "0" THEN DRAW "R10D10D10L10U10U10"
  137. IF ch$ = "1" THEN DRAW "BR10D10D10"
  138. IF ch$ = "2" THEN DRAW "R10D10L10D10R10"
  139. IF ch$ = "3" THEN DRAW "R10D10L10R10D10L10"
  140. IF ch$ = "4" THEN DRAW "D10R10U10D10D10"
  141. IF ch$ = "5" THEN DRAW "R10L10D10R10D10L10"
  142. IF ch$ = "6" THEN DRAW "R10L10D10D10R10U10L10"
  143. IF ch$ = "7" THEN DRAW "R10D10D10"
  144. IF ch$ = "8" THEN DRAW "R10D10L10U10D10D10R10U10"
  145. IF ch$ = "9" THEN DRAW "R10D10L10U10R10D20L10"
  146.  
  147.  
  148.  

15
QB64 Discussion / differences between LINUX and WINDOZE mouse routines?
« on: November 06, 2021, 08:48:41 pm »
phase 1 --- I begin to make retro games in QB64-WINdoze...
                  mouse *fine* in windoze.
                 
phase 2 --- compile SAME code to LINUX?
                  mouse is... drunk?

phase 3 --- decide to make retro games next in LINUX
                 mouse fine in LINUX

phase 4 --- compile to WINDOWS?
                  mouse is "sloppy drunk".

========================

now, I *am* a programmer; I have *some* logic to me, at least a little...
best I can explain? its as if, one is working on mouse UP, and the other on mouse DOWN...
and i have to PICK.

what am i missing, what am i describing?

Pages: [1]