compiler warning and HLint remarks
This commit is contained in:
parent
106f50c08d
commit
a3fe5a1d8b
@ -30,7 +30,8 @@ createGUI = (Map.fromList [ (UIId 0, GUIAnyP $ GUIPanel $ GUIContainer 0 0 0 0 [
|
|||||||
], [UIId 0])
|
], [UIId 0])
|
||||||
|
|
||||||
getGUI :: Map.HashMap UIId (GUIAny Pioneers) -> [GUIAny Pioneers]
|
getGUI :: Map.HashMap UIId (GUIAny Pioneers) -> [GUIAny Pioneers]
|
||||||
getGUI hmap = Map.elems hmap
|
getGUI = Map.elems
|
||||||
|
{-# INLINE getGUI #-}
|
||||||
|
|
||||||
getRootIds :: Pioneers [UIId]
|
getRootIds :: Pioneers [UIId]
|
||||||
getRootIds = do
|
getRootIds = do
|
||||||
@ -60,7 +61,7 @@ clickHandler (Pixel x y) = do
|
|||||||
case hits of
|
case hits of
|
||||||
[] -> liftIO $ putStrLn $ unwords ["button press on (",show x,",",show y,")"]
|
[] -> liftIO $ putStrLn $ unwords ["button press on (",show x,",",show y,")"]
|
||||||
_ -> do
|
_ -> do
|
||||||
changes <- sequence $ map (\uid -> do
|
changes <- mapM (\uid -> do
|
||||||
let w = toGUIAny hMap uid
|
let w = toGUIAny hMap uid
|
||||||
short <- getShorthand w
|
short <- getShorthand w
|
||||||
bound <- getBoundary w
|
bound <- getBoundary w
|
||||||
@ -121,7 +122,6 @@ copyGUI tex widget = do
|
|||||||
(GUIAnyC _) -> [255,0,0,128]
|
(GUIAnyC _) -> [255,0,0,128]
|
||||||
(GUIAnyB _ _) -> [255,255,0,255]
|
(GUIAnyB _ _) -> [255,255,0,255]
|
||||||
(GUIAnyP _) -> [128,128,128,128]
|
(GUIAnyP _) -> [128,128,128,128]
|
||||||
_ -> [255,0,255,255]
|
|
||||||
liftIO $ allocaBytes (wWidth*wHeight*4) $ \ptr -> do
|
liftIO $ allocaBytes (wWidth*wHeight*4) $ \ptr -> do
|
||||||
--copy data into C-Array
|
--copy data into C-Array
|
||||||
pokeArray ptr (genColorData (wWidth*wHeight) color)
|
pokeArray ptr (genColorData (wWidth*wHeight) color)
|
||||||
|
@ -10,15 +10,14 @@ import UI.UIClasses
|
|||||||
|
|
||||||
defaultUIState :: UIButtonState
|
defaultUIState :: UIButtonState
|
||||||
defaultUIState = UIButtonState False False False False False False
|
defaultUIState = UIButtonState False False False False False False
|
||||||
|
{-# INLINE defaultUIState #-}
|
||||||
|
|
||||||
toGUIAny :: Map.HashMap UIId (GUIAny m) -> UIId -> GUIAny m
|
toGUIAny :: Map.HashMap UIId (GUIAny m) -> UIId -> GUIAny m
|
||||||
toGUIAny m uid = case Map.lookup uid m of
|
toGUIAny m uid = fromMaybe (error "map does not contain requested key") (Map.lookup uid m)
|
||||||
Just w -> w
|
|
||||||
Nothing -> error "map does not contain requested key" --TODO: better error handling
|
|
||||||
{-# INLINE toGUIAny #-}
|
{-# INLINE toGUIAny #-}
|
||||||
|
|
||||||
toGUIAnys :: Map.HashMap UIId (GUIAny m) -> [UIId] -> [GUIAny m]
|
toGUIAnys :: Map.HashMap UIId (GUIAny m) -> [UIId] -> [GUIAny m]
|
||||||
toGUIAnys m ids = mapMaybe (flip Map.lookup m) ids
|
toGUIAnys m = mapMaybe (flip Map.lookup m)
|
||||||
{-# INLINE toGUIAnys #-}
|
{-# INLINE toGUIAnys #-}
|
||||||
-- TODO: check for missing components?
|
-- TODO: check for missing components?
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user