Created
February 16, 2016 03:17
-
-
Save FlyingJester/9f59ecd2bb3bfd200d0c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <FL/Fl.H> | |
#include <FL/Fl_Window.H> | |
#include <FL/Fl_Single_Window.H> | |
#include <FL/Fl_Button.H> | |
#include <FL/Fl_Slider.H> | |
#include <FL/Fl_Group.H> | |
#include <FL/Fl_Box.H> | |
#include <FL/fl_draw.H> | |
#include <cstdio> | |
// This isn't needed to demo the navigation component. | |
// #include <vlc/vlc.h> | |
static const unsigned c_width = 640, c_height = 480; | |
// This isn't used just yet, but later VLC will draw into it. | |
class SlaveWindow : public Fl_Single_Window { | |
public: | |
SlaveWindow(int aw, int ah, const char *ac = nullptr); | |
virtual ~SlaveWindow(){} | |
void draw() override; | |
}; | |
SlaveWindow::SlaveWindow(int aw, int ah, const char *ac) | |
: Fl_Single_Window(aw, ah, ac){ | |
} | |
void SlaveWindow::draw(){} | |
class PhobosWindow : public Fl_Window { | |
Fl_Slider m_playbar_widget, m_volume_widget; | |
Fl_Button m_play_pause_widget, m_fast_forward_widget, m_rewind_widget; | |
Fl_Group m_video_holder_widget; | |
Fl_Box m_resize_box; | |
public: | |
PhobosWindow(int w, int h, const char *c = NULL); | |
virtual ~PhobosWindow(); | |
}; // class PhobosWindow | |
PhobosWindow::PhobosWindow(int aw, int ah, const char *ac) | |
: Fl_Window(aw, ah, ac) | |
, m_playbar_widget(4, ah-40, aw-8, 12) | |
, m_volume_widget(aw-68, ah-24, 64, 20, "Volume") | |
, m_play_pause_widget(40, ah-24, 24, 20, "@>") | |
, m_fast_forward_widget(68, ah-24, 32, 20, "@>>") | |
, m_rewind_widget(4, ah-24, 32, 20, "@<<") | |
, m_video_holder_widget(0, 0, aw, ah-40), | |
m_resize_box(0x80, 0x40, aw-0x100, ah-0x80){ | |
m_video_holder_widget.end(); | |
m_resize_box.box(FL_NO_BOX); | |
m_playbar_widget.type(FL_HOR_FILL_SLIDER); | |
m_playbar_widget.color2(0x80408000); | |
m_volume_widget.type(FL_HOR_NICE_SLIDER); | |
m_volume_widget.align(FL_ALIGN_LEFT); | |
// This makes me think this isn't the right way to do this... | |
m_play_pause_widget.shortcut(Fl::get_key(' ')); | |
m_fast_forward_widget.shortcut(FL_Right); | |
m_rewind_widget.shortcut(FL_Left); | |
resizable(m_resize_box); | |
} | |
PhobosWindow::~PhobosWindow(){} | |
// Steps to setup VLC with a toolkit: | |
// 1. Init toolkit | |
// 2. Create slave window | |
// 3. Init VLC | |
// 4. Connect VLC player to slave window | |
// 5. Load media, press play, and enjoy the ride. | |
int main(int argc, char *argv[]){ | |
// Silence Clang's crazy warnings. | |
if(argc || argv){} | |
// Just to prove to everyone which version you're using :) | |
printf("Using FLTK version %i.%i.%i\n", FL_MAJOR_VERSION, FL_MINOR_VERSION, FL_PATCH_VERSION); | |
// Create the control and holder window | |
PhobosWindow window(c_width, c_height, "Phobos Media Player"); | |
// Finish up FLTK init | |
window.show(); | |
return Fl::run(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment