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 - Joshua

Pages: [1]
1
QB64 Discussion / Re: Weird graphics artifact using WINDOW
« on: December 31, 2018, 04:46:59 pm »
Everything is working fine.  I made a mistake.  In the WINDOW statement, the winWidth and winHeight values are backwards

The right code:
Code: QB64: [Select]
  1. WINDOW (0, 0)-(winWidth- 1, winHeight- 1)
  2.  

2
QB64 Discussion / Re: How to generate normal / Gaussian randoms
« on: December 31, 2018, 04:27:45 pm »
I'm not sure it's behaving correctly for me.  When I hit enter, the category 10 has a big spike that goes off screen.  Or how should I read the graph?   Maybe I'm doing it wrong.

3
QB64 Discussion / [SOLVED] Weird graphics artifact using WINDOW
« on: December 31, 2018, 04:09:42 pm »
I like having the Cartesian coordinates with the origin in the lower left for graphics, so I'll use the WINDOW statement like so:
Code: QB64: [Select]
  1. CONST winWidth = 800
  2. CONST winHeight = 600
  3.  
  4. SCREEN _NEWIMAGE(winWidth, winHeight, 32)
  5. WINDOW (0, 0)-(winHeight - 1, winWidth - 1)
  6.  
  7. FOR x = 0 TO winWidth
  8.     LINE (x, 100)-(x, 300), _RGB(127, 127, 127)
  9.  


But you'll notice when you run the code there is some sort of underflow error when the lines are displayed, as there are gaps.  If you remove the WINDOW statement, it correctly makes a solid bar.  Is there another way to move 0,0 to the lower left without this artifact?

4
QB64 Discussion / Re: How to generate normal / Gaussian randoms
« on: December 31, 2018, 02:27:16 pm »
Looks like it was written in GWbasic!  Would you be able to put the random number generator code portion and put it in a function?

5
QB64 Discussion / Re: Screen mode attributes
« on: December 30, 2018, 09:54:02 pm »
I just noticed the _CLEARCOLOR statement, this could be a game changer

6
QB64 Discussion / Screen mode attributes
« on: December 30, 2018, 09:16:37 pm »
Is the max number of color attributes still 256 (Screen 13), or are there new screen modes with more?
I have some onscreen objects that I want to react to light sources by using PALETTE to change their color/brightness.  I'm using PALETTE because I assume this is faster than redrawing everything with new color values (using PSET, LINE, CIRCLE, etc).  Using PALETTE this way I'm limited to 256 individual objects on screen.

Or is there a newer better way to change the color of onscreen objects, without redrawing them?

I haven't fully explored all the new graphical offerings, or even the old ones for that matter.

7
QB64 Discussion / Re: How to generate normal / Gaussian randoms
« on: December 30, 2018, 08:36:11 pm »
For anyone interested, a very approximate normally distributed randoms can be generated by multiplying two random numbers:

NRND = (RND*2-1)*(RND*2-1)

This will give values between -1 and 1, and if you plot them in a histogram, they will be mostly clustered around 0.

Not great, but it's fast, good for introducing a little natural variability to simulations.

8
QB64 Discussion / How to generate normal / Gaussian randoms
« on: December 29, 2018, 06:56:33 pm »
Given RND, does anyone have function that can give a fairly decent approximation to normally distributed values?  It doesn't have to be exact, speed of computation is more important.

9
QB64 Discussion / Re: QB64 command line
« on: December 29, 2018, 05:42:52 pm »
Excellent.  If I'm reading this correctly, you can have a look at the c++ code if you use -z?

But vim?  That's hardcore.  Nano is as far as I care to go with cli editors.

10
QB64 Discussion / QB64 command line
« on: December 29, 2018, 03:40:08 pm »
I seem to remember that you can run the QB64 compiler from the command line?  Is there a reference about it?  When I search all I find is COMMAND$ etc.

I've been using VScode a lot lately and enjoying it.  I'm toying with the idea of maybe making an extension for QB64.

Pages: [1]