wer kennt von Euch das Projekt "Blinkenlights"? Nun Infos dazu gibt es hier:
http://www.blinkenarea.org/
http://www.blinkenlights.de/ (ist nicht mehr aktuell!)
Nun denn ich habe einen kleinen Vollbildplayer (eigentlich Simulator) für
Movies im BML-Format (Blinkenlights Markup Language) geschrieben, das gnaze ist im XML-Format gehalten. Es gibt noch andere Formate zum Thema Blinkenlights. Wobei das BML-Format das komplizierteste ist. Es unterstzützt sogenannte Graustufen-Filme. Ich habe das Format teilweise in mein Programm implementiert. Es fehlen noch die Headerinformationen und ist sicherlich nicht sauber geparsed. Aber das ist erst mal egal, wenn ich Lust habe verändere ich das später noch. Es werden nur die BML Filme unterstützt und nur in der Aufrlösung 26x20. Die Filme die mit meinem Programm funktionieren können hier runtergeladen werden:
https://arcademini.schuermans.info/game ... 20.tar.bz2
Unter Windows lässt es sich mit WinRAR entpacken.
Dann einfach die Filme in ein Verzeichnis "bml-movies" das auf Source-Ebene oder der Exe-Ebene angelegt wird kopieren. Den Source im Editior kompilieren (F5) dann zurücklegen und ansehen, ich weiß nicht wie lange das Teil läuft, es sind 450 Filme.
Hier ist die Bedienung:
ESC --> Player beenden
1 - 4 --> Farben wechseln
P --> BoxPixel oder CirclePixel
Space --> nächster Film
Hier ist der Source:
Code: Alles auswählen
; #################################################################
; # P B - B L I N K E N P L A Y E R #
; # VERSION 1.0.0 #
; # (C) 2005 by xensonsoft #
; # #
; # Author: Michael Eberhardt ( _ZOMTEX_ ) #
; # #
; # FEEL FREE TO USE THE SOURCE ;-) #
; # #
; # #
; # #
; #################################################################
; File: PBBlinkenPlayer
; $Author:$
; $Date:$
; $Revision:$
; #################################################################
#SCREEN_WIDTH = 800
#SCREEN_HEIGHT = 600
Enumeration
#DIRECTORY_01
#FILE_01
#FONT_01
EndEnumeration
Declare GetRowData(*CurData.l)
Declare GetFrameDur()
Declare Hex2Dec(x$)
Declare ShowFPS()
Declare DrawTextEx(x.l, y.l, Text.s, r.l, g.l, b.l)
Global CurFPS.l
Global CurSec.l
Global FPS$
Global PixelMode.l
Global ColorMode.l
CurDirectory$ = "bml-movies\"
SizeX = 26
SizeY = 20
BoxPosX = 10
BoxPosY = 0
BoxPixelSizeX = 28
BoxPixelSizeY = 28
BoxSpreadX = 2
BoxSpreadY = 2
CirclePosX = 14
CirclePosY = 14
CirclePixelSizeX = 14
CirclePixelSizeY = 14
CircleSpreadX = 16
CircleSpreadY = 16
LightValue = 16
If InitSprite()
If InitKeyboard()
If OpenScreen(#SCREEN_WIDTH, #SCREEN_HEIGHT, 32, "PBBlinkenPlayer")
If ExamineDirectory(#DIRECTORY_01, CurDirectory$, "*.bml")
While NextDirectoryEntry() And KeyEsc = 0
CurBlinkenMovie$ = DirectoryEntryName()
If ReadFile(#FILE_01, CurDirectory$ + CurBlinkenMovie$)
CurData$ = Space(255)
While Eof(#FILE_01) = 0 And KeyEsc = 0
FrameDur.l = GetFrameDur()
If FrameDur > 0
If StartDrawing(ScreenOutput())
For y = 0 To SizeY - 1
If GetRowData(@CurData$)
For x = 0 To SizeX - 1
CurPixelValue = Hex2Dec(Mid(CurData$, x + 1, 1))
Select(PixelMode)
Case 0
Select(ColorMode)
Case 0
Box(BoxPosX + (x * BoxSpreadX) + (x * BoxPixelSizeX), BoxPosY + (y * BoxSpreadY) + (y * BoxPixelSizeY), BoxPixelSizeX, BoxPixelSizeY, RGB((CurPixelValue * LightValue) + 10, 0, 0))
Case 1
Box(BoxPosX + (x * BoxSpreadX) + (x * BoxPixelSizeX), BoxPosY + (y * BoxSpreadY) + (y * BoxPixelSizeY), BoxPixelSizeX, BoxPixelSizeY, RGB(0, (CurPixelValue * LightValue) + 10, 0))
Case 2
Box(BoxPosX + (x * BoxSpreadX) + (x * BoxPixelSizeX), BoxPosY + (y * BoxSpreadY) + (y * BoxPixelSizeY), BoxPixelSizeX, BoxPixelSizeY, RGB(0, 0, (CurPixelValue * LightValue) + 10))
Case 3
Box(BoxPosX + (x * BoxSpreadX) + (x * BoxPixelSizeX), BoxPosY + (y * BoxSpreadY) + (y * BoxPixelSizeY), BoxPixelSizeX, BoxPixelSizeY, RGB((CurPixelValue * LightValue) + 10, (CurPixelValue * LightValue) + 10, 0))
EndSelect
Case 1
Select(ColorMode)
Case 0
Circle(CirclePosX + (x * CircleSpreadX) + (x * CirclePixelSizeX), CirclePosY + (y * CircleSpreadY) + (y * CirclePixelSizeY), CirclePixelSizeX, RGB((CurPixelValue * LightValue) + 10, 0, 0))
Case 1
Circle(CirclePosX + (x * CircleSpreadX) + (x * CirclePixelSizeX), CirclePosY + (y * CircleSpreadY) + (y * CirclePixelSizeY), CirclePixelSizeX, RGB(0, (CurPixelValue * LightValue) + 10, 0))
Case 2
Circle(CirclePosX + (x * CircleSpreadX) + (x * CirclePixelSizeX), CirclePosY + (y * CircleSpreadY) + (y * CirclePixelSizeY), CirclePixelSizeX, RGB(0, 0, (CurPixelValue * LightValue) + 10))
Case 3
Circle(CirclePosX + (x * CircleSpreadX) + (x * CirclePixelSizeX), CirclePosY + (y * CircleSpreadY) + (y * CirclePixelSizeY), CirclePixelSizeX, RGB((CurPixelValue * LightValue) + 10, (CurPixelValue * LightValue) + 10, 0))
EndSelect
EndSelect
Next x
EndIf
Next y
DrawingMode(1)
DrawingFont(LoadFont(#FONT_01, "Courier New", 14))
TextPosX = #SCREEN_WIDTH / 2 - TextLength(CurBlinkenMovie$) / 2
DrawTextEx(TextPosX, #SCREEN_HEIGHT - 25, CurBlinkenMovie$, 255, 255, 255)
StopDrawing()
EndIf
;ShowFPS()
FlipBuffers()
ClearScreen(0, 0, 0)
Delay(FrameDur)
EndIf
ExamineKeyboard()
If KeyboardPushed(#PB_Key_1)
ColorMode = 0
EndIf
If KeyboardPushed(#PB_Key_2)
ColorMode = 1
EndIf
If KeyboardPushed(#PB_Key_3)
ColorMode = 2
EndIf
If KeyboardPushed(#PB_Key_4)
ColorMode = 3
EndIf
If KeyboardReleased(#PB_Key_P)
If PixelMode = 0
PixelMode = 1
Else
PixelMode = 0
EndIf
EndIf
If KeyboardReleased(#PB_Key_Space)
Break
EndIf
If KeyboardPushed(#PB_Key_Escape)
KeyEsc = 1
Break
EndIf
Wend
CloseFile(#FILE_01)
EndIf
Wend
EndIf
EndIf
EndIf
EndIf
Procedure.l GetRowData(*CurData.l)
StartTag$ = "<row>"
EndTag$ = "</row>"
CurRow$ = ReadString()
StartData = FindString(CurRow$, StartTag$, 1) + Len(StartTag$)
EndData = FindString(CurRow$, EndTag$, 1)
If StartData And EndData
PokeS(*CurData, Mid(CurRow$, StartData, Len(CurRow$) - Len(StartTag$) - Len(EndTag$) - 2))
Result = 1
EndIf
ProcedureReturn Result
EndProcedure
Procedure.l GetFrameDur()
StartTag$ = "<frame duration="
EndTag$ = ">"
CurRow$ = ReadString()
StartData = FindString(CurRow$, StartTag$, 1) + Len(StartTag$)
EndData = FindString(CurRow$, EndTag$, 1)
If StartData And EndData
FrameData$ = Mid(CurRow$, StartData, Len(CurRow$) - Len(StartTag$) - Len(EndTag$) - 2)
Result = Val(StringField(FrameData$, 2, Chr(34)))
EndIf
ProcedureReturn Result
EndProcedure
Procedure.l Hex2Dec(x$)
x$ = LCase(x$)
l = Len(x$)
For i = 1 To l
h1$ = Mid(x$, i, 1)
n = FindString("0123456789abcdef", h1$, 1)
x = x + (n - 1) * Pow(16, l - i)
Next i
ProcedureReturn x
EndProcedure
;-- Zeigt die FlipsPerSecond an --
Procedure ShowFPS()
If Val(FormatDate("%ss", Date())) = CurSec
CurFPS + 1
Else
FPS$ = Str(CurFPS)
CurFPS = 0
EndIf
CurSec = Val(FormatDate("%ss", Date()))
If StartDrawing(ScreenOutput())
DrawingMode(1)
DrawTextEx(1, 1, "FPS: " + FPS$, 255, 255, 255)
StopDrawing()
EndIf
EndProcedure
;-- Erweiterte DrawText-Funktion --
Procedure DrawTextEx(x.l, y.l, Text.s, r.l, g.l, b.l)
FrontColor(r, g, b)
Locate(x, y)
DrawText(Text)
EndProcedure
Es gibt zu Blinkenlights Tonnen an Tools und Infos, alles auf den Seiten die ich oben gepostet habe. Wer Lust hat kann das Programm ja erweitern oder verbessern und die anderen Formate noch implementieren, diese sind recht einfach und auf den Seiten (siehe oben) gut beschrieben. Oder man kann selber Filme machen. Für unter Windows fand ich noch keinen schönen Simulator, deshalb hab ich kurzerhand selbst was geschrieben, das ganze ist bestimmt nicht sauber programmiert, aber es läuft und es ist schön anzusehen.
Also, wünsche viel Spaß
Gruß
Michael
P.S.: Als kleine Anregung zur Weiterentwicklung, vielleicht macht jemand einen Screensaver oder eine Visualisierung für Musik draus, oder jemand hat Lust mal wieder den Lötkolben rauszuholen.