Recent Posts

Pages: [1] 2 3 ... 10
1
Code snippets / Re: Trying simple fractals
« Last post by Rick3137 on November 17, 2017 »
 Nice work.

   I learnt a new trick. Your use of " return" to limit a recursion.
   I somehow missed that one when I read the examples the first time.
2
Code snippets / Trying simple fractals
« Last post by Marcus on November 17, 2017 »
I've never tried creating any fractals before, so don't laugh :)  Here are two simple line based ones, will try creating polygon based fractals next:

Code: [Select]
' Some simple fractals.

import "ifx.lib"

visible:
lineCount = 0
hidden:

h = 640
w = h*16/9

set window (screenw() - w)/2, (screenh() - h)/2, w, h
'set window screenw() - w - 32, screenh() - h - 64, w, h
x# = float(width(primary)/2)
y# = float(height(primary))
l# = float(height(primary))*0.26
a# = 270.0

if not IFX_Init() then end

set redraw off
create image 0, width(primary), height(primary)

' A tree fractal.
set image 0
_FractalOne x, y, l, a, 1, 16.0
set color 0, 0, 0
draw rect 0, 0, 256, 32, true
set color 255, 255, 255
set caret 8, 8
wln "Tree fractal: ", lineCount, " lines"
set image primary
_DrawWithGlow 0, 128, 200, 255
redraw
wait keydown

' A line fractal.
set image 0
set color 0, 0, 0; cls
set color 255, 255, 255
lineCount = 0
'_FractalTwo 0.0, float(h/2), float(w), float(h), 16.0
_FractalTwo 0.0, float(h), float(w), float(h), 16.0
set color 0, 0, 0
draw rect 0, 0, 256, 32, true
set color 255, 255, 255
set caret 8, 8
wln "Line fractal: ", lineCount, " lines"
set image primary
set color 0, 0, 0; cls
_DrawWithGlow 0, 255, 64, 8
redraw
wait keydown

procedure DrawWithGlow(img, r, g, b)
set color r, g, b
set additive true
for i = 5 downto 0
draw image img, 0, 0
_IFX_Blur max(i*8, 1)
next
set color 255, 255, 255
draw image img, 0, 0
set additive false
endproc

procedure FractalOne(x#, y#, l#, a#, step, limSqr#)
x2# = x + l*cos(a)
y2# = y + l*sin(a)
dx# = x2 - x
dy# = y2 - y
if dx*dx + dy*dy < limSqr then return
_FractalOne x2, y2, l*0.75, a + 22.5, step + 1, limSqr
_FractalOne x2, y2, l*0.75, a - 45.0, step + 1, limSqr
set color step*12, step*12, step*12
draw line int(x), int(y), int(x2), int(y2)
lineCount = lineCount + 1
endproc

procedure FractalTwo(x1#, y1#, x2#, y2#, limSqr#)
dx# = x2 - x1
dy# = y2 - y1
if dx*dx + dy*dy < limSqr
draw line int(x1), int(y1), int(x2), int(y2)
lineCount = lineCount + 1
return
else
cx1# = x1 + dx*1.0/4.0
cy1# = y1 + dy*1.0/4.0
cx2# = x1 + dx*1.0/2.0
cy2# = y1 + dy*1.0/2.0
draw line int(x1), int(y1), int(cx1), int(cy1)
draw line int(cx2), int(cy2), int(x2), int(y2)
lineCount = lineCount + 2
cx# = dy*0.686
cy# = -dx*0.686

_FractalTwo cx1, cy1, (x1 + x2)*0.5 + cx, (y1 + y2)*0.5 + cy, limSqr
_FractalTwo (x1 + x2)*0.5 + cx, (y1 + y2)*0.5 + cy, cx2, cy2, limSqr
endif
endproc

Sorry for trying to make them look cooler with glow effects, but ... it does the trick.
3
General discussion / Re: NaaLaa Linux experiments
« Last post by Marcus on November 10, 2017 »
The issues with polygon drawing and the raycaster failure were caused by the fact that naalaa on Linux is 64 bit instead of 32 (as on Windows). The mixed size of data types caused naalaa's arrays to go ape-shit. So, now naalaa only uses 64 bit types on Linux. Integers are 64 bits and the floating point type is now represented by a 64 bit double instead of a 32 bit float. This means ... that we'll be able to make deeper Mandelbrot zooms :)

If any Linux guy reads this, is a 32 bit version a "must" these days? Not even sure if I can make and test it on my machine.
4
General discussion / Re: NaaLaa Linux experiments
« Last post by cvirus on November 08, 2017 »
HeliAttack screen, compiling everything with no errors,  one must be careful with case sensitive, cause Linux is sensive.
5
General discussion / Re: NaaLaa Linux experiments
« Last post by Marcus on November 08, 2017 »
Nice :D

I made many tests yesterday. The biggest issues left to fix are:

  • There's no sound
  • Drawing polygons doesn't work
  • Raycaster and Mode7 libraries cause really weird output
  • Writing an IDE
  • Big pixel modes work but fullscreen mode doesn't
  • 'create font' doesn't work
  • The extension system doesn't work

Before releasing anything, even a beta thingy, I want to take care of all but the last two issues. I just don't think I can write a TTF to Bitmap font thing under Linux, but I will of course try. I'd rather make 'load font' handle more formats than naalaa's own, so that you can create fonts using Hiero and other bitmap font generators. Making extensions work probably isn't that hard. But re-writing some of the extensions will take lots of time, since they're not cross-platform by nature.

6
General discussion / Re: NaaLaa Linux experiments
« Last post by cvirus on November 07, 2017 »
HeliAttack Latest version on Linux Ubuntu 16.04 LTS.
7
General discussion / Re: NaaLaa Linux experiments
« Last post by cvirus on November 07, 2017 »
New Screens SpaceShooting and CrapsAdventure Ubuntu.
8
General discussion / Re: NaaLaa Linux experiments
« Last post by cvirus on November 06, 2017 »
well it's working quite nice.

9
General discussion / NaaLaa Linux experiments
« Last post by Marcus on November 06, 2017 »
Well, don't get your hopes up quite yet, but I'm finally working on a real Linux port of NaaLaa, with some support from cvirus.

It's working but without sound so far (I haven't decided what to go with there - audiere, free but old, or fmod or bass, not quite free). Extensions will have to wait, so it'll be more like NaaLaa 5 than 6. Hopefully I can upload a test version soon that anyone with a Linux system can try out.

10
Code snippets / Re: Mandala Rock Painting
« Last post by Rick3137 on September 30, 2017 »
  No problem Marcus. Use anything you want.
Pages: [1] 2 3 ... 10