Disable Canvas menubar for now
This commit is contained in:
parent
4846871a5c
commit
7651d66c38
2 changed files with 56 additions and 2 deletions
49
Nasal/canvas/ImageTest.nas
Normal file
49
Nasal/canvas/ImageTest.nas
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
var ImageTest = {
|
||||||
|
|
||||||
|
new : func()
|
||||||
|
{
|
||||||
|
var obj = {
|
||||||
|
parents : [ ImageTest ],
|
||||||
|
width : 528,
|
||||||
|
height : 528,
|
||||||
|
};
|
||||||
|
|
||||||
|
obj.window = canvas.Window.new([obj.width,obj.height],"dialog").set('title',"CanvasImageTest");
|
||||||
|
|
||||||
|
# creating the top-level/root group which will contain all other elements/group
|
||||||
|
obj.myCanvas = obj.window.createCanvas();
|
||||||
|
obj.myCanvas.set("name", "Test");
|
||||||
|
obj.root = obj.myCanvas.createGroup();
|
||||||
|
obj._slice = 17;
|
||||||
|
|
||||||
|
obj._frame =
|
||||||
|
obj.root.createChild("image", "background")
|
||||||
|
.set("src", "gui/images/tooltip.png")
|
||||||
|
.set("slice", obj._slice ~ " fill")
|
||||||
|
.setSize([obj.width,obj.height]);
|
||||||
|
|
||||||
|
obj._image = obj.root.createChild("image", "TestImage")
|
||||||
|
.setSize(500, 500);
|
||||||
|
obj._image.set("src", "gui/images/cat.png");
|
||||||
|
|
||||||
|
obj.pixelX = 0;
|
||||||
|
obj.pixelY = 0;
|
||||||
|
|
||||||
|
var t = maketimer(0.05, obj, func {
|
||||||
|
obj.pixelX += 1;
|
||||||
|
if (obj.pixelX >= obj.width) {
|
||||||
|
obj.pixelX = 0;
|
||||||
|
obj.pixelY += 1;
|
||||||
|
if (obj.pixelY >= obj.height) {
|
||||||
|
obj.pixelY = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var c = math.mod(obj.pixelX + obj.pixelY, 32) / 32.0;
|
||||||
|
me._image.setPixel(obj.pixelX, obj.pixelY, [c, (1.0 - c), c, 1.0]);
|
||||||
|
me._image.dirtyPixels();
|
||||||
|
});
|
||||||
|
t.start();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
@ -14,6 +14,7 @@ var gui = {
|
||||||
focused_window: nil,
|
focused_window: nil,
|
||||||
open_popups: [],
|
open_popups: [],
|
||||||
region_highlight: nil,
|
region_highlight: nil,
|
||||||
|
menubar: nil,
|
||||||
|
|
||||||
# Window/dialog stacking order
|
# Window/dialog stacking order
|
||||||
STACK_INDEX: {
|
STACK_INDEX: {
|
||||||
|
@ -595,7 +596,8 @@ getDesktop().addEventListener("mousedown", func {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gui.menubar = gui.MenuBar.new();
|
# disabled until this is hooked up to the PUICompat code
|
||||||
|
#gui.menubar = gui.MenuBar.new();
|
||||||
|
|
||||||
# Provide old 'Dialog' for backwards compatiblity (should be removed for 3.0)
|
# Provide old 'Dialog' for backwards compatiblity (should be removed for 3.0)
|
||||||
var Dialog = {
|
var Dialog = {
|
||||||
|
@ -607,5 +609,8 @@ var Dialog = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var unloadGUI = func() {
|
var unloadGUI = func() {
|
||||||
|
if (gui.menubar) {
|
||||||
gui.menubar.del();
|
gui.menubar.del();
|
||||||
|
gui.menubar = nil;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue