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

Pages: [1] 2 3 4 5 6 7 8 ... 26
1
Freebasic / Re: Old school mania
« on: April 14, 2014 »
Not had chance to come on here for a while - sorry guys. However after saying that - absolutely loving this . . . really nicely done. You can't beat pixel bashing. Thanks for sharing the code too Ninogenio. :)

DrewPee

2
Freebasic / Re: Vector Scroll Source Code
« on: January 24, 2012 »
Shockwave - just downloaded the source for this - I have to say one thing - STUNNING - loving what you have done. Sorry it has taken me so long to download it! ;)

Drew

3
General chat / Retro Computer Museum news . . .
« on: July 03, 2011 »
Dear Friends,
It is our very great pleasure in announcing that the Retro Computer Museum in Leicestershire now has a home.
It is a self contained building with enough room to show off a good number of our lovely retro machines and to also store our extensive collection of other hardware and related software.
It has taken us three years to get to this major milestone but it has been well worth the hard work. Thank you for your support over the last three years and hopefully your continued support for the future - Further details will follow shortly.
One final point . . . it is The Retro Computer Museums 3rd Birthday today too! :)
Regards
DrewPee aka AndyRCM and the rest of the RCM Team

4
In 3 lines, delta timed:

Code: [Select]
#Include Once "tinyptc.bi"
If( ptc_open( "PARALAX STARFIELD BY SHOCKWAVE", 800, 600 ) = 1 ) Then dim shared buffer(800*600) as double, px(200),py(200) as double ,ps(200) as double:for n=0 to 200:px(n)=rnd(1)*790:py(n)=rnd(1)*590:ps(n)=1+(rnd(1)*5):next :dim shared dv as double, old as double
0 for n=0 to 200: old=timer: if px(n)>0 and px(n)<800 then buffer(int(px(n))+(int(py(n))*800))=&hffffff: px(n)=px(n)+(ps(n)*dv) else px(n)=1:  end if:next:ptc_update@buffer(0): sleep 1: dv=(timer-old)*40:erase buffer:if inkey$="" then 0

 :goodpost:

Nice one Shockwave - very impressive indeed - I was pleased with less than 10 lines of code so . . . excellent work indeed! :)

DrewPee

5
Thought I would share this - but can this be compressed any more?

Code: [Select]
#include once "tinyptc_ext.bi"
const xres=640,yres=480,sf=512:Dim shared as integer size,q,w,a,x(sf),y(sf),s(sf),sb(xres*yres):size=8
for a=0 to sf-1:x(a)=(int(rnd(1)*xres)-1):y(a)=1+(int(rnd(1)*yres)-1):s(a)=1+(int(rnd(1)*8)):next:ptc_setdialog(0,"Fullscreen?",0,1)
If( ptc_open( "Starfield in less than 10 lines of code", XRES, YRES ) = 0 ) Then
End -1:End If
#define pp(x,y,argb) sb(y*XRES+x)=argb
While(GETASYNCKEYSTATE(VK_ESCAPE)<> -32767 and PTC_GETLEFTBUTTON=FALSE):for a=0 to sf-1: x(a)=x(a)-s(a):if x(a)<=0 then x(a)=(xres-1):y(a)=1+(int(rnd(1)*yres)-1)
for q=1 to size:for w=1 to size:if x(a)+q>0 and x(a)+q<xres-3 and (y(a)+w)>0 and (y(a)+w)<yres-2 then pp(x(a)+q,(y(a)+w),rgb(s(a)*16,s(a)*16,s(a)*16))
next:next:next:ptc_update @sb(0):erase sb:Wend:ptc_close():end

DrewPee

6
General chat / Re: It's been 10 years!
« on: February 13, 2011 »
What can I say . . . I have known Shockwave for a long time and have been a member here for almost five years too! :)
It has been invaluable to me as a very poor coder - the help both he (Shockwave) and of course a load of you on here have given not just to me but everybody else who comes onto this site/forum.
A place I will continue to visit and hopefully contribute when I can. A warm friendly place that unfortunately I don't frequent enough really.

Cheers for the last ten years and here is to the next ten and beyond! ;) Keep up the fantastic work.

Regards

DrewPee aka FalconTLB aka AndyRCM

7
Massive thank you for posting this WidowMaker . . . very impressive stuff indeed!

DrewPee

8
Freebasic / Re: FMod help
« on: December 14, 2010 »
That is exactly what I needed! Thank you so much! I will credit you with the code for this part of the project. ;) Massive thanks mate and Karma+ ;)

Drew

9
Freebasic / Re: FMod help
« on: December 14, 2010 »
Thank you. Sorry I haven't replied sooner - just been to Oldenburg/Germany to visit a Retro Computer Museum! ;)

Cheers

Drew

10
Freebasic / Re: FMod help
« on: December 09, 2010 »
I still must be doing something wrong - anybody help with this . . . ?

Obviously you need to put an .mp3 of your own in there . . . :)

Code: [Select]
#include once "fmod.bi"
#Include once "tinyptc_ext.bi"
   
Dim Shared As Integer Xres,Yres,Value   
Xres=640:Yres=480:Value=0
Dim Shared As Integer MySong
Dim Shared As Uinteger Buffer(XRES*YRES)

#define pp(x,y,argb) buffer(y*XRES+x)=argb

FSOUND_Init(48000, 4, 0)
MySong = FSOUND_Sample_Load(FSOUND_FREE, "StangeByDPC.mp3", 0, 0, 0)
FSOUND_Sample_SetMode(MySong, FSOUND_LOOP_NORMAL)
FSOUND_DSP_GetFFTUnit()

PTC_ALLOWCLOSE(0)
PTC_SETDIALOG(0,"MP3 Player Test",1,0)               
IF (PTC_OPEN("Coded by AndyRCM aka DrewPee",XRES,YRES)=0) THEN
END-1
END IF

FSOUND_PlaySound(FSOUND_FREE, MySong)

WHILE(GETASYNCKEYSTATE(VK_ESCAPE)<> -32767 and PTC_GETLEFTBUTTON=FALSE)
PTC_UPDATE@Buffer(0)
FSOUND_Update
value=FSOUND_DSP_GetSpectrum()
print value;" ";
WEND

11
Freebasic / Re: FMod help
« on: December 08, 2010 »
One small question - does the bass.dll play all formats or just .xm and .mod etc? :(
I need it to play .mp3 or .wav files really?

Cheers
Drew

12
Freebasic / Re: FMod help
« on: December 08, 2010 »
Thanks rbz. I will take a look at that too.
Cheers

Drew

13
Freebasic / Re: FMod help
« on: December 08, 2010 »
Thanks a lot guys! :)
Does anybody have an instance of this working in FreeBasic - can't seem to get it to work?

Drew

14
Freebasic / Re: FMod help
« on: December 08, 2010 »
Thanks matey - I will take a look at that . . . ;)

Drew

15
Freebasic / FMod help
« on: December 07, 2010 »
Guys,
I want to use FMod (or something similar if possible) to play either a .mp3 or .wav file.
I know how to get Fmod to play an .mp3/.wav file no problem at all, but once it is playing I need to be able to generate a spectrum analyser/equaliser on screen in realtime - does anybody know how to do this?
I will be using tinyptc to draw the equaliser too.

Thanks in advance . . .

DrewPee

16
Freebasic / Re: Help reading two keys at once . . .
« on: October 03, 2010 »
@Jim - thanks for that mate - it works fine! :) Just me being dumb (as usual).
Cheers
Andy

17
Freebasic / Re: Help reading two keys at once . . .
« on: September 30, 2010 »
okay mate - thanks Jim! I will try this . . .  :) Very much appreciated! :)

18
Freebasic / Re: Help reading two keys at once . . .
« on: September 30, 2010 »
Thanks Jim.
Can GetASyncKeyState() read more than one key at a time though - I can't seem to get it to do that?
Cheers
Andy

19
Freebasic / Help reading two keys at once . . .
« on: September 28, 2010 »
Hello again all, good to be back on here.
Can anybody help me with this one, is it possible to read two keys at once using tinyptc?
It is not demo related but something that I have wanted to do for years . . . code a platform game.
I can't figure out if it is possible to press two keys together to make my character jump left and right.

Cheers

Andy

20
Freebasic / Re: TinyPTC alpha blending?
« on: June 26, 2010 »
Clyde - Love the way you have done this . . . here is something I have done already - this will be very useful indeed! ;)

Code: [Select]
'
' draw image alpha
' for drewpee.
'
option explicit
option static

Dim Shared as Integer bc,a,qq
bc=256
Dim Shared as Integer x(bc),y(bc),x1(bc),y1(bc),alp(bc)

const as integer SCREEN_WWIDTH=640
const as integer SCREEN_HEIGHT=480
const as integer IMAGE_WWIDTH=24
const as integer IMAGE_HEIGHT=24
#include once "tinyptc_ext++.bi"
dim shared as uinteger screen_buffer( SCREEN_WWIDTH * SCREEN_HEIGHT )
dim shared as uinteger image_buffer (  IMAGE_WWIDTH * IMAGE_HEIGHT  )
declare sub draw_image_alpha( byval pos_x as integer, byval pos_y as integer, byval alpha_val as integer )
declare sub graphics        ( byval title as string, byval wwidth as integer, byval height as integer, byval options as integer=1 )
declare sub init_demo       ()
declare sub run_demo        ()
declare function alpha_blend( byval col1 as uinteger, byval col2 as uinteger, byval alpha as integer ) as uinteger

for a=1 to bc
x(a)=int(rnd(1)*(SCREEN_WWIDTH-image_wwidth))
y(a)=int(rnd(1)*(SCREEN_HEIGHT-image_height))
qq=int(rnd(1)*16)
if qq<=8 then x1(a)=1+int(rnd(1)*2):y1(a)=1+int(rnd(1)*2)
if qq>=9 then x1(a)=-1+int(rnd(1)*-2):y1(a)=-1+int(rnd(1)*-2)
alp(a)=32+int(rnd(1)*128)
next a

init_demo()
run_demo()

sub clear_screen()
    for a as integer=0 to (SCREEN_WWIDTH*SCREEN_HEIGHT)-1
        screen_buffer(a)=0
    next
end sub

sub draw_image_alpha( byval pos_x as integer, byval pos_y as integer, byval alpha_val as integer )
    dim as integer alpha_col=256-alpha_val
    dim as integer x,y
    dim as uinteger col1, col2
    for y=0 to IMAGE_HEIGHT-1
        for x=0 to IMAGE_WWIDTH-1
            if ((x+pos_x)>0) and ((x+pos_x)<SCREEN_WWIDTH-1) and ((y+pos_y)>0) and ((y+pos_y)<SCREEN_HEIGHT-1) then
                col1=screen_buffer( (x+pos_x)+(y+pos_y)*SCREEN_WWIDTH )
                col2= image_buffer( (x)      +(y)      * IMAGE_WWIDTH )
                ' method 1.
                if col2<>0 then screen_buffer((x+pos_x)+(y+pos_y) * SCREEN_WWIDTH )= alpha_blend( col1, col2, alpha_val )
                ' method 2.
                if col2<>0 then
                    screen_buffer( ( x+pos_x )+( y+pos_y ) * SCREEN_WWIDTH )= _ 
                    ((((col1 and &hff00ff  )       *alpha_val+( col2 and &hff00ff          )*alpha_col ) and &hff00ff00 ) shr 8 ) or _
                    ((((col1 and &hff00ff00) shr 8)*alpha_val+((col2 and &hff00ff00) shr 8 )*alpha_col ) and &hff00ff00 )
                end if
            end if
        next
    next
end sub

sub graphics( byval title as string, byval wwidth as integer, byval height as integer, byval options as integer=1 )
    if options=0 then
        ptc_setdialog( 1, "full screen mode?", 0, 0 )
    else
        ptc_setdialog( 0, "", 0, 1 )
    end if
    ptc_allowclose( 1 )
    if ( ptc_open( title, wwidth, height )=0 ) then end -1
end sub

sub init_demo()
    graphics( "dRaw IMaGe aLPhA", 640, 480 )   
    dim as integer x,y
    for y=0 to image_height-1
        for x=0 to image_wwidth-1
            image_buffer( (x)+(y)*image_wwidth )=&hffffd000' mellow yellow with alpha channel set to 255
        next
    next
end sub

sub run_demo()
    while inkey<>chr(27)
        clear_screen()
        for a=1 to bc
        draw_image_alpha(x(a),y(a),alp(a))
        x(a)=x(a)+x1(a)
        y(a)=y(a)+y1(a)
        if x(a)>=(SCREEN_WWIDTH-image_wwidth) then x1(a)=-x1(a)
        if x(a)<=0 then x1(a)=-x1(a)
        if y(a)>=(SCREEN_HEIGHT-image_height) then y1(a)=-y1(a)
        if y(a)<=0 then y1(a)=-y1(a)
        next a
        ptc_update ( @screen_buffer(0) )
    wend
end sub

function alpha_blend( byval col1 as uinteger, byval col2 as uinteger, byval alpha as integer ) as uinteger
    dim as integer inv_alpha
    dim as integer r,g,b
    dim as integer r1,r2
    dim as integer g1,g2
    dim as integer b1,b2
    if alpha > 255  then alpha = 255
    if alpha < 0    then alpha = 0
    inv_alpha = 255 - alpha
    r1=( col1 shr 16) and &hff
    g1=( col1 shr  8) and &hff
    b1=( col1 ) and &hff
    r2=(col2 shr 16) and &hff
    g2=(col2 shr 8 ) and &hff
    b2=(col2 ) and &hff
    r=(( r1 * alpha ) or ( r2 * inv_alpha)) shr 8
    g=(( g1 * alpha ) or ( g2 * inv_alpha)) shr 8
    b=(( b1 * alpha ) or ( b2 * inv_alpha)) shr 8
    return (r shl 16)or(g shl 8)or(b)
end function

Thanks a million for this mate. Very much appreciated :)

Drew

Pages: [1] 2 3 4 5 6 7 8 ... 26