예제 #1
0
파일: Map.cpp 프로젝트: DerBasti/DreamROSE
const position_t Map::getRespawnPoint(const size_t pos) {
	ZON* zon = mainServer->getZON(this->getId());

	ZON::EventInfo* bestRespawn = nullptr;
	for(unsigned int i=0;i<zon->getEventInfoAmount();i++) {
		if(i == pos)
			return position_t(zon->getEventInfo(i).x, zon->getEventInfo(i).y);
	}
	return position_t(0.0f, 0.0f);
}
예제 #2
0
파일: Map.cpp 프로젝트: DerBasti/DreamROSE
const position_t Map::getRespawnPoint(const char* spawnName) {
	ZON* zon = mainServer->getZON(this->getId());

	ZON::EventInfo* respawn = nullptr;
	for (unsigned int i = 0; i < zon->getEventInfoAmount(); i++) {
		if (_stricmp(zon->getEventInfo(i).name.c_str(), spawnName) == 0)
			return position_t(zon->getEventInfo(i).x, zon->getEventInfo(i).y);
	}
	return position_t(0.0f, 0.0f);
}
예제 #3
0
void GUI_PopMenu::on_mouse_move(MouseEventArgs const& e)
{
	for (std::list<GUI_Object*>::iterator Current = m_item_controls->m_items.begin(); Current != m_item_controls->m_items.end(); Current++)
	{
		if ((*Current)->check_region(MouseEventArgs(position_t(e.position.x - m_position.x, e.position.y - m_position.y), e.key, e.value)))
		{
			(*Current)->mouse_move(MouseEventArgs(position_t(e.position.x - m_position.x, e.position.y - m_position.y), e.key, e.value));
			return;
		}
	}
}
예제 #4
0
파일: Map.cpp 프로젝트: DerBasti/DreamROSE
void Map::createSectors(std::vector<std::string>& files) {
	if(files.empty())
		return;
	word_t minMaxX[2] = {0xFFFF, 0x00};
	word_t minMaxY[2] = {0xFFFF, 0x00};

	//Parse all *.ifo files to see which X/Y-Coordinates are the
	//local maxima/minima
	this->findMinMax(files, minMaxX, minMaxY);
	
	//calculate the center ((max - min) / 2) + min = IFO-X/Y
	word_t centerX = ((minMaxX[1] - minMaxX[0]) / 2) + minMaxX[0];
	word_t centerY = ((minMaxY[1] - minMaxY[0]) / 2) + minMaxY[0];
	
	//Just as precaution for having the same high and low values.
	//e.g. 30 for min and max -> 0 sectors difference.
	//Even if we get "unnecessary" sectors, it won't really take up
	//that much more memory.
	minMaxX[1]++;
	minMaxY[1]++;

	//520000 + offset from center * default_sector_size (16000)
	position_t min(520000.0f + static_cast<float>(static_cast<float>(minMaxX[0] - centerX)) * IFO::DEFAULT_SECTOR_SIZE,
				 520000.0f + static_cast<float>(static_cast<float>(minMaxY[0] - centerY)) * IFO::DEFAULT_SECTOR_SIZE
				);

	position_t max(520000.0f + static_cast<float>(static_cast<float>(minMaxX[1] - centerX)) * IFO::DEFAULT_SECTOR_SIZE,
				 520000.0f + static_cast<float>(static_cast<float>(minMaxY[1] - centerY)) * IFO::DEFAULT_SECTOR_SIZE
				);
	
	//New sector count = Default_Sector_Offsets / Custom_sector_size (8000)
	int sectorCountX = static_cast<int>((max.x - min.x) / this->getSectorWidthAndHeight())+1;
	int sectorCountY = static_cast<int>((max.y - min.y) / this->getSectorWidthAndHeight())+1;
	this->mapSectors.reserve(sectorCountX, sectorCountY);

	//Calculate all sector center positions
	for(int i=0;i<sectorCountX;i++) {
		for(int j=0;j<sectorCountY;j++) {
			float cX = min.x + i * this->getSectorWidthAndHeight();
			float cY = min.y + j * this->getSectorWidthAndHeight();

			Map::Sector* newSector = new Map::Sector();
			newSector->id = i * sectorCountY + j;
			newSector->setCenter( position_t(cX, cY) );
			
#ifdef __MAPSECTOR_DEBUG__
			newSector->mapId = this->id;
#endif
			this->mapSectors.addValue( i, j, newSector);
		}
	}
}
std::vector<position_t> Bishop::GetValidMoves() {
    std::vector<position_t> validMoves;


    //board is square
    const int maxDimension = 8;
    //Up is defined as going to 0, Down as going to maxDimension

    int modifier = 1;
    //TODO: These are 4 different functions that could be simplified by passing funciton pointers. Not right now though
    //Go down and right on board
    while ((m_position.x + modifier) < maxDimension && (m_position.y + modifier) < maxDimension){
        validMoves.push_back(position_t(m_position.x + modifier, m_position.y + modifier));
        modifier++;
    }

    modifier = 1;
    //Go down and left on board
    while ((m_position.x - modifier) >= 0 && (m_position.y + modifier) < maxDimension){
        validMoves.push_back(position_t(m_position.x - modifier, m_position.y + modifier));
        modifier++;
    }

    modifier = 1;
    //Go up and right on board
    while ((m_position.x + modifier) < maxDimension && (m_position.y - modifier) >=  0 ){
        validMoves.push_back(position_t(m_position.x + modifier, m_position.y - modifier));
        modifier++;
    }
    modifier = 1;
    //Go up and left on board
    while ((m_position.x - modifier) >= 0 && (m_position.y - modifier) >= 0 ){
        validMoves.push_back(position_t(m_position.x - modifier, m_position.y - modifier));
        modifier++;
    }

    return validMoves;
}
예제 #6
0
파일: NF1.cpp 프로젝트: poftwaresatent/sfl2
  void NF1::
  Initialize(shared_ptr<const Scan> scan,
	     double robot_radius, double goal_radius)
  {
    m_grid.reset(new grid_t(m_grid_dimension, NF1Wave::FREE));
    const size_t nscans(scan->data.size());
    for(size_t is(0); is < nscans; ++is)
      if(scan->data[is].rho >= robot_radius){
	const scan_data & gdata(scan->data[is]);
	SetGlobalDisk(*m_frame, *m_grid, position_t(gdata.globx, gdata.globy),
		      robot_radius, NF1Wave::OBSTACLE);
      }
    SetGlobalDisk(*m_frame, *m_grid, m_goal, goal_radius, NF1Wave::FREE);
    (*m_grid)[m_goal_index] = NF1Wave::GOAL;
    SetGlobalDisk(*m_frame, *m_grid, m_home, robot_radius, NF1Wave::FREE);
  }
예제 #7
0
파일: Map.cpp 프로젝트: DerBasti/DreamROSE
ZON::EventInfo* Map::getRespawn(position_t& pos) {
	ZON* zon = mainServer->getZON(this->getId());
	position_t nearestPos; float distance = 999999.9f;

	ZON::EventInfo* bestRespawn = nullptr;
	for(unsigned int i=0;i<zon->getEventInfoAmount();i++) {
		ZON::EventInfo& info = zon->getEventInfo(i);
		position_t infoPos = position_t(info.x, info.y);
		if(_stricmp(info.name.c_str(), "restore")==0) {
			if(distance > pos.distanceTo(infoPos)) {
				nearestPos = infoPos;
				distance = pos.distanceTo(infoPos);
				bestRespawn = &info;
			}
		}
	}
	return bestRespawn;
}
예제 #8
0
파일: Individual.cpp 프로젝트: inf106605/PT
void Individual::createRandomRotationsAndPositions(pieces_t &pieces)
{
	int maxValuePlusOne = (size_t)(std::sqrt(pieces.size())) + 2;
	int minValue = -maxValuePlusOne / 2;
	maxValuePlusOne += minValue;
	std::deque<position_t> remainingPositions;
	for (int i = minValue; i != maxValuePlusOne; ++i)
		for (int j = minValue; j != maxValuePlusOne; ++j)
			remainingPositions.push_back(position_t(i, j));
	arrangedPieces.reserve(pieces.size());
	for (cv::Mat &piece : pieces)
	{
		const size_t i = rand() % remainingPositions.size();
		const auto iterator = remainingPositions.begin() + i;
		arrangedPieces.push_back(ArrangedPiece{ piece, (Rotation)(rand() % 4), *iterator });
		remainingPositions.erase(iterator);
	}
}
예제 #9
0
const position_t IMU::getPosition()
{
    int16_t ax;
    int16_t ay;
    int16_t az;

    int16_t gx;
    int16_t gy;
    int16_t gz;

    // read raw accel/gyro measurements from device
    mMpu6050.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);

    Serial.print(quidToAcceleration(ax)); Serial.print('\t');
    Serial.print(quidToAcceleration(ay)); Serial.print('\t');
    Serial.print(quidToAcceleration(az)); Serial.print('\t');

    Serial.print(quidToDegree(gx)); Serial.print('\t');
    Serial.print(quidToDegree(gy)); Serial.print('\t');
    Serial.print(quidToDegree(gz)); Serial.println();

    return position_t();
}
예제 #10
0
bool WorldServer::loadTelegates(const word_t currentMapId, STBFile& warpFile, IFO& ifoFile) {
	for (unsigned int i = 0; i < ifoFile.getTelegateAmount(); i++) {
		IFOTelegate& gate = ifoFile.getTelegate(i);
		const std::string& gateName = warpFile.getRow(gate.getUnknown()).getColumn(0x02);

		word_t destMapId = warpFile.getRow(gate.getUnknown()).getColumn<WORD>(0x01);
		ZON* zone = this->zoneData.getValue(destMapId);
		ZON::EventInfo zonGate;
		try {
			//Try to find the suiting gate info (e.g. 2-way gate)
			//If found, create a proper gate
			zonGate = zone->findEventInfo(gateName);
		}
		catch (std::exception) {
			//In case there is no 2-way gate (e.g. Event-/GM-Maps)
			//Send the player to the "start"-point of the destinated map
			zonGate = zone->findEventInfo(std::string("start"));
			std::cout << "Couldn't find a suiting telegate for ZoneGate " << gateName.c_str() << "!\nSending it to the \"start\" position_t of Map " << warpFile.getRow(gate.getUnknown()).getColumn<WORD>(0x01) << "\n";
		}
		Telegate& telegate = this->teleGates.getValue(gate.getUnknown());
		telegate.init(gate.getPosition(), currentMapId, position_t(zonGate.x, zonGate.y), destMapId);
	}
	return true;
}
예제 #11
0
파일: Map.cpp 프로젝트: DerBasti/DreamROSE
Map::Sector::Sector() {
#ifdef __MAPSECTOR_LL__
	this->entitiesInSector.clear();
#endif
	this->center = position_t(520000.0f, 520000.0f);
}
예제 #12
0
void GMService::executeCommand(Player* gm, Packet& chatCommand) {
	std::string msg = std::string(chatCommand.getString(0x03)); //ClientID + char '/'
	if (msg.length() == 0)
		return;
	std::string command = msg.substr(0, msg.find(" "));
	std::string curValue = msg.substr(0, (msg.find(" ") == -1 ? msg.length() : msg.find(" ")));

#define WANTED_COMMAND(c2) (_stricmp(command.c_str(), c2)==0)
#define SPLIT() \
	msg = (msg.find(" ") == -1 ? "" : msg.substr(msg.find(" ")+1)); \
	curValue = msg.length() > 0 ? msg.substr(0, msg.find(" ")) : msg;

	SPLIT();
	if (WANTED_COMMAND("mon")) {
		dword_t monType = atoi(curValue.c_str());
		SPLIT();
		dword_t amount = atoi(curValue.c_str());
		for (unsigned int i = 0; i < amount; i++) {
			new Monster(mainServer->getNPCData(monType), mainServer->getAIData(monType), gm->getMapId(), gm->getPositionCurrent().calcNewPositionWithinRadius(amount * 20.0f));
		}
		ChatService::sendWhisper("Server", gm, "%i %s's were spawned.\n", amount, mainServer->getNPCData(monType)->getName().c_str());
	}
	else if (WANTED_COMMAND("debugmsg")) {
		if (curValue.length() == 0 || _stricmp(curValue.c_str(), "off")==0) {
			gm->setDebugMode(false);
			ChatService::sendWhisper("Server", gm, "Debug-Mode was disabled.\n");
		} 
		if (_stricmp(curValue.c_str(), "on") == 0) {
			gm->setDebugMode(true);
			ChatService::sendWhisper("Server", gm, "Debug-Mode was enabled.\n");
		}
	}
	else if (WANTED_COMMAND("where")) {
		ChatService::sendWhisper("Server", gm, "You are at %4.2f, %4.2f", gm->getPositionCurrent().x, gm->getPositionCurrent().y);
		ChatService::sendWhisper("Server", gm, "and heading towards %4.2f, %4.2f (%im per second)", gm->getPositionDest().x, gm->getPositionDest().y, gm->getMovementSpeed() / 100);
	}
	else if (WANTED_COMMAND("tele")) {
		word_t mapId = atoi(curValue.c_str()); SPLIT();
		if (mapId == 0 || mapId >= mainServer->mapData.size())
			return;
		float coordX = atoi(curValue.c_str()) * 100.0f; SPLIT();
		float coordY = atoi(curValue.c_str()) * 100.0f;

		gm->pakTelegate(mapId, position_t(coordX, coordY));
	} else if(WANTED_COMMAND("stats")) {
		ChatService::sendWhisper("Server", gm, "HP: %i/%i\n", gm->getCurrentHP(), gm->getMaxHP());
		ChatService::sendWhisper("Server", gm, "AtkPower: %i\n", gm->getAttackPower());
		ChatService::sendWhisper("Server", gm, "Defense: %i\n", gm->getDefensePhysical());
		ChatService::sendWhisper("Server", gm, "Hitrate: %i\n", gm->getHitrate());
		ChatService::sendWhisper("Server", gm, "AttackSpeed: %i\n", gm->getAttackSpeed());
		ChatService::sendWhisper("Server", gm, "AttackRange: %f\n", gm->getAttackRange());
	}
	else if (WANTED_COMMAND("level")) {
		byte_t newLevel = static_cast<BYTE>(atoi(curValue.c_str()) & 0xFF);
		if (newLevel == 0)
			newLevel = 1;
		gm->setLevel(newLevel);
	}
	else if(WANTED_COMMAND("heal")) {
		gm->setCurrentHP(gm->getMaxHP());
		gm->setCurrentMP(gm->getMaxMP());
		gm->pakUpdateLifeStats();
		ChatService::sendWhisper("Server", gm, "You were successfully healed: %i HP/ %i MP", gm->getCurrentHP(), gm->getCurrentMP());
	} else if(WANTED_COMMAND("equip")) {
		word_t itemType = atoi(curValue.c_str()); 
		if(itemType == 0 && curValue.length() > 0) {
			curValue = msg;
			for(unsigned int k=ItemType::FACE;k<=ItemType::SHIELD;k++) {
				STBFile* file = mainServer->getEquipmentSTB(k);
				for(unsigned int m=0;m<file->getRowCount();m++) {
					STBEntry& entry = file->getRow(m);
					std::string name = entry.getColumn(0x00);
					if(name.find(curValue.c_str()) != -1) {
						Item item(k, m);

						//In case the wanted item is valid (should always apply)
						if (mainServer->isValidItem(k, m)) {
							gm->addItemToInventory(item, PlayerInventory::fromItemType(item.type));
						}
						return;
					}
				}
			}
		}
		SPLIT();
	}
	else if (WANTED_COMMAND("eq_at")) {
		byte_t slot = static_cast<byte_t>(atoi(curValue.c_str())); 
		if (slot <= ItemType::PAT) {
			STBFile *file = mainServer->getEquipmentSTB(slot);
			for (word_t i = 0; i < file->getRowCount(); i++) {
				if (mainServer->isValidItem(slot, i)) {
					STBEntry& entry = file->getRow(i);
					gm->addItemToInventory(Item(slot, i), PlayerInventory::fromItemType(slot));
					ChatService::sendWhisper("Server", gm, "Equipped '%s' (Name: '%s', Type %i) in slot %i", ItemType::toString(slot), entry.getColumn(0x00).c_str(), i, PlayerInventory::fromItemType(slot));
					break;
				}
			}
		}
	}
	else if (WANTED_COMMAND("goto")) {
		bool success = false;
		if (curValue.length() > 2) {
			Player *player = nullptr;
			for (int i = 0; i < mainServer->getPlayerAmount();i++) {
				Player* p = mainServer->getGlobalPlayer(i);
				if (p != nullptr && p->getName().find(curValue) >= 0) {
					success = gm->pakTelegate(player->getMapId(), player->getPositionCurrent());
					
				}
			}
		}
		if (!success) {
			ChatService::sendWhisper("Server", gm, "Player '%s' cannot be found across the server.", curValue.c_str());
		}
	}
	else if(WANTED_COMMAND("drop")) {
		unsigned long itemType = static_cast<unsigned long>(atoi(curValue.c_str())); SPLIT();
		if(curValue.length() == 0) {
			//Drop money
			new Drop(gm, itemType, false);
		} else {
			//Drop item
			word_t itemNum = atoi(curValue.c_str()); SPLIT();
			if(itemNum == 0)
				return;
			word_t amount = curValue.length() == 0 ? 0x01 : atoi(curValue.c_str());

			Item item(static_cast<byte_t>(itemType), itemNum, 120, amount);
			if(mainServer->isValidItem(item.type, item.id))
				new Drop(gm, item, false);
		}
	}
#undef WANTED_COMMAND
#undef SPLIT
}
예제 #13
0
void Application::initialize()
{
	music = NULL;
	m_game_turn = 1;
	m_ready = false;
	m_graph = new GraphicalController();
	m_mouse = new MouseController();
	command_set_cursor(m_graph->m_cursor);
	command_set_cursor_visibility(true);

	m_GUI = new ApplicationGUI();
	m_GUI->m_position = position_t(0, 0);
	m_GUI->m_size = dimension_t(1024, 1024);
	
	key_press += std::bind(&Application::on_key_press, this, std::placeholders::_1);
	m_mouse->mouse_click += std::bind(&Application::on_mouse_click, this, std::placeholders::_1);
	m_mouse->mouse_down += std::bind(&Application::on_mouse_down, this, std::placeholders::_1);
	m_mouse->mouse_wheel += std::bind(&Application::on_mouse_wheel, this, std::placeholders::_1);
	m_mouse->mouse_move += std::bind(&Application::on_mouse_move, this, std::placeholders::_1);
	m_action_manager = new ActionManager();

	m_actions[0] = new action_move_step();
	m_actions[1] = new ActionClass_Push();
	m_actions[2] = new ActionClass_Turn();
	m_actions[3] = new Action_OpenInventory();
	m_actions[4] = new Action_CellInfo();
	m_game_object_manager.init();

	m_GUI->MapViewer = new GUI_MapViewer(this);
	m_GUI->MapViewer->m_position.x = 0;
	m_GUI->MapViewer->m_position.y = 0;
	m_GUI->MapViewer->m_size.w = 1024;
	m_GUI->MapViewer->m_size.h = 1024;
	
	m_GUI->MapViewer->m_map = new GameMap(dimension_t(200,200));
	m_GUI->MapViewer->m_map->generate_level();
	GameObject* obj = m_game_object_manager.new_object("elf");
	obj->set_tile_direction(ObjectDirection_Left);
	m_GUI->MapViewer->m_player = obj;

	int index = rand() % m_GUI->MapViewer->m_map->m_link_rooms.size();
	GameMap::block_t* room = *std::next(m_GUI->MapViewer->m_map->m_link_rooms.begin(), index);
	int rx = rand() % room->rect.w;
	int ry = rand() % room->rect.h;
	m_GUI->MapViewer->m_map->add_object(m_GUI->MapViewer->m_player, m_GUI->MapViewer->m_map->m_items[room->rect.y + ry][room->rect.x + rx]);
	rx = rand() % room->rect.w;
	ry = rand() % room->rect.h;
	m_GUI->MapViewer->m_map->add_object(Application::instance().m_game_object_manager.new_object("chest"), m_GUI->MapViewer->m_map->m_items[room->rect.y + ry][room->rect.x + rx]);

	GUI_ActionManager* AMTextBox;
	AMTextBox = new GUI_ActionManager(m_action_manager);
	AMTextBox->m_position.x = 650;
	AMTextBox->m_position.y = 710;
	AMTextBox->resize(372, 263);
	GUI_ActionPanel* ActionPanel;
	ActionPanel = new GUI_ActionPanel(2,975,898,47);
	GUI_ActionButton* ActionButton;
	ActionButton = new GUI_ActionButton();
	ActionButton->m_action = m_actions[action_e::move];
	ActionPanel->add_item_control(ActionButton);
	ActionButton = new GUI_ActionButton();
	ActionButton->m_action = m_actions[action_e::push];
	ActionPanel->add_item_control(ActionButton);
	ActionButton = new GUI_ActionButton();
	ActionButton->m_action = m_actions[action_e::turn];
	ActionPanel->add_item_control(ActionButton);
	ActionButton = new GUI_ActionButton();
	ActionButton->m_action = m_actions[action_e::open_inventory];
	ActionPanel->add_item_control(ActionButton);
	ActionButton = new GUI_ActionButton();
	ActionButton->m_action = m_actions[action_e::cell_info];
	ActionPanel->add_item_control(ActionButton);
	GUI_Layer* MenuLayer;
	MenuLayer = new GUI_Layer();
	MenuLayer->m_position.x = 0;
	MenuLayer->m_position.y = 0;
	MenuLayer->m_size.w = 1024;
	MenuLayer->m_size.h = 1024;
	GUI_TextBox* TextBox = new GUI_TextBox();
	TextBox->m_position.x = 2;
	TextBox->m_position.y = 710;
	TextBox->resize(646, 263);

	m_GUI->DescriptionBox = TextBox;

	m_GUI->Timer = new GUI_Timer(902, 975, 120, 47, 0);

	MenuLayer->add(AMTextBox);
	MenuLayer->add(ActionPanel);
	MenuLayer->add(TextBox);
	GUI_Window* MiniMap = new GUI_Window(0, 0, 400, 400, "Мини-карта");
	GUI_MiniMap* mini_map = new GUI_MiniMap(position_t(5, 30), dimension_t(MiniMap->m_size.w - 10, MiniMap->m_size.h - 35), m_GUI->MapViewer);
	MiniMap->add_item_control(mini_map);
	MenuLayer->add(m_GUI->Timer);
	MenuLayer->add(MiniMap);
	
	
	//MenuLayer->add(new GUI_Item(0, 0, 100,21, "4565656"));
	m_GUI->add(MenuLayer);
	m_GUI->add(m_GUI->MapViewer);
	m_GUI->MapViewer->m_GUI = MenuLayer;

	m_graph->set_VSync(false);
	//if (SDL_Init(SDL_INIT_AUDIO) < 0)
	//{
	//	MessageBox(NULL, "Error", "Audio", MB_OK);
	//}
	//static Uint32 wav_length; // length of our sample
	//static Uint8 *wav_buffer; // buffer containing our audio file
	//static SDL_AudioSpec wav_spec; // the specs of our piece of music
	//static Uint32 wav_length2; // length of our sample
	//static Uint8 *wav_buffer2; // buffer containing our audio file
	//static SDL_AudioSpec wav_spec2; // the specs of our piece of music
	//if (SDL_LoadWAV("C:\\ExplorersOfSaarum\\123.wav", &wav_spec, &wav_buffer, &wav_length) == NULL){
	//	MessageBox(NULL, "Error", "Audio", MB_OK);
	//}
	//if (SDL_LoadWAV("C:\\ExplorersOfSaarum\\456.wav", &wav_spec2, &wav_buffer2, &wav_length2) == NULL){
	//	MessageBox(NULL, "Error", "Audio", MB_OK);
	//}
	//wav_spec.callback = my_audio_callback;
	//wav_spec.userdata = NULL;
	//// set our global static variables
	//audio_pos = wav_buffer; // copy sound buffer
	//audio_len = wav_length; // copy file length

	///* Open the audio device */
	//if (SDL_OpenAudio(NULL, NULL) < 0){
	//	MessageBox(NULL, "Error", "Audio", MB_OK);
	//	exit(-1);
	//}

	///* Start playing */
	//SDL_PauseAudio(0);
	//SDL_Delay(900);
	//SDL_MixAudio(audio_pos, wav_buffer2, audio_len, SDL_MIX_MAXVOLUME);// mix from one buffer into another
	//// wait until we're don't playing
	///*while (audio_len > 0) {
	//}*/
	//// shut everything down
	///*SDL_CloseAudio();
	//SDL_FreeWAV(wav_buffer);*/

	int audio_rate = 44100;
	Uint16 audio_format = AUDIO_S16; /* 16-bit stereo */
	int audio_channels = 2;
	int audio_buffers = 4096;

	if (SDL_Init(SDL_INIT_AUDIO) < 0)
	{
		MessageBox(NULL, "Error", "Audio", MB_OK);
	}
	if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers)) {
		MessageBox(NULL, "Error", "Audio", MB_OK);
		exit(1);
	}
	Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
	if (music == NULL) {

		/* Actually loads up the music */
		music = Mix_LoadWAV((FileSystem::instance().m_resource_path+"Sounds\\Click.wav").c_str());

		/* This begins playing the music - the first argument is a
		pointer to Mix_Music structure, and the second is how many
		times you want it to loop (use -1 for infinite, and 0 to
		have it just play once) */
	}

	m_ready = true;
}