News:

Welcome to RetroCoders Community

Main Menu

freebasic CATRUN.bas port from gw basic

Started by ron77, Mar 25, 2024, 02:28 PM

Previous topic - Next topic

ron77

this old gw basic animation was ported thanks to mysoft

dim as long iMoveAmount(5) = {8,5,9,6,5,7}
dim as long uCat(...) = { _
  &h00000000,&h00000000,&h000003FA,&h001FFC06,&h00E00001,&h01000139,&h06000126,&h7C03FFB0,&h887C007C,&h0F80000A,&h18000005,&h28000000,&h0C000000, _
  &h00000000,&h00000000,&h00000000,&h003F87C4,&h00C0783C,&h01000002,&h06000171,&hFA07FFCE,&h06380370,&h1DC0011C,&h08000103,&h30000180,&h000000C0, _
  &h00000000,&h0007C000,&h00183008,&h00600FBC,&h00C00042,&h01208011,&h0221602E,&h7C421F40,&h005C0540,&h002018E0,&h00101030,&h00201008,&h00000804, _
  &h00000000,&h0003C000,&h00083000,&h03F00C08,&h04100218,&h181201E4,&hE0091002,&h0005A03C,&h00036FC0,&h00035800,&h0001D800,&h00008800,&h00000C00, _
  &h00000000,&h00000000,&h3F0F8000,&h40F06020,&h401018E0,&h00200710,&h00200008,&h002020F0,&h0017FB00,&h00181400,&h00142800,&h00344000,&h001B0000, _
  &h70000000,&h0F000000,&h00E3C004,&h001C301E,&h00200EE1,&h00400101,&h0040001E,&h00438020,&h00847FD0,&h01380070,&h01400000,&h00A00000,&h00780000 _
}
 
const Scale = 3
dim as long iCatX = -50*Scale,iCatY=rnd*((100-13)*Scale)
screenres 160*Scale,100*Scale,8
 
do
  for I as long = 0 to ubound(uCat) step 13
   
    line(iCatX-10*Scale,iCatY+-1*Scale)-step(43*Scale,Scale),0,bf
    for N as long = 0 to 12
      line(iCatX-10*Scale,iCatY+N*Scale)-step(43*Scale,Scale),0,bf
      for K as long = 0 to 31
        if ((uCat(I+N) shr (31-K)) and 1) then circle(iCatX+K*Scale,iCatY+N*Scale),(Scale\2)+1,K+32,,,,f
      next K
    next N    
   
    sleep 80,1
   
    iCatX += iMoveAmount(I\13)*Scale
    if iCatX >= ((160+30)*Scale) then
      iCatX=-50*Scale : iCatY=rnd*(100-13*Scale)
    end if
     
   
  next I
loop
 
sleep
 

second version with with opengl scale

#include "fbgfx.bi"
 
dim as long iMoveAmount(5) = {8,5,9,6,5,7}
dim as ulong uCat(...) = { _
  &h00000000,&h00000000,&h000003FA,&h001FFC06,&h00E00001,&h01000139,&h06000126,&h7C03FFB0,&h887C007C,&h0F80000A,&h18000005,&h28000000,&h0C000000, _
  &h00000000,&h00000000,&h00000000,&h003F87C4,&h00C0783C,&h01000002,&h06000171,&hFA07FFCE,&h06380370,&h1DC0011C,&h08000103,&h30000180,&h000000C0, _
  &h00000000,&h0007C000,&h00183008,&h00600FBC,&h00C00042,&h01208011,&h0221602E,&h7C421F40,&h005C0540,&h002018E0,&h00101030,&h00201008,&h00000804, _
  &h00000000,&h0003C000,&h00083000,&h03F00C08,&h04100218,&h181201E4,&hE0091002,&h0005A03C,&h00036FC0,&h00035800,&h0001D800,&h00008800,&h00000C00, _
  &h00000000,&h00000000,&h3F0F8000,&h40F06020,&h401018E0,&h00200710,&h00200008,&h002020F0,&h0017FB00,&h00181400,&h00142800,&h00344000,&h001B0000, _
  &h70000000,&h0F000000,&h00E3C004,&h001C301E,&h00200EE1,&h00400101,&h0040001E,&h00438020,&h00847FD0,&h01380070,&h01400000,&h00A00000,&h00780000 _
}
 
dim as long iCatX = -50
 
'~ screen 13
screencontrol(fb.SET_GL_2D_MODE,fb.OGL_2D_MANUAL_SYNC)
screencontrol(fb.SET_GL_SCALE,3)
screenres 320,200,8,,fb.GFX_OPENGL

do
  for I as long = 0 to ubound(uCat) step 13
   
    for N as long = 0 to 12
      line(iCatX-10,N)-step(40,0),0
      line(iCatX+ 0,N)-step(15,0),15,,uCat(I+N) shr 16
      line(iCatX+16,N)-step(15,0),15,,uCat(I+N)  
    next N
   
    flip:sleep 80,1
    iCatX += iMoveAmount(I\13)
    if iCatX >= (320+30) then iCatX=-50
   
  next I
loop
 
sleep