diff options
-rw-r--r-- | volume.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -74,6 +74,41 @@ int incvol(int &vol,int inc){ int interact(bool &m,int &vol){ char c=cin.get(); if(c=='q'||c=='Q'||c=='\n'||c=='\r')return 1; + if(c=='0')return incvol(vol,-100); + if(c>='0'&&c<='9'){ + cout<<' '<<c; + int v=c-'0'; + c=cin.get(); + while(c!='\r'&&c!='\n'){ + if(c==27)return 0; + if(c==8){ + if(v){ + v/=10; + displayslider(m,vol); + cout<<' '<<v<<flush; + } else { + cout<<'\x07'<<flush; + } + c=cin.get(); + continue; + } + if(c<'0'||c>'9'){ + cout<<'\x07'; + c=cin.get(); + continue; + } + if(10*v+c-'0'>100){ + v=100; + displayslider(m,vol); + cout<<" 100\x07"<<flush; + } else { + v=10*v+c-'0'; + cout<<c<<flush; + } + c=cin.get(); + } + return incvol(vol,v-vol); + } if(c=='l')return incvol(vol,5); if(c=='h')return incvol(vol,-5); if(c=='k')return incvol(vol,100); |