如何在xcode7中为使用C ++的设备设置多种分辨率

时间:2015-08-15 09:07:33

标签: c++ ios

这是我的iPhone 6的当前设置加上我正在尝试设置多个设备,但我是编程的新手我已经用Google搜索了许多不同的方式来让它工作但到目前为止我都没有。

Global.h

#pragma once

#define SMASHBROS_WINDOWWIDTH 2208
#define SMASHBROS_WINDOWHEIGHT 1248

Game.cpp

#include "Game.h"
#include "Global.h"
#include "Menu/TitleScreen.h"
#include "Load/InitialLoadListener.h"

namespace SmashBros
{
  Game::Game()
  {
      smashData = nullptr;
      menuLoad = nullptr;
      moduleLoad = nullptr;
      menuScreenMgr = nullptr;
      titleScreen = nullptr;
      Graphics::setDefaultFontPath("assets/fonts/arial.ttf");
  }

  Game::~Game()
  {
      if(menuScreenMgr != nullptr)
      {
          delete menuScreenMgr;
      }
      if(titleScreen != nullptr)
      {
          delete titleScreen;
      }
      if(smashData != nullptr)
      {
          delete smashData;
      }
      if(menuLoad != nullptr)
      {
          delete menuLoad;
      }
      if(moduleLoad != nullptr)
      {
          delete moduleLoad;
      }
  }

  void Game::initialize()
  {
      getWindow()->setSize(Vector2u(SMASHBROS_WINDOWWIDTH, SMASHBROS_WINDOWHEIGHT));
      getWindow()->getView()->setSize(SMASHBROS_WINDOWWIDTH, SMASHBROS_WINDOWHEIGHT);
      getWindow()->getView()->setLetterboxed(true);
      setFPS(60);
      menuLoad = new MenuLoad(*getWindow(), "assets/menu");
      moduleLoad = new ModuleLoad(*getWindow(), "assets/characters", "assets/stages");
      smashData = new SmashData(getWindow(), menuLoad, moduleLoad);
  }

  void Game::loadContent(AssetManager*assetManager)
  {
      InitialLoadListener* loadListener = new InitialLoadListener(getWindow());
      menuLoad->setLoadListener(loadListener);

      menuLoad->load();

      moduleLoad->setCharacterSelectIconMask(&menuLoad->getCharacterSelectIconMask());
      moduleLoad->setStageSelectIconMask(&menuLoad->getStageSelectIconMask());
      moduleLoad->setStageSelectPreviewMask(&menuLoad->getStageSelectPreviewMask());
      moduleLoad->load();

      delete loadListener;

      titleScreen = new Menu::TitleScreen(*smashData);
      menuScreenMgr = new ScreenManager(getWindow(), titleScreen);
  }

  void Game::unloadContent(AssetManager*assetManager)
  {
      moduleLoad->unload();
      menuLoad->unload();
  }

  void Game::update(ApplicationData appData)
  {
      appData.setAssetManager(menuLoad->getAssetManager());
      menuScreenMgr->update(appData);
  }

  void Game::draw(ApplicationData appData, Graphics graphics) const
  {
      appData.setAssetManager(menuLoad->getAssetManager());
      menuScreenMgr->draw(appData, graphics);
  }
}

0 个答案:

没有答案