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_drag = 0;
- var ww = 0;
- var wh = 0;
- function on_size() {
- ww = window.Width;
- wh = window.Height;
- }
- var color =
- {
- background: RGB(206, 219, 213),
- frame: RGB(191, 208, 199),
- progress: RGB(188, 145, 148),
- proghead: RGB(164, 79, 85)
- };
- function on_paint(e)
- {
- e.SetTextRenderingHint(1);
- var ww = window.Width-2,
- wh = window.Height-2,
- pos = wh * (1 - Math.pow((100 + fb.Volume) / 100, 2));
- headwidth = 8;
- // Draw frame background
- e.FillSolidRect(0, 0, ww+2, wh+2, color.frame);
- // Draw background
- // e.FillSolidRect(1, 1, ww, wh, color.background);
- e.FillSolidRect(1, 1, ww, wh+1, color.progress);
- // Draw progress
- // e.FillSolidRect(1, 1, pos, wh, color.progress);
- // Draw progress head
- e.FillSolidRect(1,pos, ww, headwidth, color.proghead);
- }
- 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_drag)
- {
- var v = 1 - (y / wh);
- v = v < 0 ? 0 : (v < 1 ? v : 1);
- v = 100 * (Math.pow(v, 1 / 2) - 1);
- fb.Volume = v;
- }
- }
- function on_mouse_wheel(delta)
- {
- if (delta > 0)
- fb.VolumeUp();
- else
- fb.VolumeDown();
- }
- function on_mouse_mbtn_down(x, y) {
- fb.VolumeMute();
- }
- function on_volume_change(val)
- {
- window.Repaint();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement