Update readme; add hello_world.go
This commit is contained in:
		
							parent
							
								
									ed219e8c05
								
							
						
					
					
						commit
						b509ce1141
					
				@ -37,11 +37,9 @@ func main() {
 | 
				
			|||||||
	p.Height = 5
 | 
						p.Height = 5
 | 
				
			||||||
	ui.Render(p)
 | 
						ui.Render(p)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uiEvents := ui.PollEvents()
 | 
						for e := range ui.PollEvents() {
 | 
				
			||||||
	for {
 | 
					 | 
				
			||||||
		e := <-uiEvents
 | 
					 | 
				
			||||||
		if e.Type == ui.KeyboardEvent {
 | 
							if e.Type == ui.KeyboardEvent {
 | 
				
			||||||
			return
 | 
								break
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										22
									
								
								_examples/hello_world.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								_examples/hello_world.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					package main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import ui "github.com/gizak/termui"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func main() {
 | 
				
			||||||
 | 
						err := ui.Init()
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							panic(err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						defer ui.Close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						p := ui.NewParagraph("Hello World!")
 | 
				
			||||||
 | 
						p.Width = 25
 | 
				
			||||||
 | 
						p.Height = 5
 | 
				
			||||||
 | 
						ui.Render(p)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for e := range ui.PollEvents() {
 | 
				
			||||||
 | 
							if e.Type == ui.KeyboardEvent {
 | 
				
			||||||
 | 
								break
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user