Reimplement text rendering, slow

This commit is contained in:
jgk
2021-02-12 14:26:51 +01:00
parent 42c8a55da2
commit d6f46a7fcc
4 changed files with 96 additions and 9 deletions
+77 -2
View File
@@ -1,6 +1,81 @@
module Main where
import Lib
import Loop
import EventHelper
import Shaders
import Render
import Shapes
import Dodge.Rendering
import Dodge.RenderPicture
import Dodge.Picture
import Dodge.Prototypes
import Dodge.Data
import Dodge.Initialisation
import Dodge.Rooms
import Dodge.Layout
import Dodge.LoadSound
import Dodge.Update
import Dodge.KeyEvents
import Dodge.Preload
import Control.Concurrent
import Control.Lens
import System.Random
import qualified SDL as SDL
import qualified SDL.Mixer as Mix
import Graphics.Rendering.OpenGL hiding (color,scale)
--Mix.openAudio Mix.defaultAudio 256 >>
initWorld = initialWorld
{ _randGen = mkStdGen 2
, _windowX = 800
, _windowY = 600
}
pps = [(0,0),(50,0),(0,25)]
ppt = [(0,0),(-50,0),(20,25)]
tSh = TextShape
[((0.0,0.0,0),(1,0,1,1),(s,1))
,((0.5,0.0,0),(1,1,1,1),(e,1))
,((0.5,1.0,0),(1,1,1,1),(e,0))
,((0.0,1.0,0),(1,1,1,1),(s,0))
]
where x = 1/128
s = 20 * x
e = s + x
tSh' = TShape'
[0.0,0.0,0,1,0,1,1,s,1
,0.5,0.0,0,1,1,1,1,e,1
,0.5,1.0,0,1,1,1,1,e,0
,0.0,1.0,0,1,1,1,1,s,0
] TriangleFan
where x = 1/128
s = 20 * x
e = s + x
tSha = TShape'
[0.0,0.0,0,1,1,1,1
,50 ,0.0,0,1,1,1,1
,50 ,50 ,0,1,1,1,1
,0.0,1.0,0,1,1,1,1
] TriangleFan
main :: IO ()
main = someFunc
main = do
-- loadedSounds <- loadSounds
setupLoop
"windowName"
800 600
doPreload'
(initializeWorld $ generateFromTree lev1 $ initWorld)
(-- \((bs:fs:ts:_),tes) w -> --do render setparams w egFade
\preData w -> --do render setparams w egFade
renderPicture preData (draw blank w)
-- renderTex'' preData tSh
)
handleEvent
(\w -> Just $ update w)
Mix.closeAudio
+17
View File
@@ -21,6 +21,23 @@ description: Please see the README on GitHub at <https://github.com/gith
dependencies:
- base >= 4.7 && < 5
- containers
- unordered-containers
- heap
- sdl2
- sdl2-mixer
- text
- OpenGL
- raw-strings-qq
- bytestring
- lens
- mtl
- fgl
- random
- bmp
- monad-loops
- JuicyPixels
- vector
library:
source-dirs: src
-6
View File
@@ -1,6 +0,0 @@
module Lib
( someFunc
) where
someFunc :: IO ()
someFunc = putStrLn "someFunc"
+2 -1
View File
@@ -34,7 +34,8 @@ packages:
# These entries can reference officially published versions as well as
# forks / in-progress versions pinned to a git hash. For example:
#
# extra-deps:
extra-deps:
- SDL-0.6.7.0@sha256:9d6ba75c0cab575ec38468c8277803983e985f9622437aeca6a53e6a7337a7d5,2045
# - acme-missiles-0.3
# - git: https://github.com/commercialhaskell/stack.git
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a