ldd linker relative paths
This commit is contained in:
		
							
								
								
									
										55
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										55
									
								
								main.go
									
									
									
									
									
								
							| @@ -5,8 +5,6 @@ import ( | ||||
|     blt "bearlibterminal" | ||||
|     "ui" | ||||
|     "util" | ||||
|     "game" | ||||
|     "fmt" | ||||
| ) | ||||
|  | ||||
| var version = "0.0.0" | ||||
| @@ -17,59 +15,6 @@ func main() { | ||||
|  | ||||
|     config := util.LoadConfig() | ||||
|  | ||||
|     var testState = game.Init(config) | ||||
|  | ||||
|     var test = game.Item{ | ||||
|         &game.Mob{ | ||||
|             game.Identifiable{ | ||||
|                 1, | ||||
|                 "testitem1", | ||||
|             }, | ||||
|             '!', | ||||
|             1, | ||||
|             1, | ||||
|             "test potion", | ||||
|             game.MapColor{1,254,254, 254}, | ||||
|             game.MapColor{1, 0, 0, 0}, | ||||
|             false, | ||||
|         }, | ||||
|         12} | ||||
|  | ||||
|     testState.Level.Mobs = append(testState.Level.Mobs, test.Mob) | ||||
|  | ||||
|     var actor = game.Monster{ | ||||
|         &game.Mob{ | ||||
|             game.Identifiable{ | ||||
|                 2, | ||||
|                 "testactor2", | ||||
|             }, | ||||
|             'A', | ||||
|             1, | ||||
|             1, | ||||
|             "Actor for testing", | ||||
|             game.MapColor{1, 233, 254,254}, | ||||
|             game.MapColor{1, 0, 0, 0}, | ||||
|             true, | ||||
|         }, | ||||
|         []*game.Coords{}, | ||||
|         game.MonsterInventory{ | ||||
|         1, | ||||
|         100, | ||||
|         []*game.Item{}, | ||||
|         }, | ||||
|         1, | ||||
|         500, | ||||
|         } | ||||
|  | ||||
|     fmt.Printf("%v", testState) | ||||
|  | ||||
|     test.Pickup(&actor) | ||||
|     fmt.Printf("%v", testState) | ||||
|     fmt.Printf("%v", actor) | ||||
|     fmt.Printf("%v", test) | ||||
|  | ||||
|     test.Drop(&actor) | ||||
|  | ||||
|     blt.Open() | ||||
|     //blt.Set("window: size=80x25, title="+config.Title+" v"+string(version)+"; font: ./fonts/Monaco-Linux.ttf, size=10") | ||||
|     blt.Set("window: size=100x47, title="+config.Title+" v"+string(version)+"; font: ./resources/fonts-bitmap/ibmnew8x12.png, size=8x12;") | ||||
|   | ||||
| @@ -24,7 +24,8 @@ package bearlibterminal | ||||
|  | ||||
| // // #cgo LDFLAGS: -I/home/agurov/projects/zaar/alchemyst-go/src/bearlibterminal -L/home/agurov/projects/zaar/alchemyst-go/lib -lBearLibTerminal | ||||
|  | ||||
| // #cgo LDFLAGS: -I./ -L../../lib -lBearLibTerminal | ||||
| // // #cgo LDFLAGS: -L../../lib -lBearLibTerminal | ||||
| // #cgo LDFLAGS: -L. -Wl,-rpath -Wl,./ -lBearLibTerminal | ||||
| // #include <stdlib.h> | ||||
| // #include <BearLibTerminal.h> | ||||
| import "C" | ||||
| @@ -33,11 +34,21 @@ import ( | ||||
| 	"unsafe" | ||||
| ) | ||||
|  | ||||
|  | ||||
| // compile with go build -o test | ||||
| // check relative path with objdump -p test | grep RPATH | ||||
| // must be: RPATH                ./ | ||||
| // make sure that .so is globally visible during development! | ||||
| // in ubunutu: $ sudo echo "/path/to/libbearterminal.so" > /etc/ld.so.conf.d/libbearterminal.conf && sudo ldconfig | ||||
| // when development is complete, just $ sudo rm /etc/ld.so.conf.d/libbearterminal.conf | ||||
| // compiled binaties must still work in same folder with .so | ||||
|  | ||||
|  | ||||
| // | ||||
| // Keyboard scancodes for events/states | ||||
| // | ||||
| const ( | ||||
|     TK_NONE        = 0x00 | ||||
| 	TK_NONE        = 0x00 | ||||
| 	TK_A           = 0x04 | ||||
| 	TK_B           = 0x05 | ||||
| 	TK_C           = 0x06 | ||||
|   | ||||
| @@ -3,5 +3,5 @@ package game | ||||
| type Level struct { | ||||
|     Branch string | ||||
|     Map  Map | ||||
|     Mobs map[Identifiable]Mob | ||||
|     Mobs map[string]Mob | ||||
| } | ||||
|   | ||||
| @@ -19,10 +19,7 @@ type color struct { | ||||
| } | ||||
|  | ||||
| //packed char, fgColor, bgColor and render settings | ||||
| type Drawable struct { | ||||
|     Char string | ||||
|     fgColor color | ||||
|     bgColor color | ||||
| type Drawable interface { | ||||
| } | ||||
|  | ||||
| type Tile struct { | ||||
| @@ -31,6 +28,3 @@ type Tile struct { | ||||
|     BlocksSight bool | ||||
|     //colordance and other stuff later | ||||
| } | ||||
| func (tile *Tile) NewTile (char string, fgColor color, bgColor color) Tile { | ||||
|     return Tile{Drawable{char, fgColor, bgColor}, false, false} | ||||
| } | ||||
| @@ -18,6 +18,11 @@ type Sentient interface { | ||||
|     TakeTurn() | ||||
| } | ||||
|  | ||||
| //something with inventory | ||||
| type Monster interface { | ||||
|     Mob | ||||
| } | ||||
|  | ||||
| //Something that can fight | ||||
| type Fighter interface { | ||||
|     Mob | ||||
|   | ||||
		Reference in New Issue
	
	Block a user