diff options
Diffstat (limited to 'video')
-rw-r--r-- | video/LICENSE | 9 | ||||
-rw-r--r-- | video/Main.hs | 32 | ||||
-rw-r--r-- | video/README | 1 | ||||
-rw-r--r-- | video/package.yaml | 25 | ||||
-rw-r--r-- | video/src/Video.hs | 13 | ||||
-rw-r--r-- | video/stack.yaml | 4 |
6 files changed, 84 insertions, 0 deletions
diff --git a/video/LICENSE b/video/LICENSE new file mode 100644 index 0000000..3d1ddbb --- /dev/null +++ b/video/LICENSE @@ -0,0 +1,9 @@ +Copyright 2021 Aleksey Veresov + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from +the use of this software. + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. diff --git a/video/Main.hs b/video/Main.hs new file mode 100644 index 0000000..627103b --- /dev/null +++ b/video/Main.hs @@ -0,0 +1,32 @@ +-- This module parses config as passed in arguments and runs Emulator. +module Main where + +import Options.Applicative +import Video + + +inet_socket :: Parser ConfigSocket +inet_socket = ConfigInet <$> strOption + ( long "inet" + <> short 'i' + <> metavar "ADDR" + <> help "Port for internet socket" ) + +unix_socket :: Parser ConfigSocket +unix_socket = ConfigUnix <$> strOption + ( long "unix" + <> short 'u' + <> metavar "ADDR" + <> help "Address for UNIX socket" ) + +socket :: Parser ConfigSocket +socket = inet_socket <|> unix_socket + + +main :: IO () +main = video =<< execParser opts + where + opts = info (socket <**> helper) + ( fullDesc + <> progDesc "The way to output your colorful pixels from Suem" + <> header "suem-video - Suem video device" ) diff --git a/video/README b/video/README new file mode 100644 index 0000000..25d6917 --- /dev/null +++ b/video/README @@ -0,0 +1 @@ +blah-blah-blah diff --git a/video/package.yaml b/video/package.yaml new file mode 100644 index 0000000..ae4a51f --- /dev/null +++ b/video/package.yaml @@ -0,0 +1,25 @@ +name: suem-video +version: 0.1.0.0 +synopsis: Suem video device +license: OtherLicense + +extra-source-files: +- README + +ghc-options: -O2 -optl-pthread + +dependencies: +- base >= 4.7 && < 5 +- bytestring +- optparse-applicative +- network +- gloss + +library: + source-dirs: src + +executable: + main: Main.hs + ghc-options: -threaded -rtsopts -with-rtsopts=-N + dependencies: + - suem-video diff --git a/video/src/Video.hs b/video/src/Video.hs new file mode 100644 index 0000000..d03439a --- /dev/null +++ b/video/src/Video.hs @@ -0,0 +1,13 @@ +module Video (ConfigSocket(..), video) where + +import Graphics.Gloss +import Data.ByteString (pack) + +data ConfigSocket = ConfigInet String | ConfigUnix String + +video :: ConfigSocket -> IO () +video _ = do + let pic = replicate (256 * 256 * 4) 255 + bmp = bitmapOfByteString 256 256 (BitmapFormat TopToBottom PxRGBA) + (pack pic) False + display (InWindow "Suem Video" (256, 256) (0, 0)) black bmp diff --git a/video/stack.yaml b/video/stack.yaml new file mode 100644 index 0000000..d5cd0ae --- /dev/null +++ b/video/stack.yaml @@ -0,0 +1,4 @@ +packages: +- . +system-ghc: true +resolver: lts-16.21 |