# coding=utf-8
import sys,math,os,json
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from collections import OrderedDict
class ImageGraphicItem(QGraphicsPixmapItem):
def __init__(self, filename ="",parent=None):
super().__init__(parent)
self.filename = filename
self.pix = QPixmap(filename)
self.width = self.pix.width()
self.height = self.pix.height()
self.setPixmap(self.pix) # 设置图元
self.setFlag(QGraphicsItem.ItemIsSelectable) # ***设置图元是可以被选择的
self.setFlag(QGraphicsItem.ItemIsMovable) # ***设置图元是可以被移动的
self.setFlag(QGraphicsItem.ItemIsFocusable)
class GraphicScene(QGraphicsScene):
def __init__(self, parent=None):
super().__init__(parent)
# 一些关于网格背景的设置
self.grid_size = 100 # 一块网格的大小 (正方形的)
self.grid_size_y = 170 # 一块网格的大小 (正方形的)
self.grid_squares = 5 # 网格中正方形的区域个数
# 一些颜色
self._color_background = QColor('#cfcfcf')
self._color_light = QColor('#212121')
self._color_dark = QColor('#292929')
# 一些画笔
self._pen_light = QPen(self._color_light)
self._pen_light.setWidth(1)
self._pen_dark = QPen(self._color_dark)
self._pen_dark.setWidth(4)
# 设置画背景的画笔
# self.setBackgroundBrush(self._color_background)
self.setSceneRect(0, 0, 4800, 3200)
def drawBackground(self, painter, rect):
super().drawBackground(painter, rect)
# 获取背景矩形的上下左右的长度,分别向上或向下取整数
rect = self.sceneRect()
left = int(math.floor(rect.left()))
right = int(math.ceil(rect.right()))
top = int(math.floor(rect.top()))
bottom = int(math.ceil(rect.bottom()))
# 从左边和上边开始
first_left = left - (left % self.grid_size) # 减去余数,保证可以被网格大小整除
first_top = top - (top % self.grid_size_y)
# 分别收集明、暗线
width = right- left
height = bottom - top
delta = math.atan(36*math.pi/180)*width
delta2 = math.tan(60.5*math.pi/180)*height
lines_light, lines_dark = [], []
for y in range(first_top, bottom*2, self.grid_size):
if y % (5*100) != 0:
qtop = QLineF(left-5, first_top, right+5, first_top)
qbut = QLineF(left-5, bottom, right+5, bottom)
qright = QLineF(right, first_top-5, right, bottom+3)
# painter.drawLine(qbut)
qw = QLineF(left, y, right, y-delta)
intersect_point1 = QPointF()
intersect_point2 = QPointF()
endp = QPointF()
stp = QPointF()
# ql.intersect(qw,pt)
if qw.intersect(qtop, intersect_point1) == QLineF.BoundedIntersection:
endp = intersect_point1
lines_light.append(QLineF(left, y,endp.x(),endp.y()))
if qw.intersect(qright, intersect_point1) == QLineF.BoundedIntersection and qw.intersect(qbut, intersect_point2) == QLineF.UnboundedIntersection:
endp = intersect_point1
lines_light.append(QLineF(left, y,endp.x(),endp.y()))
if qw.intersect(qright, intersect_point1) == QLineF.BoundedIntersection and qw.intersect(qbut, intersect_point2) == QLineF.BoundedIntersection:
endp = intersect_point1
stp = intersect_point2
lines_light.append(QLineF(stp.x(),stp.y(),endp.x(),endp.y()))
# print(QLineF(endp.x(),endp.y(),right, y-delta))
else:
qtop = QLineF(left, first_top, right, first_top)
qbut = QLineF(left, bottom, right, bottom)
qright = QLineF(right, first_top, right, bottom)
# painter.drawLine(qbut)
qw = QLineF(left, y, right, y-delta)
intersect_point1 = QPointF()
intersect_point2 = QPointF()
endp = QPointF()
stp = QPointF()
# ql.intersect(qw,pt)
if qw.intersect(qtop, intersect_point1) == QLineF.BoundedIntersection:
endp = intersect_point1
lines_dark.append(QLineF(left, y,endp.x(),endp.y()))
if qw.intersect(qright, intersect_point1) == QLineF.BoundedIntersection and qw.intersect(qbut, intersect_point2) == QLineF.UnboundedIntersection:
endp = intersect_point1
lines_dark.append(QLineF(left, y,endp.x(),endp.y()))
if qw.intersect(qright, intersect_point1) == QLineF.BoundedIntersection and qw.intersect(qbut, intersect_point2) == QLineF.BoundedIntersection:
endp = intersect_point1
stp = intersect_point2
lines_dark.append(QLineF(stp.x(),stp.y(),endp.x(),endp.y()))
# lines_dark.append(QLine(left, y, right, y-delta))
for x in range(first_left, right*3, self.grid_size_y):
if x % (5*self.grid_size_y) != 0:
qtop = QLineF(left-5, first_top, right+5, first_top)
qbut = QLineF(left-5, bottom, right+5, bottom)
qright = QLineF(right, first_top-5, right, bottom+3)
qleft = QLineF(first_left, first_top-5, first_left, bottom+3)
# painter.drawLine(qbut)
qw = QLineF(x, bottom, x-delta2,top)
intersect_point1 = QPointF()
intersect_point2 = QPointF()
endp = QPointF()
stp = QPointF()
# ql.intersect(qw,pt)
if qw.intersect(qright, intersect_point1) == QLineF.BoundedIntersection and qw.intersect(qleft, intersect_point2) == QLineF.UnboundedIntersection:
endp = intersect_point1
lines_light.append(QLineF(x-delta2, top ,endp.x(),endp.y()))
if qw.intersect(qleft, intersect_point1) == QLineF.BoundedIntersection and qw.intersect(qright, intersect_point2) == QLineF.BoundedIntersection:
endp = intersect_point1
stp = intersect_point2
lines_light.append(QLineF(stp.x(),stp.y() ,endp.x(),endp.y()))
if qw.intersect(qbut, intersect_point1) == QLineF.BoundedIntersection and qw.intersect(qleft, intersect_point2) == QLineF.BoundedIntersection:
endp = intersect_point1
stp = intersect_point2
lines_light.append(QLineF(stp.x(),stp.y() ,endp.x(),endp.y()))
else:
qtop = QLineF(left-5, first_top, right+5, first_top)
qbut = QLineF(left-5, bottom, right+5, bottom)
qright = QLineF(right, first_top-5, right, bottom+3)
qleft = QLineF(first_left, first_top-5, first_left, bottom+3)
# painter.drawLine(qbut)
qw = QLineF(x, bottom, x-delta2,top)
intersect_point1 = QPointF()
intersect_point2 = QPointF()
endp = QPointF()
stp = QPointF()
# ql.intersect(qw,pt)
if qw.intersect(qright, intersect_point1) == QLineF.BoundedIntersection and qw.intersect(qleft, intersect_point2) == QLineF.UnboundedIntersection:
endp = intersect_point1
lines_dark.append(QLineF(x-delta2, top ,endp.x(),endp.y()))
if qw.intersect(qleft, intersect_point1) == Q
没有合适的资源?快使用搜索试试~ 我知道了~
跑团地图软件 可行性文件+源代码+所涉及到的素材 支持自制素材加载和地图导出 Windows环境运行
共366个文件
png:357个
py:5个
json:3个
需积分: 5 0 下载量 163 浏览量
2023-07-07
14:20:52
上传
评论
收藏 16MB RAR 举报
温馨提示
跑团地图软件 可行性文件+源代码+所涉及到的素材 对于需要彩色的,可以自行寻找彩色sprite 素材 支持自制素材加载和地图导出 Windows环境 安装python3.5以上 pyqt5以上环境即可 Map of a Pirate’s Lair I’ve been a little light on inspiration recently – so I asked a friend for a challenge. He proposed a map on a theme of a Pirate Treasure Map, with the following outline:
资源推荐
资源详情
资源评论
收起资源包目录
跑团地图软件 可行性文件+源代码+所涉及到的素材
支持自制素材加载和地图导出
Windows环境运行
(366个子文件)
400.jpg 257KB
ab.json 13KB
save_map.json 3KB
aaa.json 435B
dragon.png 988KB
large roof.png 629KB
批注aa (1).png 562KB
roof bend.png 526KB
lake upper.png 376KB
lake lower.png 376KB
sacrificial pit.png 325KB
roof half1.png 263KB
stone bridge 2.png 241KB
smithy.png 224KB
waterfall.png 222KB
catapult 1.png 215KB
stone bridge 1.png 210KB
lake upper.png 203KB
lake lower.png 203KB
small roof.png 202KB
catapult 2.png 201KB
bridge with railing.png 191KB
waterfall extender.png 189KB
floor symbol summoning1 huge.png 161KB
river split.png 152KB
river split lower.png 151KB
dock.png 150KB
dock2.png 149KB
river cave exit.png 141KB
blood splatter up.png 135KB
blood splatter.png 134KB
compassrose large.png 134KB
stone bridge 3.png 133KB
wine barrel.png 129KB
pool white.png 127KB
compassrose large empty.png 121KB
river straight 2.png 119KB
bunk bed.png 117KB
river straight.png 113KB
pool red.png 105KB
bush_square.png 102KB
river bend lower.png 99KB
round table.png 99KB
river bend upper.png 98KB
october dwarf fountain.png 97KB
ballista 1.png 96KB
horse and wagon.png 95KB
rock formation large.png 92KB
waterfall extender simple.png 84KB
bridge start.png 83KB
river split lower.png 82KB
river split.png 82KB
river bend.png 82KB
glass shelves.png 81KB
roof half2.png 79KB
boat 1.png 77KB
river cave exit.png 77KB
torii.png 72KB
boat 2.png 69KB
ballista 2.png 67KB
table with chairs 4.png 66KB
fireplace.png 65KB
river straight 2.png 64KB
bridge middle.png 64KB
floor symbol summoning1 large.png 63KB
bridge.png 63KB
bush2.png 61KB
bridge back start.png 61KB
table with chairs 6.png 61KB
river straight.png 61KB
cave wall corner lower.png 60KB
table with chairs 5.png 60KB
stream straight.png 60KB
table with chairs 3.png 58KB
beer barrels.png 57KB
pond.png 55KB
sarcophagus.png 54KB
portal (red).png 54KB
river bend lower.png 53KB
river bend upper.png 53KB
deadwarrior.png 53KB
portal (green).png 53KB
portal (blue).png 52KB
portal (purple).png 52KB
field.png 52KB
beer barrels 2.png 48KB
bush3.png 48KB
rock formation small.png 48KB
lynx ginger.png 48KB
compassrose.png 48KB
table with chairs 2.png 48KB
dead tree.png 48KB
bed.png 46KB
evil altar.png 46KB
pine tree2.png 46KB
sarcophagus2.png 45KB
river bend.png 45KB
pine oak.png 44KB
table with chairs 1.png 44KB
bridge end.png 44KB
共 366 条
- 1
- 2
- 3
- 4
资源评论
一枚程序圆
- 粉丝: 28
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功