- 
                Notifications
    
You must be signed in to change notification settings  - Fork 78
 
Getting Started
        enderger edited this page Jun 15, 2020 
        ·
        2 revisions
      
    Currently, nimx uses SDL2 for all platforms except web, so make sure SDL2 is installed and linkable.
Nimx is a regular nimble package, so you could either install it or add it as a dependency to your project
# If you want to install nimx
nimble install -y nimx
# Or you could add it as a project dependency
echo 'requires "nimx"' >> MYPROJECT.nimble
# And then tell nimble to update your project dependencies
nimble install -dyCreate a file called helloworld.nim with the following contents:
import nimx / [ window, layout, button, text_field ]
runApplication:
   let w = newWindow(newRect(50, 50, 500, 150))
   w.makeLayout:
      - Label as greetingLabel:
         center == super
         width == 300
         height == 15
         text: "Press the 'Greet' button to see the greeting"
       - Button:
          centerX == super
          top == prev.bottom + 5
          width == 100
          height == 25
          title: "Greet"
          onAction:
              greetingLabel.text = "Hello, world!"Compile and run:
nim c -r --threads:on helloworld
The application should launch and look like this: