Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window is empty #309

Open
cr4zsci opened this issue Nov 28, 2023 · 4 comments
Open

Window is empty #309

cr4zsci opened this issue Nov 28, 2023 · 4 comments

Comments

@cr4zsci
Copy link

cr4zsci commented Nov 28, 2023

I'm trying to run the example code

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}

module Main where

import Control.Lens
import Data.Text (Text)
import Monomer
import TextShow

import qualified Monomer.Lens as L

newtype AppModel = AppModel {
  _clickCount :: Int
} deriving (Eq, Show)

data AppEvent
  = AppInit
  | AppIncrease
  deriving (Eq, Show)

makeLenses 'AppModel

buildUI
  :: WidgetEnv AppModel AppEvent
  -> AppModel
  -> WidgetNode AppModel AppEvent
buildUI wenv model = widgetTree where
  widgetTree = vstack [
      label "Hello world",
      spacer,
      hstack [
        label $ "Click count: " <> showt (model ^. clickCount),
        spacer,
        button "Increase count" AppIncrease
      ]
    ] `styleBasic` [padding 10]

handleEvent
  :: WidgetEnv AppModel AppEvent
  -> WidgetNode AppModel AppEvent
  -> AppModel
  -> AppEvent
  -> [AppEventResponse AppModel AppEvent]
handleEvent wenv node model evt = case evt of
  AppInit -> []
  AppIncrease -> [Model (model & clickCount +~ 1)]

main :: IO ()
main = do
  startApp model handleEvent buildUI config
  where
    config = [
      appWindowTitle "Tutorial 01 - Basics",
      -- appWindowIcon "./assets/images/icon.png",
      appTheme darkTheme,
      appFontDef "JetBrains Mono" "/home/yerkov/.local/share/fonts/JetBrainsMono-Bold.ttf",
      appInitEvent AppInit
      ]
    model = AppModel 0

But after running this code i get an empty window without widgets.

Снимок экрана_2023-11-28_09-45-55

stack 2.11.1
ghc 9.4.7
Linux Mint 21.1

@fjvallarino
Copy link
Owner

Hi @cr4zsci,

Do you get any log/error in the console? It's probably failing to load the font. Does the same happen with Roboto Regular?

@cr4zsci
Copy link
Author

cr4zsci commented Nov 28, 2023

Hi

There were no errors. After changing the font to roboto nothing changed: no errors and empty window.

Снимок экрана_2023-11-28_15-43-02

p.s. sorry for the incorrect status changes

@cr4zsci cr4zsci closed this as completed Nov 28, 2023
@cr4zsci cr4zsci reopened this Nov 28, 2023
@cr4zsci cr4zsci closed this as completed Nov 28, 2023
@cr4zsci cr4zsci reopened this Nov 28, 2023
@fjvallarino
Copy link
Owner

It could be a driver issue. Are you able to run other OpenGL-based applications?

I searched on Google about Kaveri and OpenGL and found some people had different issues, but I could not find something definitive.

@cr4zsci
Copy link
Author

cr4zsci commented Nov 29, 2023

glxgear works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants