renderWindow performs all rendering based on current Stages config. It sets the Write lock on RenderContext Mutex, so nothing else can update during this time. All other updates are done with a Read lock so they won't interfere with each other.
()
| 742 | // during this time. All other updates are done with a Read lock so they |
| 743 | // won't interfere with each other. |
| 744 | func (w *renderWindow) renderWindow() { |
| 745 | rc := w.renderContext() |
| 746 | rc.lock() |
| 747 | defer func() { |
| 748 | rc.rebuild = false |
| 749 | rc.unlock() |
| 750 | }() |
| 751 | rebuild := rc.rebuild |
| 752 | |
| 753 | stageMods, sceneMods := w.mains.updateAll() // handles all Scene / Widget updates! |
| 754 | top := w.mains.top() |
| 755 | if top == nil { |
| 756 | return |
| 757 | } |
| 758 | if !top.Sprites.Modified && !rebuild && !stageMods && !sceneMods { // nothing to do! |
| 759 | // fmt.Println("no mods") // note: get a ton of these.. |
| 760 | return |
| 761 | } |
| 762 | |
| 763 | if DebugSettings.WinRenderTrace { |
| 764 | fmt.Println("RenderWindow: doing render:", w.name) |
| 765 | fmt.Println("rebuild:", rebuild, "stageMods:", stageMods, "sceneMods:", sceneMods) |
| 766 | } |
| 767 | |
| 768 | if stageMods || rebuild { |
| 769 | if !w.gatherScenes() { |
| 770 | slog.Error("RenderWindow: no scenes") |
| 771 | return |
| 772 | } |
| 773 | } |
| 774 | w.drawScenes() |
| 775 | } |
| 776 | |
| 777 | // drawScenes does the drawing of RenderScenes to the window. |
| 778 | func (w *renderWindow) drawScenes() { |
no test coverage detected