#ifndef DATA_DEF
#define DATA_DEF
#include <DxLib.h>
#include <string>
#include <vector>
#include <map>
#include "lua\lua.hpp"
#include "lua.h"
#include "graph.h"
#include "mover.h"
#include "player.h"
#include "pad.h"
class Data {
private:
int nowCount_;
int timer_;
public:
Lua lua;
Data() : nowCount_(0), timer_(0) {}
virtual ~Data() {}
MapGraph mapGraph;
Player player;
Pad pad;
virtual int open()
{
lua.open(this);
SetMainWindowText("LuaTest");
SetGraphMode(640, 480, 16);
ChangeWindowMode(TRUE);
SetOutApplicationLogValidFlag(FALSE);
if (DxLib_Init()) return -1;
SetDrawScreen(DX_SCREEN_BACK);
nowCount_ = GetNowCount();
timer_ = 0;
mapGraph.load(".\\image");
player.init(&lua);
pad.setInputPre(GetJoypadInputState(DX_INPUT_KEY_PAD1));
return 0;
}
virtual void close()
{
DxLib_End();
lua.close();
}
virtual void prev()
{
pad.setInput(GetJoypadInputState(DX_INPUT_KEY_PAD1));
}
virtual void post()
{
pad.setInputPre(pad.getInput());
while (GetNowCount() - nowCount_ < 17);
timer_++;
}
virtual void draw()
{
player.draw(&lua);
}
virtual int exec()
{
player.exec(&lua);
return 0;
}
};
#endif