From 04d6d49eed7b952f3ba61f1364e538c6e5c8d5a2 Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 25 Sep 2012 23:53:49 +0200 Subject: the beginnings of a world description editor --- src/mapdata.py | 20 +++++++++++++++++++- src/worldeditor.py | 17 +++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/worldeditor.py diff --git a/src/mapdata.py b/src/mapdata.py index bdb8e2a..2c88f9b 100644 --- a/src/mapdata.py +++ b/src/mapdata.py @@ -546,9 +546,25 @@ class KPPathLayer(KPLayer): item.setFlag(flag, value) +@mapfile.dumpable('world_definition') +class KPWorldDef(object): + __dump_attribs__ = ('name', 'fs_hint_colours', 'fs_text_colours', 'hud_hint_colours', 'hud_text_colours', 'music_track_id') + + def __init__(self): + self.name = 'Untitled World' + + self.fs_hint_colours = (0x000000FF,0x000000FF) + self.fs_text_colours = (0xFFFFFFFF,0xFFFFFFFF) + + self.hud_hint_transform = (0,0,0) + self.hud_text_colours = (0xFFFFFFFF,0xFFFFFFFF) + + self.music_track_id = 0 + + @mapfile.dumpable('map_root') class KPMap(object): - __dump_attribs__ = ('layers', 'associateLayers', 'nextLayerNumber', 'doodadDefinitions') + __dump_attribs__ = ('layers', 'associateLayers', 'nextLayerNumber', 'doodadDefinitions', 'worlds') def _preload(self, src): # we need this early so we can use the deref methods! @@ -607,6 +623,8 @@ class KPMap(object): self.doodadDefinitions = [] self.doodadModel = KPMap.DoodadModel(self.doodadDefinitions) + self.worlds = [] + # LAYERS class LayerModel(QtCore.QAbstractListModel): diff --git a/src/worldeditor.py b/src/worldeditor.py new file mode 100644 index 0000000..a2262ae --- /dev/null +++ b/src/worldeditor.py @@ -0,0 +1,17 @@ +from common import * + +class KPWorldEditor(QtGui.QWidget): + def __init__(self, parent=None): + QtGui.QWidget.__init__(self, parent) + self.setWindowTitle('World Editor') + + self.dataView = QtGui.QTableView(self) + self.addButton = QtGui.QPushButton('Add', self) + self.removedButton = QtGui.QPushButton('Remove', self) + + layout = QtGui.QGridLayout(self) + layout.addWidget(self.dataView, 0, 0, 1, 2) + layout.addWidget(self.addButton, 1, 0, 1, 1) + layout.addWidget(self.removeButton, 1, 1, 1, 1) + + self.currentWorlds = None -- cgit v1.2.3