()
| 133 | } |
| 134 | |
| 135 | func (project *Project) CreateGridTexture() { |
| 136 | |
| 137 | guiTex := globals.Resources.Get(LocalRelativePath("assets/gui.png")).AsImage() |
| 138 | |
| 139 | // project.GridTexture = TileTexture(guiTex, &sdl.Rect{480, 0, 32, 32}, 512, 512) |
| 140 | |
| 141 | srcRect := &sdl.FRect{480, 0, 32, 32} |
| 142 | |
| 143 | if project.GridTexture == nil { |
| 144 | |
| 145 | project.GridTexture = NewRenderTexture() |
| 146 | |
| 147 | project.GridTexture.RenderFunc = func() { |
| 148 | |
| 149 | project.GridTexture.Recreate(512, 512) |
| 150 | |
| 151 | project.GridTexture.Image.Texture.SetScaleMode(sdl.SCALEMODE_NEAREST) |
| 152 | |
| 153 | gridColor := getThemeColor(GUIGridColor).Mix(getThemeColor(GUIBGColor), 0.75) |
| 154 | |
| 155 | guiTex.Texture.SetColorMod(gridColor.RGB()) |
| 156 | guiTex.Texture.SetAlphaMod(gridColor[3]) |
| 157 | |
| 158 | project.GridTexture.Texture.SetBlendMode(sdl.BLENDMODE_BLEND) |
| 159 | |
| 160 | SetRenderTarget(project.GridTexture.Texture) |
| 161 | |
| 162 | dst := &sdl.FRect{0, 0, srcRect.W, srcRect.H} |
| 163 | |
| 164 | for y := float32(0); y < project.GridTexture.Size.Y; y += srcRect.H { |
| 165 | for x := float32(0); x < project.GridTexture.Size.X; x += srcRect.W { |
| 166 | dst.X = x |
| 167 | dst.Y = y |
| 168 | globals.Renderer.RenderTexture(guiTex.Texture, srcRect, dst) |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | SetRenderTarget(nil) |
| 173 | |
| 174 | } |
| 175 | |
| 176 | } |
| 177 | |
| 178 | project.GridTexture.RenderFunc() |
| 179 | |
| 180 | } |
| 181 | |
| 182 | func (project *Project) AutoBackup() { |
| 183 |
no test coverage detected