#ifndef VIDMODE_LIST_HXX
#define VIDMODE_LIST_HXX
#include "Array.hxx"
#include "../emucore/m6502/src/bspf/src/bspf.hxx"
struct VideoMode {
uInt32 image_x, image_y, image_w, image_h;
uInt32 screen_w, screen_h;
uInt32 zoom;
string name;
};
class VideoModeList
{
public:
VideoModeList() : myIdx(-1) { }
void add(VideoMode mode) { myModeList.push_back(mode); }
void clear() { myModeList.clear(); }
bool isEmpty() const { return myModeList.isEmpty(); }
uInt32 size() const { return myModeList.size(); }
const VideoMode& previous()
{
--myIdx;
if(myIdx < 0) myIdx = myModeList.size() - 1;
return current();
}
const VideoMode& current() const
{
return myModeList[myIdx];
}
const VideoMode& next()
{
myIdx = (myIdx + 1) % myModeList.size();
return current();
}
void setByResolution(uInt32 width, uInt32 height)
{
myIdx = myModeList.size() - 1;
for(unsigned int i = 0; i < myModeList.size(); ++i)
{
if(width <= myModeList[i].screen_w && height <= myModeList[i].screen_h)
{
myIdx = i;
break;
}
}
}
void setByZoom(uInt32 zoom)
{
myIdx = 0;
for(unsigned int i = myModeList.size() - 1; i; --i)
{
if(myModeList[i].zoom <= zoom)
{
myIdx = i;
break;
}
}
}
private:
Common::Array<VideoMode> myModeList;
int myIdx;
};
#endif