istereo2
diff src/ui.cc @ 16:1b7776cb800b
ios version done
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 01 Oct 2015 07:54:57 +0300 |
parents | 7bd4264bf74a |
children | 25d821ab1ca2 |
line diff
1.1 --- a/src/ui.cc Wed Sep 30 04:41:21 2015 +0300 1.2 +++ b/src/ui.cc Thu Oct 01 07:54:57 2015 +0300 1.3 @@ -7,15 +7,24 @@ 1.4 1.5 using namespace goatkit; 1.6 1.7 -extern int stereo; 1.8 -extern int show_opt; 1.9 -extern int use_bump; 1.10 -extern float split; 1.11 +extern "C" void ad_banner_show(void); 1.12 +extern "C" void ad_banner_hide(void); 1.13 +extern "C" void use_retina_res(int enable); 1.14 +extern "C" int using_retina_res(void); 1.15 +extern "C" int have_retina(void); 1.16 1.17 static void done_bn_handler(Widget *w, const Event &ev, void *cls); 1.18 static void stereo_cbox_handler(Widget *w, const Event &ev, void *cls); 1.19 static void bump_cbox_handler(Widget *w, const Event &ev, void *cls); 1.20 static void split_slider_handler(Widget *w, const Event &ev, void *cls); 1.21 +#ifdef IPHONE 1.22 +static void retina_cbox_handler(Widget *w, const Event &ev, void *cls); 1.23 +#endif 1.24 + 1.25 +extern int stereo; 1.26 +extern int show_opt; 1.27 +extern int use_bump; 1.28 +extern float split; 1.29 1.30 static Screen scr; 1.31 static float aspect; 1.32 @@ -28,16 +37,33 @@ 1.33 1.34 int ui_init(void) 1.35 { 1.36 - float ypos = 300; 1.37 - float vsep = 70; 1.38 - float vsz = 35; 1.39 + float ypos = 280; 1.40 + float vsep = 75; 1.41 + float vsz = 36; 1.42 1.43 - CheckBox *cbox = new CheckBox; 1.44 + CheckBox *cbox; 1.45 + 1.46 +#ifdef IPHONE 1.47 + if(have_retina()) { 1.48 + cbox = new CheckBox; 1.49 + cbox->set_position(300, ypos + vsep); 1.50 + cbox->set_size(300, vsz); 1.51 + cbox->set_text("Retina quality rendering"); 1.52 + if(using_retina_res()) { 1.53 + cbox->check(); 1.54 + } else { 1.55 + cbox->uncheck(); 1.56 + } 1.57 + cbox->set_callback(EV_CHANGE, retina_cbox_handler); 1.58 + scr.add_widget(cbox); 1.59 + } 1.60 +#endif 1.61 + 1.62 + cbox = new CheckBox; 1.63 cbox->set_position(300, ypos); 1.64 cbox->set_size(300, vsz); 1.65 cbox->set_text("Stereoscopic rendering"); 1.66 cbox->set_callback(EV_CHANGE, stereo_cbox_handler); 1.67 - //cbox->set_toggle_transition(80); 1.68 scr.add_widget(cbox); 1.69 ypos -= vsep; 1.70 1.71 @@ -67,45 +93,17 @@ 1.72 scr.add_widget(cbox); 1.73 ypos -= vsep; 1.74 1.75 - ypos -= vsep * 0.5; 1.76 + ypos -= vsep * 0.25; 1.77 Button *button = new Button; 1.78 button->set_position(450, ypos); 1.79 button->set_size(150, vsz); 1.80 - button->set_text("Done"); 1.81 + button->set_text("Ok"); 1.82 button->set_callback(EV_CLICK, done_bn_handler); 1.83 scr.add_widget(button); 1.84 ypos -= vsep; 1.85 1.86 - /* 1.87 - TextBox *text = new TextBox; 1.88 - text->set_position(300, ypos += vsep); 1.89 - text->set_size(200, 30); 1.90 - text->set_text("foo"); 1.91 - text->set_callback(EV_CHANGE, callback); 1.92 - scr.add_widget(text); 1.93 - 1.94 - CheckBox *cbox = new CheckBox; 1.95 - cbox->set_position(300, ypos += vsep); 1.96 - cbox->set_size(200, 20); 1.97 - cbox->set_text("a checkbox!"); 1.98 - cbox->set_callback(EV_CHANGE, callback); 1.99 - scr.add_widget(cbox); 1.100 - 1.101 - Slider *intslider = new Slider; 1.102 - intslider->set_position(300, ypos += vsep); 1.103 - intslider->set_size(200, 40); 1.104 - intslider->set_callback(EV_CHANGE, callback); 1.105 - intslider->set_continuous_change(false); 1.106 - intslider->set_range(0, 100.0); 1.107 - intslider->set_step(10); 1.108 - scr.add_widget(intslider); 1.109 - */ 1.110 - 1.111 scr.set_visibility_transition(400); 1.112 1.113 - // load the theme 1.114 - //add_theme_path("themes/simple"); 1.115 - 1.116 if(!(theme = get_theme("istereo"))) { 1.117 return -1; 1.118 } 1.119 @@ -120,11 +118,13 @@ 1.120 void ui_show() 1.121 { 1.122 scr.show(); 1.123 + ad_banner_show(); 1.124 } 1.125 1.126 void ui_hide() 1.127 { 1.128 scr.hide(); 1.129 + ad_banner_hide(); 1.130 } 1.131 1.132 int ui_visible() 1.133 @@ -228,3 +228,10 @@ 1.134 split = ((Slider*)w)->get_value(); 1.135 } 1.136 1.137 +#ifdef IPHONE 1.138 +static void retina_cbox_handler(Widget *w, const Event &ev, void *cls) 1.139 +{ 1.140 + use_retina_res(((CheckBox*)w)->is_checked() ? 1 : 0); 1.141 +} 1.142 +#endif 1.143 +