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.


Messages - _vince

Pages: 1 [2] 3 4 ... 29
16
Programs / Re: Rotating Pyramid
« on: March 06, 2022, 03:50:39 pm »
B+ mode time!

Code: QB64: [Select]
  1. const d = 300
  2. const z0 = 550
  3. const oy = -210
  4.  
  5. pi = 4*atn(1)
  6.  
  7. dim x(14), y(14), z(14)
  8.  x( 0) =  0:  y( 0) =   0:  z( 0) =  0
  9.  x( 1) = 50:  y( 1) =-140:  z( 1) = 50
  10.  x( 2) =-50:  y( 2) =-140:  z( 2) = 50
  11.  x( 3) =-50:  y( 3) =-140:  z( 3) =-50
  12.  x( 4) = 50:  y( 4) =-140:  z( 4) =-50
  13.  x( 5) = 50:  y( 5) =-140:  z( 5) = 50
  14.  
  15. zoom = 5
  16.  
  17. sw = 640
  18. sh = 480
  19.  
  20.  
  21. a = 0
  22.         cls
  23.  
  24.         a=a+0.01
  25.  
  26.         xx = x(0)
  27.         yy = y(0)
  28.         zz = z(0)
  29.         rot xx, zz, a
  30.         proj p0, q0, xx, yy, zz
  31.  
  32.         'draw all triangles
  33.         for i=1 to 4
  34.                 x1 = x(i)
  35.                 y1 = y(i)
  36.                 z1 = z(i)
  37.                 rot x1, z1, a
  38.  
  39.                 x2 = x(i + 1)
  40.                 y2 = y(i + 1)
  41.                 z2 = z(i + 1)
  42.                 rot x2, z2, a
  43.  
  44.                 c = _rgb(70,70,70)
  45.  
  46.                 proj p, q, x1, y1, z1
  47.                 pset (sw/2 + zoom*p0, sh/2 - zoom*q0 + oy), c
  48.                 line -(sw/2 + zoom*p, sh/2 - zoom*q + oy), c
  49.  
  50.                 proj p, q, x2, y2, z2
  51.                 line -(sw/2 + zoom*p, sh/2 - zoom*q + oy), c
  52.                 line -(sw/2 + zoom*p0, sh/2 - zoom*q0 + oy), c
  53.         next
  54.  
  55.         'draw the visible triangles
  56.         for i=1 to 4
  57.                 x1 = x(i)
  58.                 y1 = y(i)
  59.                 z1 = z(i)
  60.                 rot x1, z1, a
  61.  
  62.                 x2 = x(i + 1)
  63.                 y2 = y(i + 1)
  64.                 z2 = z(i + 1)
  65.                 rot x2, z2, a
  66.  
  67.                 'vector cross product
  68.                 'cx = y1*z2 - z1*y2
  69.                 'cy = x1*z2 - z1*x2
  70.                 cz = x1*y2 - y1*x2
  71.  
  72.                 if cz >= 0 then
  73.                         c = _rgb(255,255,255)
  74.  
  75.                         proj p, q, x1, y1, z1
  76.                         pset (sw/2 + zoom*p0, sh/2 - zoom*q0 + oy), c
  77.                         line -(sw/2 + zoom*p, sh/2 - zoom*q + oy), c
  78.  
  79.                         proj p, q, x2, y2, z2
  80.                         line -(sw/2 + zoom*p, sh/2 - zoom*q + oy), c
  81.                         line -(sw/2 + zoom*p0, sh/2 - zoom*q0 + oy), c
  82.                 end if 
  83.         next
  84.  
  85.         _display
  86.         _limit 30
  87.  
  88. 'rotate
  89. sub rot(x, y, a)
  90.         xx = x*cos(a) - y*sin(a)
  91.         yy = x*sin(a) + y*cos(a)
  92.         x = xx
  93.         y = yy
  94.  
  95. 'perspective projection
  96. sub proj(p, q, x, y, z)
  97.         dz = z0 + z
  98.         p = x*d/dz
  99.         q = y*d/dz
  100.  
  101.  

17
QB64 Discussion / Re: &H colors dont work as CONST
« on: March 05, 2022, 09:10:28 pm »
(Unless you're working with a 256 color screen, in which case you'd probably want the include to set the palette to match the names for any temp/secondary screens you might create.)

oh yeah I spent hours wondering why my screen wasn't BananaMania then I realized I was in 256 mode!

anyways, since 256 mode is effectively emulated, why would anyone use that mode?  Why not stick to 32 bit color mode and just create DIM a(256): a(0)=BananaMania: a(1)=_rgb(255,0,0): etc, or have it match the original VGA palette, or map it to 'Hue', or whatever and use that with any graphics command for an effective 256 mode emulation, ie CIRCLE (100,100),3,a(155) instead of CIRCLE (100,100),3,155

18
QB64 Discussion / Re: &H colors dont work as CONST
« on: March 05, 2022, 02:44:12 am »
oh wow, you built in your colour constants into QB64, handy!

btw, did you hand-pick these constants yourself? I trust that WildWatermelon, BananaMania, VividViolet and such others are tastefully fine tuned to their literal connotation

19
QB64 Discussion / Re: &H colors dont work as CONST
« on: March 04, 2022, 11:15:56 pm »
The whole CONST system was replaced by Steve at some point.

Glad to know the fundamental CONST is in good hands!

May I recommend Steve's useful colour storage tutorial
https://qb64forum.alephc.xyz/index.php?topic=4480.0

though, personally, I prefer to leave it to the pros and just quickly include one of these in my programs ;)
https://qb64.freeforums.net/thread/5/32-bit-color-const-names


20
Programs / Re: Evolving RI (Robot Intelligence) for a room vacuum
« on: March 04, 2022, 11:10:43 pm »
This pursuit warranted firing up the scanner! nice!

21
QB64 Discussion / Re: QB64 code for "Spinny Cube"
« on: February 28, 2022, 09:49:27 am »
also I apologize for possibly distracting from great code translation!

possibly? you turned this thread into a Steve novel!

22
QB64 Discussion / Re: QB64 code for "Spinny Cube"
« on: February 27, 2022, 12:13:39 pm »
Hey Paul Dunn again!

Could be handy for The 6 Sides of Cube challenge at Syntax Bomb.

wow what is syntax bomb and what is it about?

23
QB64 Discussion / Re: _MAPTRIANGLE 3D ----> 2D ?
« on: February 21, 2022, 12:25:38 am »
plot a set of 3D triangles then use POINT to find their corners!

24
QB64 Discussion / Re: Nintendo Switch or Wii or 32k Atari 2600 support?
« on: February 20, 2022, 04:11:57 pm »
I do recall that someone was able to make games for the Nintendo DS using FreeBASIC (another similar QB-like language).  The process involved using the multiplatform low-level C output version of the compiler but that is as far as I know and as much of an answer as I can provide in that regard.

25
QB64 Discussion / Re: February Number Challenge
« on: February 19, 2022, 04:01:14 pm »
wow Steve, you also program in Liberty BASIC?

26
QB64 Discussion / Re: February Number Challenge
« on: February 19, 2022, 02:54:23 pm »
I found this at Liberty Basic Forum (Feb 8) and so far nobody there has figured it out.

I just did but let's see if someone else can here at this forum:

tsh73

Who is the best programmer there? tsh, Rod, or technotitlick?

27
Programs / Re: QBJS - QBasic for the Web
« on: February 18, 2022, 01:58:13 pm »
PS I see we don't do files yet.

Do you mean an Open/Save dialog for your programs saved on your local hard drive or OPEN "file.txt" FOR BINARY etc?  For the former, I just use notepad plus copy/paste as quick and easy intermediate. 

Ultimately, you can probably do something with the QB64 IDE or any other editor and have a script generate a base64 URL, open a browser and instant run when you press F5.  But yeah, it can't lock you into a comfortable playpen like JB but then again there's a whole universe waiting outside!

28
Programs / Re: Terror in the Maze (graphics enhancement + surround sound)
« on: February 17, 2022, 08:39:37 pm »
nice, do you do all your 3D work using only MAPTRIANGLE and nothing _gl just like your flight simulator?  The 2D or 3D version of maptriangle?

29
Pretty cool,  reminds me of something similar Steve did with PUTIMAGE https://qb64forum.alephc.xyz/index.php?topic=4591.0

30
Programs / Re: courtesy cubes :)
« on: February 15, 2022, 05:43:09 pm »
I was just thinking of a minimalist 3D skill game that could be written from a few lines.

A dense pasture of cows -- now get your tractor from one corner to the next without hitting any

Pages: 1 [2] 3 4 ... 29