I have modified my version. Now the screen is opened to the current screen resolution.
Code: Select all
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Project name : Great Matrix effect
; File : Great Matrix effect.pb
; File Version : 2.0.1
; Programmation : OK
; Programmed by : Fou-lu
; Updated by : Guimauve
; Date : 06-08-2005
; Last Update : 08-08-2006
; Coded for PureBasic V4.00
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; AUTOMATICALLY GENERATED CODE, DO NOT MODIFY
; UNLESS YOU REALLY, REALLY, REALLY MEAN IT !!
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Structure declaration >>>>>
Structure Matrix
PositionX.w
PositionY.w
Life.w
Speed.b
Number.b
EndStructure
; <<<<<<<<<<<<<<<<<<<<
; <<<<< Mutators >>>>>
Macro SetMatrixPositionX(ObjectA, P_PositionX)
ObjectA\PositionX = P_PositionX
EndMacro
Macro SetMatrixPositionY(ObjectA, P_PositionY)
ObjectA\PositionY = P_PositionY
EndMacro
Macro SetMatrixLife(ObjectA, P_Life)
ObjectA\Life = P_Life
EndMacro
Macro SetMatrixSpeed(ObjectA, P_Speed)
ObjectA\Speed = P_Speed
EndMacro
Macro SetMatrixNumber(ObjectA, P_Number)
ObjectA\Number = P_Number
EndMacro
; <<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Observators >>>>>
Macro GetMatrixPositionX(ObjectA)
ObjectA\PositionX
EndMacro
Macro GetMatrixPositionY(ObjectA)
ObjectA\PositionY
EndMacro
Macro GetMatrixLife(ObjectA)
ObjectA\Life
EndMacro
Macro GetMatrixSpeed(ObjectA)
ObjectA\Speed
EndMacro
Macro GetMatrixNumber(ObjectA)
ObjectA\Number
EndMacro
; <<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Simple Update >>>>>
Macro UpdateMatrix(ObjectA, P_PositionX, P_PositionY, P_Life, P_Speed, P_Number)
SetMatrixPositionX(ObjectA, P_PositionX)
SetMatrixPositionY(ObjectA, P_PositionY)
SetMatrixLife(ObjectA, P_Life)
SetMatrixSpeed(ObjectA, P_Speed)
SetMatrixNumber(ObjectA, P_Number)
EndMacro
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Code generated in : 31 ms <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Init DirectX <<<<<
If InitSprite() = 0 Or InitMouse() = 0 Or InitKeyboard() = 0
MessageRequester("Error", "Sorry, it won't work in your pc!")
End
EndIf
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Screen Resolution <<<<<
ScreenW = GetSystemMetrics_(#SM_CXSCREEN)
ScreenH = GetSystemMetrics_(#SM_CYSCREEN)
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Opening the Screen <<<<<
If OpenScreen(ScreenW, ScreenH, 32, "Great Matrix effect") = 0
If OpenScreen(ScreenW, ScreenH, 24, "Great Matrix effect") = 0
If OpenScreen(ScreenW, ScreenH, 16, "Great Matrix effect") = 0
MessageRequester("Error", "Sorry, it's impossible to Open the Screen !")
End
EndIf
EndIf
EndIf
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Creating needed Sprites <<<<<
For n = 0 To 15
For m = 0 To 9
If CreateSprite(m + n * 10, 7, 13)
StartDrawing(SpriteOutput(m + n * 10));>
Green = (n * 20)
If Green > 255
redblue = 4 * (Green - 255)
Green = 255
EndIf
DrawingMode(1)
DrawText(0, 0, Str(m), RGB(redblue,Green,redblue))
StopDrawing();<
EndIf
Next m
Next n
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< AddDigit Procedure <<<<<
Procedure AddDigit(x,y, ScreenH, DigitList.Matrix(), FillArray.l(2))
If y > ScreenH / 10
y - 30
EndIf
If FillArray(x, y) = 0
AddElement(DigitList())
UpdateMatrix(DigitList(), x, y, 255, Random(15)+1, Random(9))
FillArray(x, y) = 1
EndIf
EndProcedure
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< The Linkedlist and the array <<<<<
NewList DigitList.Matrix()
Dim FillArray(ScreenW/10, ScreenH/10)
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<< Running Great Matrix effect <<<<<
Repeat
dx = Random(ScreenW/10)
dy = Random(ScreenH/10)
If IsScreenActive()
ClearScreen(0)
ForEach DigitList()
If GetMatrixLife(DigitList()) = 255 - GetMatrixSpeed(DigitList()) And Random(GetMatrixSpeed(DigitList()) * 2) > 0
oldspeed = GetMatrixSpeed(DigitList())
index = ListIndex(DigitList())
AddDigit(GetMatrixPositionX(DigitList()), GetMatrixPositionY(DigitList()) + 1 , ScreenH, DigitList(), FillArray())
SetMatrixSpeed(DigitList(), oldspeed)
SelectElement(DigitList(), index)
EndIf
DisplaySprite((GetMatrixLife(DigitList()) >> 4) * 10 + GetMatrixNumber(DigitList()), GetMatrixPositionX(DigitList()) * 10, GetMatrixPositionY(DigitList()) * 16)
SetMatrixLife(DigitList(), GetMatrixLife(DigitList()) - GetMatrixSpeed(DigitList()))
If Random(GetMatrixLife(DigitList()) >> 2) = 0
SetMatrixNumber(DigitList(), Random(9))
EndIf
If GetMatrixLife(DigitList()) <= 0
FillArray(GetMatrixPositionX(DigitList()), GetMatrixPositionY(DigitList())) = 0
DeleteElement(DigitList())
EndIf
Next
AddDigit(dx, dy, ScreenH, DigitList(), FillArray())
Else
Delay(10)
EndIf
FlipBuffers()
ExamineMouse()
ExamineKeyboard()
Until MouseDeltaX() Or MouseDeltaY() Or MouseWheel() Or KeyboardPushed(#PB_Key_All)
CloseScreen()
; <<<<<<<<<<<<<<<<<<<<<<<
; <<<<< END OF FILE <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<