Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function RGB(r, g, b) {
- return (0xff000000 | (r << 16) | (g << 8) | (b));
- }
- var g_font = gdi.Font("Tahoma", 12, 0);
- var g_drag = 0;
- var g_hover = 0;
- var ww = 0;
- var wh = 0;
- function on_size() {
- ww = window.Width;
- wh = window.Height;
- }
- function on_paint(gr) {
- gr.SetTextRenderingHint(5);
- gr.FillGradRect(0, 0, ww, wh, 90, RGB(240, 240, 240), RGB(190, 190, 190));
- if (g_hover) {
- var volume = fb.Volume;
- var pos = window.Width * Math.pow((100+fb.Volume)/100,2);
- var txt = (Math.ceil(volume)) + "dB";
- gr.FillGradRect(0, 0, pos, wh, 90, RGB(240, 240, 240), RGB(100, 230, 100));
- gr.DrawString(txt, g_font, RGB(64, 64, 128), 0, 0, ww, wh, 0x11005000);
- }
- gr.DrawRect(0, 0, ww - 1, wh - 1, 1.0, RGB(150, 150, 150));
- }
- function on_mouse_lbtn_down(x, y) {
- g_drag = 1;
- }
- function on_mouse_lbtn_up(x, y) {
- on_mouse_move(x, y);
- g_drag = 0;
- }
- function on_mouse_move(x, y) {
- if (!g_hover) {
- g_hover = 1;
- window.Repaint();
- }
- if (g_drag) {
- var v = x / window.Width;
- v = (v<0) ? 0 : (v<1) ? v : 1;
- v = 100 * (Math.pow(v,1/2) - 1);
- if (fb.Volume != v) fb.Volume = v;
- }
- }
- function on_mouse_leave() {
- g_hover = 0;
- window.Repaint();
- }
- function on_mouse_wheel(delta) {
- if (delta > 0) fb.VolumeUp();
- else fb.VolumeDown();
- }
- function on_volume_change(val) {
- window.Repaint();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement