Author Topic: Amiga Rasters Effect  (Read 11309 times)

0 Members and 1 Guest are viewing this topic.

Offline GuillyGuilly

  • ZX 81
  • *
  • Posts: 12
  • Karma: 0
    • View Profile
Amiga Rasters Effect
« on: May 01, 2016 »
Hi guys

Any idea how to code a raster bar ?

I tried using linexy and colors gradiant algo but it's too slow. Any source exemples somewhere ?

Thanks and happy sunday :)

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 276
  • Karma: 25
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Re: Amiga Rasters Effect
« Reply #1 on: May 01, 2016 »
you mean something like this?



i made this in PureBasic v5.30 but also used some FX Libs. If you think this is okay, you can have it.

Attached, a compiled Exe. please allow to warm up the file when starting.
DX9c latest needed

sup
inc
« Last Edit: May 21, 2016 by inc. »
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Offline GuillyGuilly

  • ZX 81
  • *
  • Posts: 12
  • Karma: 0
    • View Profile
Re: Amiga Rasters Effect
« Reply #2 on: May 02, 2016 »
Hi Inc !

Yes, exactly :)

Can you send me FX libs and sources for rasters bars so i could check the code ?

Thanks a lot and very nice cracktro :)

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 276
  • Karma: 25
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Re: Amiga Rasters Effect
« Reply #3 on: May 02, 2016 »
sure, no problem. I'll write a clean code for you that include the rasterbars or do you prefer the whole KeyGen-Template Code?

« Last Edit: May 02, 2016 by inc. »
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Offline GuillyGuilly

  • ZX 81
  • *
  • Posts: 12
  • Karma: 0
    • View Profile
Re: Amiga Rasters Effect
« Reply #4 on: May 02, 2016 »
As you want, do what is the easiest way for you. I can find the good code in the whole source or add just a procedure.

If you have other FX libraries or anything else for PB 5.3 and > (Win / 32 bits), i will be happy too :)

You can contact me using MP if needed :)

Thanks for your reply

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 276
  • Karma: 25
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Re: Amiga Rasters Effect
« Reply #5 on: May 02, 2016 »
sent you a PM
let me know if something fail
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 276
  • Karma: 25
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Re: Amiga Rasters Effect
« Reply #6 on: May 21, 2016 »
Here comes the code:

Code: [Select]
;=======================================================================
;
; first of all:
; install the whole FXlibs -> MP3D Lib
; http://www.flasharts.de/mpz/mp33_beta/MP3D_Installer.exe
; then
; Goto: Compiler -> Compiler Options -> Library Subsystem and input: DX9
;
; then
; Install: pureColor lib by Gnozal
; http://www.rsbasic.de/backupprogramme/PureCOLOR_440.zip
;
;=======================================================================

EP_InitFXLib()          ; don't forget this
UsePNGImageDecoder()    ; handle png decoding
InitSprite()            ; initialize sprites

;declare values for 3D rotating object   
 Structure D3DXVECTOR3
   a.f
   b.f
   c.f
 EndStructure

;-Prepare and Declare Items, Objects
Enumeration
;{
  ;Objects Button Patch
    #Btn_Patch
    #Btn_Patch_Frame_Left
    #Btn_Patch_Frame_Right
    #Btn_Patch_Frame_Top
    #Btn_Patch_Frame_Bottom
  ;Objects Button About
    #Btn_About
    #Btn_About_Frame_Left
    #Btn_About_Frame_Right
    #Btn_About_Frame_Top
    #Btn_About_Frame_Bottom
  ;Objects Button Exit
    #Btn_Exit
    #Btn_Exit_Frame_Left
    #Btn_Exit_Frame_Right
    #Btn_Exit_Frame_Top
    #Btn_Exit_Frame_Bottom
  ;Objects Application
    #Txt_Application
    #Inputfield_Application
    #Inputfield_Application_Frame
  ;Objects Website
    #Txt_Website
    #Inputfield_Website
    #Inputfield_Website_Frame
  ;Objects Cracker
    #Txt_Cracker
    #Inputfield_Cracker
    #Inputfield_Cracker_Frame
  ;Objects Released On
    #Txt_Released_On
    #Inputfield_Released_On
    #Inputfield_Released_On_Frame
  ;Objects Info
    #Txt_Info
    #Inputfield_Info
    #Inputfield_Info_Frame
  ;FRAME AROUND KEYGEN
    #Window_Frame_Left
    #Window_Frame_Right
    #Window_Frame_Top
    #Window_Frame_Bottom
EndEnumeration
;} 
 
; Define Mouse Cursor --> Hand on hover Buttons
Define Btn_Patch, Btn_About, Btn_Exit

; Define programm startup effects
  #AW_HOR_POSITIVE = $1 ;Animates the window from left To right. This flag can be used with roll Or slide animation.
  #AW_HOR_NEGATIVE = $2 ;Animates the window from right To left. This flag can be used with roll Or slide animation.
  #AW_VER_POSITIVE = $4 ;Animates the window from top To bottom. This flag can be used with roll Or slide animation.
  #AW_VER_NEGATIVE = $8 ;Animates the window from bottom To top. This flag can be used with roll Or slide animation.
  #AW_CENTER = $10      ;Makes the window appear To collapse inward If AW_HIDE is used Or expand outward If the AW_HIDE is not used.
  #AW_HIDE = $10000     ;Hides the window. By default, the window is shown.
  #AW_ACTIVATE = $20000 ;Activates the window.
  #AW_SLIDE = $40000    ;Uses slide animation. By default, roll animation is used.
  #AW_BLEND = $80000    ;Uses a fade effect. This flag can be used only If hwnd is a top-level window.

; Grab Tool with Mouse
Procedure WinCallback(hWnd, uMsg, wParam, lParam)
  Protected result = #PB_ProcessPureBasicEvents
  Select uMsg
    Case #WM_LBUTTONDOWN
     
      SendMessage_(hWnd, #WM_NCLBUTTONDOWN, #HTCAPTION, 0)
     
  EndSelect
  ProcedureReturn result
EndProcedure

         
 
;-MAIN WINDOW
  hWnd =  OpenWindow(0, 732, 301, 540, 610, "", #PB_Window_ScreenCentered | #PB_Window_BorderLess | #PB_Window_Invisible) ;#PB_Window_Invisible = hide window while creating
 
 ;-HANDLE 3D SCREEN
   MP_ScreenToHandle(WindowID(0)) ;MAKE window "0" as Demo 3D Effect screen
   
   ;Define some Jumping Rasterbars with Fast Creating
    For t = 2 To 7
      EP_FastRasterBar(t, RGB(Random(255),Random(255),Random(255)), 22, 200,2, 200+(t*20), 2)
    Next t
   
   ;-SET WINDOW ALWAYS ON TOP
      SetWindowPos_(WindowID(0),#HWND_TOPMOST,0,0,0,0,#SWP_NOMOVE|#SWP_NOSIZE)
      SetWindowColor(0,RGB(4, 0, 9))

      ; Cursor SETTING for HAND SYMBOL
        SetClassLong_(Btn_Exit, #GCL_HCURSOR, 0) ; define hand cursor: hover Exit button
      ; LOAD Cursor
        cur1 = LoadCursor_(0, #IDC_HAND)
       
      ; SYSTEM FONTs for Inputfields and Headlines
        Font1 = LoadFont(#PB_Any, "Microsoft Sans Serif", 10, #PB_Font_HighQuality)
        Font2 = LoadFont(#PB_Any, "Microsoft Sans Serif", 10, #PB_Font_HighQuality)
      ;=================================================================================================================
      ;=================================================================================================================
      ; Here start: the creation of all INPUTFIELDS
;{ 
      ;-SHOW TEXT: Application 
        TextGadget(#Txt_Application, 18,290,75,20, "Application:")
        SetGadgetColor(#Txt_Application, #PB_Gadget_BackColor, RGB(4, 0, 9))    ;TEXT Background Color
        SetGadgetColor(#Txt_Application, #PB_Gadget_FrontColor, RGB(78, 71, 71));Font color
        SetGadgetFont(#Txt_Application, FontID(Font1))
       
        ;-SHOW 1px Frame around Application Inputfield
          TextGadget(#Inputfield_Application_Frame, 16, 309, 505, 20, "")               ;Frame size
          SetGadgetColor(#Inputfield_Application_Frame, #PB_Gadget_BackColor, $454543)  ;Frame Color
     
        ;-SHOW Inputfield: Application
          StringGadget(#Inputfield_Application, 17, 310, 503, 18, " Enter Application Name",#PB_String_BorderLess)
          SetGadgetFont(#Inputfield_Application, FontID(Font2)) ;Inputfield description Font
          ;Background color: Inputfield
           SetGadgetColor(#Inputfield_Application, #PB_Gadget_BackColor, RGB(34, 35, 38))
          ;Font color: Inputfield
           SetGadgetColor(#Inputfield_Application, #PB_Gadget_FrontColor, RGB(102, 104, 106))
      ;=================================================================================================================
      ;
      ;-SHOW TEXT: Website 
        TextGadget(#Txt_Website, 18,335,75,20, "Website:")
        SetGadgetColor(#Txt_Website, #PB_Gadget_BackColor, RGB(4, 0, 9))    ;TEXT Background Color
        SetGadgetColor(#Txt_Website, #PB_Gadget_FrontColor, RGB(78, 71, 71));Font color
        SetGadgetFont(#Txt_Website, FontID(Font1))
       
        ;-SHOW 1px Frame around Website Inputfield
          TextGadget(#Inputfield_Website_Frame, 16, 354, 505, 20, "")               ;Frame size
          SetGadgetColor(#Inputfield_Website_Frame, #PB_Gadget_BackColor, $454543)  ;Frame Color
               
        ;-SHOW Inputfield: Website   
          StringGadget(#Inputfield_Website, 17, 355, 503, 18, " Enter Website",#PB_String_BorderLess)
          SetGadgetFont(#Inputfield_Website, FontID(Font2)) ;Inputfield description Font
          ;Background color: Inputfield
           SetGadgetColor(#Inputfield_Website, #PB_Gadget_BackColor, RGB(34, 35, 38))
          ;Font color: Inputfield
           SetGadgetColor(#Inputfield_Website, #PB_Gadget_FrontColor, RGB(102, 104, 106))   
      ;=================================================================================================================
      ;     
      ;-SHOW TEXT: Cracker 
        TextGadget(#Txt_Cracker, 18,380,75,20, "Cracker:")
        SetGadgetColor(#Txt_Cracker, #PB_Gadget_BackColor, RGB(4, 0, 9))    ;TEXT Background Color
        SetGadgetColor(#Txt_Cracker, #PB_Gadget_FrontColor, RGB(78, 71, 71));Font color
        SetGadgetFont(#Txt_Cracker, FontID(Font1))
       
        ;-SHOW 1px Frame around Cracker Inputfield
          TextGadget(#Inputfield_Cracker_Frame, 16, 399, 505, 20, "")               ;Frame size
          SetGadgetColor(#Inputfield_Cracker_Frame, #PB_Gadget_BackColor, $454543)  ;Frame Color
               
        ;-SHOW Inputfield: Cracker
          StringGadget(#Inputfield_Cracker, 17, 400, 503, 18, " Cracked by",#PB_String_BorderLess)
          SetGadgetFont(#Inputfield_Cracker, FontID(Font2)) ;Inputfield description Font
          ;Background color: Inputfield
           SetGadgetColor(#Inputfield_Cracker, #PB_Gadget_BackColor, RGB(34, 35, 38))
          ;Font color: Inputfield
           SetGadgetColor(#Inputfield_Cracker, #PB_Gadget_FrontColor, RGB(102, 104, 106))
      ;=================================================================================================================
      ;
      ;-SHOW TEXT: Released On 
        TextGadget(#Txt_Released_On, 18,425,75,20, "Released On:")
        SetGadgetColor(#Txt_Released_On, #PB_Gadget_BackColor, RGB(4, 0, 9))    ;TEXT Background Color
        SetGadgetColor(#Txt_Released_On, #PB_Gadget_FrontColor, RGB(78, 71, 71));Font color
        SetGadgetFont(#Txt_Released_On, FontID(Font1))
       
        ;-SHOW 1px Frame around Released On Inputfield
          TextGadget(#Inputfield_Released_On_Frame, 16, 443, 505, 20, "")               ;Frame size
          SetGadgetColor(#Inputfield_Released_On_Frame, #PB_Gadget_BackColor, $454543)  ;Frame Color
           
        ;-SHOW Inputfield: Released On
          StringGadget(#Inputfield_Released_On, 17, 444, 503, 18, " Release Date",#PB_String_BorderLess)
          SetGadgetFont(#Inputfield_Released_On, FontID(Font2)) ;Inputfield description Font
          ;Background color: Inputfield
           SetGadgetColor(#Inputfield_Released_On, #PB_Gadget_BackColor, RGB(34, 35, 38))
          ;Font color: Inputfield
           SetGadgetColor(#Inputfield_Released_On, #PB_Gadget_FrontColor, RGB(102, 104, 106))
      ;=================================================================================================================
      ;
      ;-SHOW TEXT: Info
        TextGadget(#Txt_Info, 18,470,75,20, "Info:")
        SetGadgetColor(#Txt_Info, #PB_Gadget_BackColor, RGB(4, 0, 9))    ;TEXT Background Color
        SetGadgetColor(#Txt_Info, #PB_Gadget_FrontColor, RGB(78, 71, 71));Font color
        SetGadgetFont(#Txt_Info, FontID(Font1))
       
        ;-SHOW 1px Frame around Info Inputfield
          TextGadget(#Inputfield_Info_Frame, 16, 487, 505, 54, "")               ;Frame size
          SetGadgetColor(#Inputfield_Info_Frame, #PB_Gadget_BackColor, $454543)  ;Frame Color
               
        ;-SHOW Inputfield: Info
          StringGadget(#Inputfield_Info, 17, 488, 503, 52, " 1. Patch the Software" + #CRLF$ + " 2. Hit the Patch Button to crack the Software" + #CRLF$ + " 3. Enjoy",#ES_MULTILINE|#PB_String_ReadOnly|#PB_String_BorderLess)
          SetGadgetFont(#Inputfield_Info, FontID(Font2)) ;Inputfield description Font
          ;Background color: Inputfield
           SetGadgetColor(#Inputfield_Info, #PB_Gadget_BackColor, RGB(34, 35, 38))
          ;Font color: Inputfield
           SetGadgetColor(#Inputfield_Info, #PB_Gadget_FrontColor, RGB(102, 104, 106))
;}
      ;=================================================================================================================
      ;=================================================================================================================
      ;-CREATE BUTTONS
;{     
        ;-SHOW 1px Frame around BTN PATCH
           ;Left
            TextGadget(#Btn_Patch_Frame_Left, 16, 559, 1, 32, "")                 ;Frame size
            SetGadgetColor(#Btn_Patch_Frame_Left, #PB_Gadget_BackColor, $454543)  ;Frame Color
           ;Right
            TextGadget(#Btn_Patch_Frame_Right, 117, 559, 1, 32, "")               ;Frame size
            SetGadgetColor(#Btn_Patch_Frame_Right, #PB_Gadget_BackColor, $454543) ;Frame Color
           ;Top
            TextGadget(#Btn_Patch_Frame_Top, 16, 559, 102, 1, "")                 ;Frame size
            SetGadgetColor(#Btn_Patch_Frame_Top, #PB_Gadget_BackColor, $454543)   ;Frame Color
           ;Top
            TextGadget(#Btn_Patch_Frame_Bottom, 16, 590, 102, 1, "")              ;Frame size
            SetGadgetColor(#Btn_Patch_Frame_Bottom, #PB_Gadget_BackColor, $454543);Frame Color
           
          ;BTN PATCH
            Btn_Patch = ButtonGadget(#Btn_Patch, 17, 560, 100, 30, "Patch", #BS_FLAT)
            ;Font and Back color: BTN PATCH
              PureCOLOR_SetButtonColor(#Btn_Patch, RGB(102, 104, 106), RGB(0, 0, 0), RGB(102, 104, 106), RGB(28, 28, 28))
      ;=================================================================================================================       
      ;
        ;-SHOW 1px Frame around BTN ABOUT
           ;Left
            TextGadget(#Btn_About_Frame_Left, 219, 559, 1, 32, "")                ;Frame size
            SetGadgetColor(#Btn_About_Frame_Left, #PB_Gadget_BackColor, $454543)  ;Frame Color
           ;Right
            TextGadget(#Btn_About_Frame_Right, 320, 559, 1, 32, "")               ;Frame size
            SetGadgetColor(#Btn_About_Frame_Right, #PB_Gadget_BackColor, $454543) ;Frame Color
           ;Top
            TextGadget(#Btn_About_Frame_Top, 219, 559, 102, 1, "")                ;Frame size
            SetGadgetColor(#Btn_About_Frame_Top, #PB_Gadget_BackColor, $454543)   ;Frame Color
           ;Top
            TextGadget(#Btn_About_Frame_Bottom, 219, 590, 102, 1, "")             ;Frame size
            SetGadgetColor(#Btn_About_Frame_Bottom, #PB_Gadget_BackColor, $454543);Frame Color
             
          ;BTN ABOUT
            Btn_About = ButtonGadget(#Btn_About, 220, 560, 100, 30, "About", #BS_FLAT)
            ;Font and Back color: BTN ABOUT
              PureCOLOR_SetButtonColor(#Btn_About, RGB(102, 104, 106), RGB(0, 0, 0), RGB(102, 104, 106), RGB(28, 28, 28))
      ;=================================================================================================================
      ;       
        ;-SHOW 1px Frame around BTN EXIT
           ;Left
            TextGadget(#Btn_Exit_Frame_Left, 419, 559, 1, 32, "")                ;Frame size
            SetGadgetColor(#Btn_Exit_Frame_Left, #PB_Gadget_BackColor, $454543)  ;Frame Color 
           ;Right
            TextGadget(#Btn_Exit_Frame_Right, 520, 559, 1, 32, "")               ;Frame size
            SetGadgetColor(#Btn_Exit_Frame_Right, #PB_Gadget_BackColor, $454543) ;Frame Color
           ;Top
            TextGadget(#Btn_Exit_Frame_Top, 419, 559, 102, 1, "")                ;Frame size
            SetGadgetColor(#Btn_Exit_Frame_Top, #PB_Gadget_BackColor, $454543)   ;Frame Color
           ;Top
            TextGadget(#Btn_Exit_Frame_Bottom, 419, 590, 102, 1, "")             ;Frame size
            SetGadgetColor(#Btn_Exit_Frame_Bottom, #PB_Gadget_BackColor, $454543);Frame Color

          ;BTN EXiT
            Btn_Exit = ButtonGadget(#Btn_Exit, 420, 560, 100, 30, "Exit", #BS_FLAT)
            ;Font and Back color: BTN EXiT
             PureCOLOR_SetButtonColor(#Btn_Exit, RGB(102, 104, 106), RGB(0, 0, 0), RGB(102, 104, 106), RGB(28, 28, 28))
;}
      ;=================================================================================================================
      ;=================================================================================================================
      ;
        ; GIVE THE KEYGEN A 1PX Frame
           ;Left
            TextGadget(#Window_Frame_Left, 0, 0, 1, 610, "")                              ;Frame size
            SetGadgetColor(#Window_Frame_Left, #PB_Gadget_BackColor, RGB(102, 102, 102))  ;Frame Color
           ;Right
            TextGadget(#Window_Frame_Right, 539, 0, 1, 610, "")                           ;Frame size
            SetGadgetColor(#Window_Frame_Right, #PB_Gadget_BackColor, RGB(102, 102, 102)) ;Frame Color
           ;Top --> Not used in this KexGen
              ;TextGadget(#Window_Frame_Right, 0, 1, 540, 1, "")                            ;Frame size
              ;SetGadgetColor(#Window_Frame_Right, #PB_Gadget_BackColor, RGB(102, 102, 102));Frame Color
           ;Bottom
            TextGadget(#Window_Frame_Bottom, 0, 609, 540, 1, "")                            ;Frame size
            SetGadgetColor(#Window_Frame_Bottom, #PB_Gadget_BackColor, RGB(102, 102, 102));Frame Color
      ;=================================================================================================================
           
  ;-DEFINE SINUS FONT
    EP_CatchFont16(Sprite_4,?Font, ?FontEnd)
    EP_SetScrollText(Sprite_4, "            Group xyz proudly presents another quality release. Coded by: inc       3d object and Gfx: inc      Sound: ?       Greets Fly Out To:  CORE, ARTEAM,AT4RE,SND,FFF,CIN1TEAM,REiS,BLACK STORM,ZWT,AORE,LNDL,TSRH,RePT,iNFECTION,ECLiPSE,WOODMANN And All Other Who Keep The Scene Alive...            reload               ")
    EP_Create16Scroll(0, 0, 0,130, 0,560)
    EP_SetSinScroll16(0, 5, 0 , 30, 10) ;DEFINE BEHAVIOR BY SINUS
   
  ;-LOAD AND PLAY *.v2m Sound
    MP_CatchV2M(?Song)  ;LOAD SONG
    MP_PlayV2M(0)       ;0 START SOUND FROM THE BEGINNING
    IsPlaying=1         ;CHECK IF SONG IS PLAYING
    left.f              ;Set effect for Left Music Channel on 3D Object
    right.f             ;Set effect for Right Music Channel on 3D Object
   
  ;-LOGO, FRAME-SHADOW GFX
    Frame_Shadow = MP_CatchSprite(?FrameShadow, ?EndFrameShadow - ?FrameShadow) ;LOAD FRAME & SHADOW GFX FROM MEM
    Logo_Gfx = MP_CatchSprite(?Logo, ?LogoEnd) ;GRAB LOGO FROM MEM
   
  ;-3D OBJECT
    camera=MP_CreateCamera()            ; CREATE CAM
    x = 0 : y = 0 : xw = 540 : yw = 267 ; DEFINE SIZE OF THE DEMO EFFECT SCREEN HERE
    MP_Viewport(x,y,xw,yw)
    light=MP_CreateLight(1)             ; MAKE LIGHT
   
     Mesh1=MP_CatchMesh(?ObjectStart, ?ObjectEnd)
       
     MP_PositionEntity (Mesh1,0,0,200.0); POSITION 3D OBJECT, last number makes the size and Z Index of a 3D OBJECT
     MP_Wireframe(1)                    ; 3D OBJECT AS WIREFRAME. IF THIS LINE IS DISABLED: 3D OBJECT HAVE A TEXTURE
     
     If CreateImage(0, 15, 5)            ; Create coloured Wireframe
       MP_CreateImageColored(0,0,RGB($FF,$00,$FF),RGB($FF,$FF,$FF),RGB($00,$FF,$FF),RGB($FF,$00,$FF)) ; going to pink n purple
       MP_EntitySetTexture (mesh1, MP_ImageToTexture(0))
       FreeImage(0)
     EndIf
     
     a.f=0
     b.f=45
     c.f=135
     
  ;-SHOW a NORMAL SYSTEM Font for Text
    ;FONT IN THE RIGHT CORNER OF Demo 3D Effect screen
     font2 = MP_LoadFont ("Microsoft Sans Serif",12,0,0);"Fontname",SIZE,bold,italic
   
  ;in this KeyGen we use a 1px Dot Starfield
    ;-STARFIELD, prepare and settings
      EP_Init2DStars(50,7,0.3,1,1,539,263) ; 1st NUMBER=HOW MANY STARS,2nd NUMBER=LAYERS,0.3 = SCROLLSPEED,4rth NUMBER=where to start stars from the left side of the screen,5th NUMBER=where to start from top,6th x angle,7th y angle
      EP_2DStarsColor(2, RGB( 23, 50, 100)) ; STARS COLOR
   
  ; activate Procedure for Mouse option, so we can grab our Tool with the left Mouse Button
    SetWindowCallback(@WinCallback())
   
  ; use tool start up effect
    AnimateWindow_(WindowID(0),600,#AW_BLEND)
   
  ; Window background drawing is finished here, now show us all on the desktop 
    HideWindow(0,#False)


;=================================================================================================================
;
;-MAIN LOOP STARTS HERE
;
;=================================================================================================================     
Repeat
  Event = WindowEvent()
  Gosub changecursor ; goes to SUB and changes normal Cursor to HAND CURSOR over EXIT BTN or what ever
  MP_VSync(1) 

 
  ;-DRAW ROTATING STARFIELD   
    EP_2DStarsDraw()         ; DRAW simple STARFIELD
    EP_2DStarsDegree(b.f)    ; DEGREE OF STARS and ROTATE ALL
    b.f - 0.5
   
  ;-SCROLL TEXT NOW
    EP_Move16Scroll(0)
   
  ;- LOOP FUNCTION SOUND 
    If MP_IsPlayingV2M()
      IsPlaying=1 ;CHECK IF SONG IS PLAYING
      Else
       EndOfTrackReached=1 ;IF SONG REACHED ITS END
       ;RESTART PLAYBACK
       ; Delay(1000)   ;WAIT 1000 ms. AND START OVER FROM THE BEGINNING
        MP_PlayV2M(0) ;0 STARTs SONG At THE BEGINNING
    EndIf

  MP_DrawSprite(Frame_Shadow, 0, 0) ; SHOW Frame & Shadow
  MP_SpriteSetZ(Frame_Shadow, 0)    ; 0 = Z INDEX
  MP_DrawSprite(Logo_Gfx, 19, 20)   ; SHOW LOGO ON SCREEN
  MP_SpriteSetZ(Logo_Gfx, 9)        ; 9 IS Z-INDEX FOR LOGO
 
  ;-DRAW NORMAL TEXT ON SCREEN
    MP_DrawText (420,250,"Code by inc in 2016",font2,RGBA(76, 76, 76, 196),0,0) ; 0,0 ---> 2nd VALUE CAN SPIN TEXT
    MP_TextSetZ (0);SET TEXT ON Z INDEX FRONT
 
  ;-3D OBJECT
    MP_GetMainVUV2M(@left, @right)       ;stick 3D OBJECT to Music
    MP_ScaleEntity (mesh1,1,0.5+left*5,1);wobble 3D OBJECT to music
    a + 1.1:b-1.2:c+1.1 ; rotating speed
    MP_RotateEntity(mesh1,a, b, c)
   
  ;-DISPLAY THE MOVING RASTER BARS
    For t = 2 To 7 : EP_DisplayRasterBar(t,160+(t*10)) : Next t   
 
  ;-CREATE 3D WORLD and DO IT
    MP_RenderBegin()
      MP_RenderMesh()
      MP_Render2D ()
      MP_RenderSprite ()
      MP_RenderText ()
      MP_RenderEnd()
    MP_Flip ()

;////////////////////////////////////////
;-FUNCTIONS
  If Event = #PB_Event_Gadget
    Select EventGadget()
    ;AUTO highlight Inputfield on Mouse focus
      Case #Inputfield_Application, #Inputfield_Website, #Inputfield_Cracker, #Inputfield_Released_On
        If EventType() = #PB_EventType_Focus
          SendMessage_(GadgetID(EventGadget()), #EM_SETSEL, Len(GetGadgetText(EventGadget())), 0)
        EndIf
         
      ;///////////////////////////////////////////////////////////////
      ; APP- INPUT FIELD 
          Case #Inputfield_Application  ;do something when mouse focus
          ;NO CODE YET here
      ;///////////////////////////////////////////////////////////////
      ; WEBSITE- INPUT FIELD
          Case #Inputfield_Website      ;do something when mouse focus
          ;NO CODE YET here
      ;///////////////////////////////////////////////////////////////
      ; CRACKER- INPUT FIELD 
         Case #Inputfield_Cracker       ;do something when mouse focus
          ;NO CODE YET here
      ;///////////////////////////////////////////////////////////////
      ; Released On- INPUT FIELD 
          Case #Inputfield_Released_On  ;do something when mouse focus
          ;NO CODE YET here
      ;///////////////////////////////////////////////////////////////
      ; BUTTON: Patch 
          Case #Btn_Patch               ;do something when mouse focus
          ;NO CODE YET here
      ;///////////////////////////////////////////////////////////////
      ; BUTTON: About 
          Case #Btn_About               ;do something when mouse focus
          ;NO CODE YET here
      ;///////////////////////////////////////////////////////////////
           
      ;-EXIT BUTTON FUNCTION
          Case #Btn_Exit
            MP_StopV2M(0)       ;STOP MUSIC
            MP_FreeV2M()        ;FREE PLAYER
            EP_2DStarsClear()   ;CLEAR STARS OFF
            DestroyCursor_(cur1);REBUILD NORMAL CURSOR if KEYGEN is terminated
            End
    EndSelect
  EndIf
 
;-SUB ROUTINE FOR CURSOR CHANGE FROM ARROW TO HAND STARTS HERE
  Until Event = #PB_Event_CloseWindow
    DestroyCursor_(cur1) ;REBUILD NORMAL CURSOR if KEYGEN is terminated
    End     
    ;SUB ROUTINE TO CHANGE ARROW CURSOR TO HAND CURSOR
     changecursor:
     GetCursorPos_(cursorpos.POINT)
     MapWindowPoints_(0, hWnd, cursorpos, 1)
     Select ChildWindowFromPoint_(hWnd, cursorpos\x | cursorpos\y << 32)
       Case Btn_Patch: SetCursor_(cur1) ; Show hand Cursor OVER Btn_Patch
       Case Btn_About: SetCursor_(cur1) ; Show hand Cursor OVER Btn_About
       Case Btn_Exit : SetCursor_(cur1) ; Show hand Cursor OVER Btn_Exit     
     EndSelect
Return
« Last Edit: May 21, 2016 by inc. »
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 276
  • Karma: 25
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Re: Amiga Rasters Effect
« Reply #7 on: May 21, 2016 »
...
code was too long
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Offline GuillyGuilly

  • ZX 81
  • *
  • Posts: 12
  • Karma: 0
    • View Profile
Re: Amiga Rasters Effect
« Reply #8 on: May 21, 2016 »
Thanks Inc but the main problem is that i can't include this code into my own one without to destroy everything :(

Even the screen call is not the same :( i'm lost

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 276
  • Karma: 25
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Re: Amiga Rasters Effect
« Reply #9 on: May 21, 2016 »
then, rar your files and let's see em.
i think i can help.
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Offline padman

  • Senior Member
  • Pentium
  • ********
  • Posts: 990
  • Karma: 260
    • View Profile
Re: Amiga Rasters Effect
« Reply #10 on: May 21, 2016 »
Maybe this is an easier start to play around with... No external/extra stuff needed.   ;)


Code: [Select]

InitSprite()
InitKeyboard()
OpenScreen(800, 600, 32, "")
 
;Create a red rasterbar. You might as well just catch/load a sprite...

 StartDrawing(ScreenOutput())
 For y = 0 To 64
   Box( 0, y, 800, 128 - y*2, RGB(y*4, 0, 0) )
 Next y
 StopDrawing()

;Grab what we just drew from screen into a sprite

GrabSprite(1, 0, 0, 800, 128)

Repeat

ClearScreen(0)

; Display the bars 

DisplaySprite(1, 0, 236 + 80*Sin(i.f))
DisplaySprite(1, 0, 236 + 80*Sin(i + 1.57))
DisplaySprite(1, 0, 236 + 80*Sin(i + 3.14))


; The higher the value below, the faster the bars will move

i+0.075

ExamineKeyboard() 
FlipBuffers()

Until KeyboardPushed(#PB_Key_Escape)

End
Challenge Trophies Won:

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 276
  • Karma: 25
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Re: Amiga Rasters Effect
« Reply #11 on: May 21, 2016 »
PadMan  :clap:
easy going.
i hate fullscreen demos :D

@ GuillyGuilly, maybe you like window mode
Code: [Select]
InitSprite()
InitKeyboard()

;Define Exit Button
  CreateImage(1,22,22)
    StartDrawing(ImageOutput(1))
      FillArea(0,0,RGB(94, 74, 154),RGB(94, 74, 154))
      Line(3,18,16,-16,RGB(196, 196, 196))
      Line(3,3,17,17,RGB(196, 196, 196))
    StopDrawing()

hwnd = OpenWindow(0, 0, 0, 640, 502, "", #PB_Window_BorderLess|#PB_Window_ScreenCentered|#PB_Window_Invisible)
       SetWindowColor(0, RGB(95, 74, 154))
       
       If OpenWindowedScreen(WindowID(0), 0, 22, 640, 502, #True, 0, 0, #PB_Screen_WaitSynchronization)
 
;////////////////////////////////////
;- EXIT BUTTON
;////////////////////////////////////     
      ImageGadget(3,WindowWidth(0)-22,0,22,22,ImageID(1))
;////////////////////////////////////
;- SCREEN TITLE
;////////////////////////////////////     
  TextGadget(5,0, 0, 155, 22, "  Raster Bar windowed Example",#SS_CENTERIMAGE)
  SetGadgetColor(5 , #PB_Gadget_BackColor, RGB(95, 74, 154)) ;TEXT Background Color
  SetGadgetColor(5 , #PB_Gadget_FrontColor, RGB(196, 196, 196));TEXT Color
;Create a red rasterbar. You might as well just catch/load a sprite...

 StartDrawing(ScreenOutput())
 For y = 0 To 32
   Box( 0, y, 640, 64 - y*2, RGB(y*6, 0, 0) )
 Next y
 StopDrawing()

;Grab what we just drew from screen into a sprite
  InitSprite()
  GrabSprite(1, 0, 0, 640, 64)
 
HideWindow(0,#False)
 
  Repeat
  event = WindowEvent()
 
;////////////////////////////////////
;-EXIT BUTTON/ CLOSE TOOL
;////////////////////////////////////
      If Event=#PB_Event_Gadget
        If EventGadget()= 3
          End
        EndIf
      EndIf
;//////////////////////////////////////
;-LETs MOVE OUR WINDOW WITH MOUSE DOWN
;//////////////////////////////////////
  Select event
     Case #WM_LBUTTONDOWN
       If WindowMouseX(0) >= 0 And WindowMouseX(0) <= 628 And WindowMouseY(0) >= 0 And WindowMouseY(0) <= 22; create mouse era
          SendMessage_(hwnd, #WM_NCLBUTTONDOWN, #HTCAPTION, 0)
       EndIf
  EndSelect
     
ClearScreen(0)

; Display the bars
DisplaySprite(1, 0, 236 + 80*Sin(i.f))
DisplaySprite(1, 0, 236 + 80*Sin(i + 1.57))
DisplaySprite(1, 0, 236 + 80*Sin(i + 3.14))


; The higher the value below, the faster the bars will move

i+0.075

ExamineKeyboard() 
FlipBuffers()

Until KeyboardPushed(#PB_Key_Escape)
End
EndIf

« Last Edit: May 22, 2016 by inc. »
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Offline Knurz

  • Atari ST
  • ***
  • Posts: 121
  • Karma: 25
    • View Profile
    • GitHub Repository
Re: Amiga Rasters Effect
« Reply #12 on: May 23, 2016 »
Hi!

This is my "version" of Rasterbars, done in GLSL. I wouldn't use precious GL-Calls to draw lines =).

Code: [Select]
#define PI 3.1415926
#define MAXRAST 7.
#define RASTERS 12
#define ANG2RAD PI/180.
#define ORIGIN_Y 500

uniform float time;
uniform vec2 resolution;
uniform sampler2D myTex;

void main( void ) {
vec3 baseCol = vec3(0.7, 0.3, 1.0), outCol = vec3 (0., 0., 0.), txtCol;
vec2 p = gl_FragCoord.xy / resolution.xy;
float maxRast, RASTLINES = 8., YBASE = .7, yd = -1., rd = 8., rdd = 64., sa;
int c;

RASTLINES = (RASTLINES / float(ORIGIN_Y) ) * resolution.y;
maxRast = 1./resolution.y * RASTLINES;
txtCol = texture2D(myTex, p).rgb;

for (c=RASTERS; c > 0; c--) {
float jd = sin( (2.2*time)+(ANG2RAD*rd*float(c)))*0.14; // base modifier
yd = 1. - (1./maxRast* abs( jd+YBASE - p.y)); // distance from current pos to middle of bar
if (yd > 0.)
break; // hit one ? => leave
}

yd = clamp(yd, 0.0, 1.0);

if (yd > .0) {
baseCol.r = 0.5 + sin( (time*0.3) ) * .5;
baseCol.b = abs(sin(PI*baseCol.r));
baseCol.g = 1. - sin (baseCol.r +baseCol.b * .5 * PI);
sa = 1./float(RASTERS+1) * float(c);
outCol = baseCol.rgb * (yd * sa);
}
gl_FragColor = vec4( outCol , 1. );
}

It's rather primitive and uses the not very efficent for and if statements, but it works better than drawing it with GL_LINES or something similar.

Have fun coding mate.
Remember what the dormouse said: Feed your head

Offline inc.

  • Contact me @ skype: a5recordings
  • Amiga 1200
  • ****
  • Posts: 276
  • Karma: 25
  • I SPEAK ENGLISH & GERMAN as good as i can :D
    • View Profile
Re: Amiga Rasters Effect
« Reply #13 on: May 23, 2016 »
well done  :clap:

this is pure GLSL and i guess, he have no PB code to add your shader.
maybe i am wrong :)
so let's see, what i compiled into a exe file, to view the Code ...
« Last Edit: May 23, 2016 by inc. »
currently coding in PureBasic: GLSL Shader Maker & Editor Tool for further Demo coding usage

Offline Knurz

  • Atari ST
  • ***
  • Posts: 121
  • Karma: 25
    • View Profile
    • GitHub Repository
Re: Amiga Rasters Effect
« Reply #14 on: May 23, 2016 »
I'm sure one of you PB-guys can provide him a simple code for a fullscreen GLSL-"Loader"..

Let the GPU do the work  ;D


« Last Edit: May 23, 2016 by Knurz »
Remember what the dormouse said: Feed your head

Offline GuillyGuilly

  • ZX 81
  • *
  • Posts: 12
  • Karma: 0
    • View Profile
Re: Amiga Rasters Effect
« Reply #15 on: May 24, 2016 »
Thanks all :)

Inc is right, i don't have hardware and software to use shaders , maybe next year :D

Thanks for all your HELP, you rulz !!!

Love !