|
| 1 | +// This file is part of Gopher2600. |
| 2 | +// |
| 3 | +// Gopher2600 is free software: you can redistribute it and/or modify |
| 4 | +// it under the terms of the GNU General Public License as published by |
| 5 | +// the Free Software Foundation, either version 3 of the License, or |
| 6 | +// (at your option) any later version. |
| 7 | +// |
| 8 | +// Gopher2600 is distributed in the hope that it will be useful, |
| 9 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | +// GNU General Public License for more details. |
| 12 | +// |
| 13 | +// You should have received a copy of the GNU General Public License |
| 14 | +// along with Gopher2600. If not, see <https://www.gnu.org/licenses/>. |
| 15 | + |
| 16 | +package sdlimgui |
| 17 | + |
| 18 | +import ( |
| 19 | + "github.com/inkyblackness/imgui-go/v2" |
| 20 | + "github.com/jetsetilly/gopher2600/hardware/riot/ports/savekey" |
| 21 | +) |
| 22 | + |
| 23 | +const winSaveKeyTitle = "SaveKey (work in progress)" |
| 24 | + |
| 25 | +type winSaveKey struct { |
| 26 | + windowManagement |
| 27 | + widgetDimensions |
| 28 | + |
| 29 | + img *SdlImgui |
| 30 | +} |
| 31 | + |
| 32 | +func newWinSaveKey(img *SdlImgui) (managedWindow, error) { |
| 33 | + win := &winSaveKey{ |
| 34 | + img: img, |
| 35 | + } |
| 36 | + |
| 37 | + return win, nil |
| 38 | +} |
| 39 | + |
| 40 | +func (win *winSaveKey) init() { |
| 41 | + win.widgetDimensions.init() |
| 42 | +} |
| 43 | + |
| 44 | +func (win *winSaveKey) destroy() { |
| 45 | +} |
| 46 | + |
| 47 | +func (win *winSaveKey) id() string { |
| 48 | + return winSaveKeyTitle |
| 49 | +} |
| 50 | + |
| 51 | +func (win *winSaveKey) draw() { |
| 52 | + if !win.open { |
| 53 | + return |
| 54 | + } |
| 55 | + |
| 56 | + imgui.SetNextWindowPosV(imgui.Vec2{633, 358}, imgui.ConditionFirstUseEver, imgui.Vec2{0, 0}) |
| 57 | + imgui.BeginV(winSaveKeyTitle, &win.open, imgui.WindowFlagsAlwaysAutoResize) |
| 58 | + |
| 59 | + // oscilloscope |
| 60 | + imgui.PushStyleColor(imgui.StyleColorFrameBg, win.img.cols.AudioOscBg) |
| 61 | + |
| 62 | + imgui.PushStyleColor(imgui.StyleColorPlotLines, imgui.Vec4{1.0, 0.0, 0.0, 1.0}) |
| 63 | + imgui.PlotLinesV("", win.img.lz.SaveKey.SCL, 0, "SCL", savekey.TraceLo, savekey.TraceHi, imgui.Vec2{X: 512, Y: imgui.FrameHeight() * 2}) |
| 64 | + |
| 65 | + imgui.PushStyleColor(imgui.StyleColorPlotLines, imgui.Vec4{0.0, 1.0, 0.0, 1.0}) |
| 66 | + imgui.PlotLinesV("", win.img.lz.SaveKey.SDA, 0, "SDA", savekey.TraceLo, savekey.TraceHi, imgui.Vec2{X: 512, Y: imgui.FrameHeight() * 2}) |
| 67 | + |
| 68 | + imgui.PopStyleColorV(3) |
| 69 | + |
| 70 | + imgui.End() |
| 71 | +} |
0 commit comments