Search found 594 matches

by neil
Apr 22, 2024 4:21
Forum: Sources, Examples, Tips and Tricks
Topic: Custom typeface (font)
Replies: 8
Views: 703

Re: Custom typeface (font)

Here are a couple of Cairo fonts. #include once "cairo/cairo.bi" const W as integer = 1024 const H as integer = 768 screenres W, H, 32 dim as any ptr image = imagecreate(W, H) dim as any ptr pixels imageinfo(image, W, H,,, pixels) dim as long stride = cairo_format_stride_for_width(CAIRO_FO...
by neil
Apr 20, 2024 4:31
Forum: Sources, Examples, Tips and Tricks
Topic: Magic Eight Ball
Replies: 4
Views: 493

Re: Magic Eight Ball

I updated the magic eight-ball shaking version. Now you can use the mouse; it has a shake button.
by neil
Apr 19, 2024 3:26
Forum: Sources, Examples, Tips and Tricks
Topic: Theodorus Spiral
Replies: 4
Views: 495

Re: Theodorus Spiral

Maybe you could try to make something like this?
Colored extended spiral of Theodorus with 110 triangles.
https://en.wikipedia.org/wiki/Spiral_of ... tended.svg
by neil
Apr 18, 2024 2:51
Forum: Sources, Examples, Tips and Tricks
Topic: Simple 2D Ball Collision Demo
Replies: 11
Views: 936

Re: Simple 2D Ball Collision Demo

Here's a tornado illusion spinning effect. I came up with this while experimenting with the circle function. Maybe someone could make improvements to how it looks and to its random behavior. ' tornado simulation demo by neil ScreenRes 1024, 768, 32 Dim As Integer i = 0, x = 500, y = 380, n = 0 Sub d...
by neil
Apr 17, 2024 7:15
Forum: Sources, Examples, Tips and Tricks
Topic: Magic Eight Ball
Replies: 4
Views: 493

Re: Magic Eight Ball

Here's a working magic eight ball shaking version. ' magic eight ball shaking version ScreenRes 800, 600, 32 Dim As Integer mx, my, lb Dim As Ulong i, j, r, x, y, Red, Green, Blue, distance Dim As Ubyte rndanswer Dim As string key function map(a as double,b as double,x as double,c as double,d as dou...
by neil
Apr 16, 2024 21:00
Forum: Sources, Examples, Tips and Tricks
Topic: Magic Eight Ball
Replies: 4
Views: 493

Re: Magic Eight Ball

Here's another way to get the shaking effect using random ' shaking ball demo Dim As Integer i, x, y, distance Screenres 800,600,32 Randomize distance = 8 ' how far the ball moves for i = 1 to 500 ScreenLock Cls x = Int(Rnd * distance) + 400 y = Int(Rnd * distance) + 300 Circle (x, y), 100, rgb(0, 2...
by neil
Apr 16, 2024 11:10
Forum: Sources, Examples, Tips and Tricks
Topic: Magic Eight Ball
Replies: 4
Views: 493

Re: Magic Eight Ball

Here's another idea I have for a shake version. This is not a complete working program; it's only an idea of how to make the ball shake and then give an answer. ' magic eight ball shake idea Screenres 800,600,32 Dim As Integer x, y, i, n x = 400: y = 300 Color rgb(0, 0, 0),rgb(255,255,255) Cls for i...
by neil
Apr 16, 2024 8:38
Forum: Sources, Examples, Tips and Tricks
Topic: Magic Eight Ball
Replies: 4
Views: 493

Magic Eight Ball

Here's my version of a magic eight ball. Ask a yes-or-no question out loud. Then press the space bar for an answer. ' FreeBasic Magic 8 Ball program SCREENRES 800, 600, 32 CONST PI = 3.14159265359 CONST RADIUS = 200 CONST SPEED = 0.05 DIM SHARED AS INTEGER centerX, centerY DIM SHARED AS DOUBLE angle...
by neil
Apr 14, 2024 8:12
Forum: General
Topic: Is this a bug in FreeBasic graphics?
Replies: 5
Views: 664

Re: Is this a bug in FreeBasic graphics?

@fxm I was only using the circle function to make a sprite. I am trying to learn how to use Put correctly, so later I can use bit-mapped graphics and erase them without using CLS. After I changed the screen color to white, I discovered I had to use Pset with DrawBall also. Without using Pset with Dr...
by neil
Apr 14, 2024 6:12
Forum: General
Topic: Is this a bug in FreeBasic graphics?
Replies: 5
Views: 664

Re: Is this a bug in FreeBasic graphics?

@fxm
I updated my code with comments. I also added.

put(x, y),DrawBall, Pset

Would it be better not to use Pset with DrawBall?

Maybe it runs faster without using it on DrawBall.
by neil
Apr 13, 2024 23:52
Forum: General
Topic: Is this a bug in FreeBasic graphics?
Replies: 5
Views: 664

Is this a bug in FreeBasic graphics?

I'm attempting to erase a sprite without utilizing the CLS feature. Even though I'm not using RGBA; I'm using RGB. I have to erase the ball sprite using Alpha. In my opinion, while utilizing RGB, I shouldn't have to use Alpha in my code. Could someone please check my code to see if there are any mis...
by neil
Apr 13, 2024 9:34
Forum: Sources, Examples, Tips and Tricks
Topic: Simple 2D Ball Collision Demo
Replies: 11
Views: 936

Re: Simple 2D Ball Collision Demo

Nice catch and throw, UEZ. I gave the ball a 3D look and put it in a sprite. ' elastic bouncing ball sprite version by neil Const w = 1080 Const h = 720 Screenres w, h, 32 Dim As Any Ptr DrawBall = ImageCreate(75, 75, RGB(0, 0, 0)) Dim As Any Ptr EraseBall = ImageCreate(75, 75, RGB(0, 0, 0)) Dim As ...
by neil
Apr 13, 2024 6:42
Forum: Sources, Examples, Tips and Tricks
Topic: Simple 2D Ball Collision Demo
Replies: 11
Views: 936

Re: Simple 2D Ball Collision Demo

I updated the elastic bouncing ball. I added mass and slowed down the speed.
by neil
Apr 13, 2024 1:20
Forum: Sources, Examples, Tips and Tricks
Topic: Simple 2D Ball Collision Demo
Replies: 11
Views: 936

Re: Simple 2D Ball Collision Demo

Here's an elastic bouncing ball simulation. It has settings for mass, velocities, elasticity, friction, and gravity.  ' elastic bouncing ball by neil Const w = 1080 Const h = 720 Screenres w, h, 32 Dim As Single x, y, vx, vy, radius, mass, gravity, elasticity, friction x = 20 y = 20 vx = 6 'velocity...
by neil
Apr 11, 2024 23:24
Forum: Sources, Examples, Tips and Tricks
Topic: Three swinging sticks kinetic energy
Replies: 16
Views: 1548

Re: Three swinging sticks kinetic energy

Double pendulum chaotic motion. This double pendulum was quite tricky to get working in Freebasic. https://en.wikipedia.org/wiki/Double_pendulum ' double pendulum chaotic motion by neil const AS Integer W = 660 const AS Integer H = 660 const As Double pi = 3.14159265 screenres W, H, 32 dim as double...