cityview

package
v0.0.0-...-94f88f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// not a real building, just something that shows up in the city view screen
	BuildingTree1 buildinglib.Building = iota + buildinglib.BuildingLast
	BuildingTree2
	BuildingTree3

	BuildingTreeHouse1
	BuildingTreeHouse2
	BuildingTreeHouse3
	BuildingTreeHouse4
	BuildingTreeHouse5
)

Variables

This section is empty.

Functions

func GetBuildingIndex

func GetBuildingIndex(building buildinglib.Building) int

the index in cityscap.lbx for the picture of this building

func SimplifiedView

func SimplifiedView(cache *lbx.LbxCache, city *citylib.City, player *playerlib.Player) (func(coroutine.YieldFunc, func()), func(*ebiten.Image))

when right clicking on an enemy city, this just shows the population, garrison, and city scape for that city

Types

type BuildScreen

type BuildScreen struct {
	LbxCache          *lbx.LbxCache
	ImageCache        *util.ImageCache
	City              *citylib.City
	UI                *uilib.UI
	State             BuildScreenState
	ProducingBuilding buildinglib.Building
	ProducingUnit     units.Unit
}

func MakeBuildScreen

func MakeBuildScreen(cache *lbx.LbxCache, city *citylib.City) *BuildScreen

func (*BuildScreen) Cancel

func (buildScreen *BuildScreen) Cancel()

func (*BuildScreen) Draw

func (build *BuildScreen) Draw(screen *ebiten.Image)

func (*BuildScreen) Ok

func (buildScreen *BuildScreen) Ok()

func (*BuildScreen) Update

func (build *BuildScreen) Update() BuildScreenState

type BuildScreenState

type BuildScreenState int
const (
	BuildScreenRunning BuildScreenState = iota
	BuildScreenCanceled
	BuildScreenOk
)

type BuildingSlot

type BuildingSlot struct {
	Building    buildinglib.Building
	IsRubble    bool // in case of rubble
	RubbleIndex int
	Point       image.Point
}

type CityScreen

type CityScreen struct {
	LbxCache   *lbx.LbxCache
	ImageCache util.ImageCache
	Fonts      *Fonts
	City       *citylib.City

	UI     *uilib.UI
	Player *playerlib.Player

	Buildings   []BuildingSlot
	BuildScreen *BuildScreen

	Counter uint64
	State   CityScreenState
}

func MakeCityScreen

func MakeCityScreen(cache *lbx.LbxCache, city *citylib.City, player *playerlib.Player, newBuilding buildinglib.Building) *CityScreen

func (*CityScreen) BuildingMaintenanceResources

func (cityScreen *CityScreen) BuildingMaintenanceResources() []ResourceUsage

func (*CityScreen) CreateResourceIcons

func (cityScreen *CityScreen) CreateResourceIcons(ui *uilib.UI) []*uilib.UIElement

func (*CityScreen) Draw

func (cityScreen *CityScreen) Draw(screen *ebiten.Image, mapView func(screen *ebiten.Image, geom ebiten.GeoM, counter uint64), tileWidth int, tileHeight int)

func (*CityScreen) FoodProducers

func (cityScreen *CityScreen) FoodProducers() []ResourceUsage

func (*CityScreen) GoldProducers

func (cityScreen *CityScreen) GoldProducers() []ResourceUsage

func (*CityScreen) MakeResourceDialog

func (cityScreen *CityScreen) MakeResourceDialog(title string, smallIcon *ebiten.Image, bigIcon *ebiten.Image, ui *uilib.UI, resources []ResourceUsage) *uilib.UIElement

copied heavily from ui/dialogs.go:MakeHelpElementWithLayer

func (*CityScreen) MakeUI

func (cityScreen *CityScreen) MakeUI(newBuilding buildinglib.Building) *uilib.UI

func (*CityScreen) PowerProducers

func (cityScreen *CityScreen) PowerProducers() []ResourceUsage

func (*CityScreen) ResearchProducers

func (cityScreen *CityScreen) ResearchProducers() []ResourceUsage

func (*CityScreen) SellBuilding

func (cityScreen *CityScreen) SellBuilding(building buildinglib.Building)

func (*CityScreen) Update

func (cityScreen *CityScreen) Update() CityScreenState

func (*CityScreen) WorkProducers

func (cityScreen *CityScreen) WorkProducers() []ResourceUsage

type CityScreenState

type CityScreenState int
const (
	CityScreenStateRunning CityScreenState = iota
	CityScreenStateDone
)

type Fonts

type Fonts struct {
	BigFont         *font.Font
	DescriptionFont *font.Font
	ProducingFont   *font.Font
	SmallFont       *font.Font
	RubbleFont      *font.Font
}

type ResourceUsage

type ResourceUsage struct {
	Count int // can be negative
	Name  string
}

represents how much of a resource is being used/produced, such as '2 granary' for 'the granary produces 2 food'

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL