Search found 1446 matches

by badidea
Jul 12, 2019 14:35
Forum: Game Dev
Topic: Mouse trouble
Replies: 21
Views: 2120

Re: Mouse trouble

I cannot run your code, but in this small game (https://freebasic.net/forum/viewtopic.php?f=15&t=27720) I detect mouse button release by storing the previous state of the mouse buttons. And I compare this against current state. Mouse button was active and now it is not, then button was released....
by badidea
Jul 08, 2019 16:26
Forum: General
Topic: Squares
Replies: 6886
Views: 403063

Re: Take a break

dodicat wrote:Summer is here.

Fractal trees?
by badidea
Jul 07, 2019 21:26
Forum: Game Dev
Topic: Another sliding puzzle
Replies: 1
Views: 826

Another sliding puzzle

Back to basics, no classes used. Controls: - Mouse click on tile to rotate tile - Mouse click on arrow to rotate a row / column - Escape key to quit const SCREEN_W = 640, SCREEN_H = 480 const IMG_SIZE = 400 const IMG_XO = (SCREEN_W - IMG_SIZE) \ 2 '120 const IMG_YO = (SCREEN_H - IMG_SIZE) \ 2 '40 co...
by badidea
Jul 06, 2019 17:53
Forum: General
Topic: Squares
Replies: 6886
Views: 403063

Re: Squares

A doodle a day, keeps the insanity away :-)
by badidea
Jul 06, 2019 12:53
Forum: General
Topic: Squares
Replies: 6886
Views: 403063

Re: Squares

FreeBASIC art: const SCREEN_W = 640, SCREEN_H = 480 const IMG_SIZE = 400 const IMG_XO = (SCREEN_W - IMG_SIZE) \ 2 '120 const IMG_YO = (SCREEN_H - IMG_SIZE) \ 2 '40 const as ulong WHITE = rgb(255, 255, 255) const as ulong GREEN = rgb(0, 200, 0) const as ulong RED = rgb(255, 0, 0) const as ulong YELLO...
by badidea
Jul 03, 2019 18:19
Forum: General
Topic: Why doesn't this crash (UDT copy)
Replies: 4
Views: 856

Re: Why doesn't this crash (UDT copy)

fxm wrote:
...the implicit copy constructor and the implicit let operator themselves support [re]sizing and copying such arrays, or their erasing)...

Thanks, the compiler is more advanced than I expected :-)
by badidea
Jul 02, 2019 22:22
Forum: General
Topic: Why doesn't this crash (UDT copy)
Replies: 4
Views: 856

Why doesn't this crash (UDT copy)

I have a piece of code that looks like this. I works fine, but I do not trust it. Is this code fine or unsafe? When I do 'poly(1) = poly(0)' when/how/who/what allocates memory for the 'points' array of 'poly(1)'? type sgl2d dim as single x, y end type type polygon redim as sgl2d points(any) declare ...
by badidea
Jun 29, 2019 23:35
Forum: Libraries
Topic: FLTK-C-1.3.3 for FreeBASIC
Replies: 353
Views: 45349

Re: FLTK C for FreeBASIC Jan 09, 2017

I did not see your post earlier, I will have a look tomorrow (if I don't forget).
by badidea
Jun 27, 2019 21:23
Forum: Beginners
Topic: Recursion in FreeBASIC
Replies: 10
Views: 1546

Re: Recursion in FreeBASIC

But program crashes (in Windows), by execution stack overflow I suppose. I will make a smaller example... Anyway, demonstration of another disadvantage of recursive functions :-) OK for Windows now? const SCRN_W = 640, SCRN_H = 480 const as ulong BLACK = rgb(0, 0, 0) const as ulong RED = rgb(255, 0...
by badidea
Jun 27, 2019 20:27
Forum: Beginners
Topic: Recursion in FreeBASIC
Replies: 10
Views: 1546

Re: Recursion in FreeBASIC

A 'classic' example is flood fill: const SCRN_W = 640, SCRN_H = 480 const as ulong BLACK = rgb(0, 0, 0) const as ulong RED = rgb(255, 0, 0) const as ulong GREEN = rgb(0, 255, 0) sub floodFill(x as integer, y as integer, fillColor as ulong) static as integer slowAnimation = 1 if point(x, y) = BLACK t...
by badidea
Jun 26, 2019 23:26
Forum: General
Topic: Squares
Replies: 6886
Views: 403063

Re: Squares

albert wrote:... but angle has no units ...

There are many, the radian is mostly used now: https://en.wikipedia.org/wiki/Angular_unit
But since rotation of a point mass is meaningless, rotation of an actual object can be calculated as movement over a distance (length) of many small parts the shape consists of.
by badidea
Jun 26, 2019 23:02
Forum: General
Topic: suker lump desolve sim try
Replies: 6
Views: 552

Re: suker lump desolve sim try

I dropped the sugar. Also very slow due to heavy use of 'point' and 'pset': const SCRN_W = 640, SCRN_H = 480 const as ulong BLACK = rgb(0, 0, 0) const as ulong WHITE = rgb(255, 255, 255) dim as integer x, y, i, dx screenres SCRN_W, SCRN_H, 32 width SCRN_W \ 8, SCRN_H \ 16 randomize timer for x = 0 t...
by badidea
Jun 26, 2019 18:29
Forum: General
Topic: suker lump desolve sim try
Replies: 6
Views: 552

Re: suker lump desolve sim try

MrSwiss wrote:Read comments in code ...
Recoded from scratch (faster than correcting):
...

That is not sugar, that is Swiss cheese.
by badidea
Jun 26, 2019 17:25
Forum: General
Topic: suker lump desolve sim try
Replies: 6
Views: 552

Re: suker lump desolve sim try

From using point outside the window/screen.
Reference manual wrote:If the coordinates are off-screen or off-buffer, -1 is returned

-1 is FF FF FF FF in hex is white.
by badidea
Jun 24, 2019 22:40
Forum: General
Topic: Squares
Replies: 6886
Views: 403063

Re: Squares

No, stop using these ancient units if you want to get anywhere.
They are like roman numerals, still around, but highly impractical to work with.

Go to advanced search