示例#1
0
CGameScene::CGameScene() : time(0.0f), delay(1.5f)
{
	m_pBackground = new CBackground();
	PushScene(m_pBackground);
	m_pBoss = new CBoss();
	PushScene(m_pBoss);
	m_pBoss->SetPosition(App::WIDTH / 2 - m_pBoss->stand->width / 2 + 50, -1000);

	m_pFinalBoss = nullptr;
	m_pStandBoss = nullptr;
	m_pPlayer = new CPlayer();
	PushScene(m_pPlayer);
	m_pPlayer->SetPosition(App::WIDTH / 2 - m_pPlayer->normalAni->width / 2,
		App::HEIGHT - m_pPlayer->normalAni->height);

	m_pArrowScene = new CArrowScene();
	PushScene(m_pArrowScene);
	m_pEffectScene = new IScene();
	PushScene(m_pEffectScene);
	speed = 1.0f;

	CGSoundManager *sm = App::GetInstance()->g_pSoundManager;
	sm->AddSoundBuffer(sm->LoadWav(_T("resource/sounds/tok.wav")));
	sm->AddSoundBuffer(sm->LoadWav(_T("resource/sounds/play.wav")));
	sm->AddSoundBuffer(sm->LoadWav(_T("resource/sounds/potal.wav")));
	sm->Play(1, TRUE);

}
示例#2
0
void CGameScene::StandBossCreate()
{
	cnt = 0;
	m_pStandBoss = new CStandBoss();
	PushScene(m_pStandBoss);
	m_pStandBoss->SetPosition(App::WIDTH / 2 - m_pBoss->stand->width / 2, 0);

}
示例#3
0
Bullet::Bullet(void)
	:available(true), speed(500.f), update(true)
{
	bullet = new ZeroSprite("%s", "exresource/bullet.png");
	this->SetWidth(bullet->Width());
	this->SetHeight(bullet->Height());
	PushScene(bullet);
}
CFinalBullet::CFinalBullet()
{
	ani = new CAnimation(7.0f);
	PushScene(ani);
	ani->pushSprite("Resource/arrow/bullet.png");
	this->rotatingCenter = D3DXVECTOR2(ani->width, ani->height / 2);
	speed = 600;
}
示例#5
0
CEnemy1::CEnemy1() : time(0.f), time2(0.f), IEnemy(3)
{
	ani = new CAnimation(4.0f);
	PushScene(ani);
	ani->pushSprite("resource/enemy/fish1.png");
	ani->pushSprite("resource/enemy/fish2.png");

	width = ani->width;
	height = ani->height;
}
示例#6
0
IEnemy::IEnemy(int hp)
{
	this->hp = hp;
	font = new CFontSceneNode(10, 50);
	PushScene(font);

	char str[3];
	sprintf_s(str, 3, "%d", hp);
	font->setString(str);
	font->color = D3DCOLOR_ARGB(255, 255, 255, 255);

	width = height = 0;
}
示例#7
0
CArrow::CArrow()
{
	ani = new CAnimation(7.0f);
	PushScene(ani);
	ani->pushSprite("Resource/arrow/1.png");
	ani->pushSprite("Resource/arrow/2.png");
	ani->pushSprite("Resource/arrow/3.png");
	ani->pushSprite("Resource/arrow/2.png");

	float degree = (float)(rand() % 61 + 60);
	float radian = degree / 180.0f * D3DX_PI;
	this->rot = radian;

	this->rotatingCenter = D3DXVECTOR2(ani->width - 7, ani->height / 2);
	speed = 300.0f;
}
示例#8
0
CArrow::CArrow()
{
	ani = new CAnimation(10.0f);
	PushScene(ani);

	ani->pushSprite("Resource/arrow/1.png");
	ani->pushSprite("Resource/arrow/2.png");
	ani->pushSprite("Resource/arrow/3.png");
	ani->pushSprite("Resource/arrow/2.png");

	float degreeRand = (float)(rand() % 60 + 60);

	this->rot = degreeRand / 180.0f * D3DX_PI;
	this->rotatingCenter = D3DXVECTOR2(ani->width - 7, ani->height / 2);

	speed = rand() % 300 + 150;
}
示例#9
0
Player::Player(void)
	:scaleX(1.f), scaleY(1.f), moving(false), left(false), jumping(false), shooting(false), reversing(false),
	doubleJumping(false), smalling(false), changing(false), climbing(false), reading(false), downJumping(false),
	onBox(false), onGround(false), jumpH(600.f), JeTime(0.f), GeTime(0.f), JumpNum(0), MaxLeft(0), MaxRight(0)
{
	f = fopen("Save\\save.dat", "r");
	
	for (int i = 0; i < 7; i++)
		fscanf(f, "%d", &save[i]);

	fclose(f);

	sound = ZeroSoundMgr;
	sound->PushSound("Sound/jump.mp3", "jumpSound");
	sound->PushSound("Sound/doublejump.mp3", "djumpSound");

	normal = new ZeroSprite("Texture/Player/0.png");
	PushScene(normal);

	shoot = new ZeroSprite("Texture/Player/shooting.png");
	PushScene(shoot);

	move = new ZeroAnimation(6.0f);
	move->PushSprite("Texture/Player/1.png");
	move->PushSprite("Texture/Player/2.png");
	move->PushSprite("Texture/Player/3.png");
	move->PushSprite("Texture/Player/4.png");
	move->PushSprite("Texture/Player/5.png");
	move->PushSprite("Texture/Player/6.png");
	PushScene(move);

	fall = new ZeroSprite("Texture/Player/fall.png");
	PushScene(fall);

	jump = new ZeroSprite("Texture/Player/jump.png");
	PushScene(jump);

	jump2 = new ZeroSprite("Texture/Player/jump2.png");
	PushScene(jump2);

	read = new ZeroSprite("Texture/Player/reading.png");
	PushScene(read);

	this->SetWidth(normal->Width());
	this->SetHeight(normal->Height());
	this->SetScalingCenter(Width() / 2, Height());
	this->SetRotCenter(Width() / 2, Height() / 2);
}
示例#10
0
文件: Partner.cpp 项目: sinsang/ggdc
Partner::Partner(int _PartnerIndex) : PartnerIndex(_PartnerIndex) {
	// 프레임 수 불러오기
	string path = "Texture/Partner/"; path += _PartnerIndex + '0'; path += "/settings.ini";
	std::ifstream fi(path);
	fi >> FrameCount;
	fi.close();

	Charactor = new ZeroAnimation(FrameCount);

	for (int i = 0; i < FrameCount; i++) {
		Charactor->PushSprite("Texture/Partner/%d/Partner_%d.png", _PartnerIndex, i + 1);
	}

	PushScene(Charactor);

	this->SetWidth(Charactor->Width());
	this->SetHeight(Charactor->Height());
}
示例#11
0
Ladder::Ladder(int no)
{
	ladderNum = no;

	switch (ladderNum)
	{
	case 0:
		ladder = new ZeroSprite("Texture/Ladder/ladder0.png");
		break;

	case 1:
		ladder = new ZeroSprite("Texture/Ladder/ladder.png");
		break;
	}

	SetWidth(ladder->Width());
	SetHeight(ladder->Height());
	PushScene(ladder);
}
示例#12
0
文件: Player.cpp 项目: sinsang/ggdc
Player::Player() {
	// 프레임 수 불러오기
	string path = "Texture/Player/settings.ini";
	std::ifstream fi(path);
	fi >> FrameCount;
	fi.close();

	PlayerAnimation = new ZeroAnimation((float) FrameCount);
	for (int i = 0; i < FrameCount; i++)
		PlayerAnimation->PushSprite("Texture/Player/Player_%d.png", i + 1);

	this->SetWidth(PlayerAnimation->Width());
	this->SetHeight(PlayerAnimation->Height());

	PushScene(PlayerAnimation);

	// 초기 위치 설정
	PlayerPosX = 300;
	PlayerPosY = 400;

	Sin = 0;
	JumpToCorrectPosY = 0;
}
示例#13
0
CGameScene::CGameScene() : time(0.0f), delay(1.5f)
{
	m_pBackground = new CBackground();
	PushScene(m_pBackground);

	m_pPlayer = new CPlayer();
	PushScene(m_pPlayer);
	m_pPlayer->SetPosition( App::WIDTH/2 - m_pPlayer->normalAni->width/2,
		App::HEIGHT - m_pPlayer->normalAni->height );

	m_pArrowScene = new IScene();
	PushScene(m_pArrowScene);
	m_pEffectScene = new IScene();
	PushScene(m_pEffectScene);
	m_pEnemyScene = new IScene();
	PushScene(m_pEnemyScene);
	m_pBulletScene = new IScene();
	PushScene(m_pBulletScene);

	bulletTime = 0.f;
}
示例#14
0
文件: main.cpp 项目: ravencgg/GLMario
// int main(int argc, char* argv[])
int GameMain()
{
//    assert(argc || argv[0]); // Fixes the compiler complaining about unused values;

    GameState* game_state = CreateNewGameState("EnGen", 1600, 900);
    Renderer* renderer = game_state->renderer;
    game_state->active_scene = PushScene(&game_state->permanent_memory, MAX_GAME_ENTITES);

    TileMap* tilemap = game_state->active_scene->tilemap;

    for (int32 i = 0; i < 10; ++i)
    {
        Vec2 pos = { (float)i, 2.f };
        AddTileToMap(tilemap, pos);
    }

    for (int32 i = 0; i < 10; ++i)
    {
        Vec2 pos = { 0, (float)i };
        AddTileToMap(tilemap, pos);
    }

    for (int32 i = 0; i < 10; ++i)
    {
        Vec2 pos = { 10.f, (float)i };
        AddTileToMap(tilemap, pos);
    }

    UIWindow* ui = PushStruct(&game_state->permanent_memory, UIWindow);
    SetTitle(ui, "Editor UI!");

    SetSize(ui, { 0.1f, 0.3f, 0.2f, 0.2f }, 0.05f);

    UIWindow* ui2 = PushStruct(&game_state->permanent_memory, UIWindow);
    SetTitle(ui2, "Editor UI2!");

    SetSize(ui2, { 0.2f, 0.3f, 0.2f, 0.2f }, 0.05f);

    InitializeDebugConsole();

#if 0
    InitializeAudio();
    char* test_sound_file = "C:\\projects\\imperial_march.wav";
    bool test_sound_loaded = LoadWavFile(test_sound_file);
    if(test_sound_loaded)
    {
        printf("Loaded File\n");
    }
    PauseAudio(false);
#endif

    Camera default_camera = {}; // maybe put this in game_state?
    default_camera.position = vec2(0, 0);
    default_camera.viewport_size.x = 16;
    default_camera.viewport_size.y = 9;

    uint32 frame_count = 0;
    uint32 fps = 0;
    double last_fps_time = 0;

    bool running = true;

    while (running)
    {
        ProfileBeginFrame();
        ProfileBeginSection(Profile_Frame);
        ProfileBeginSection(Profile_Input);

        Platform_RunMessageLoop(game_state->input);

        Camera* draw_camera = game_state->active_camera ? game_state->active_camera : &default_camera;

        game_state->window.resolution = Platform_GetResolution();
        UpdateMouseWorldPosition(game_state->input, game_state->window.resolution, draw_camera->viewport_size, draw_camera->position);

        ProfileEndSection(Profile_Input);

        Vec2i mouse_pos = MousePosition(game_state->input);
        //DebugPrintf("Mouse World Position: (%.2f, %.2f)", mouse_pos.x, mouse_pos.y);
        DebugPrintf("Mouse World Position: (%d, %d)", mouse_pos.x, mouse_pos.y);
        DebugPrintf("Main Camera Position: (%.2f, %.2f)", default_camera.position.x, default_camera.position.y);


        DebugPrintf("Key Pressed: %s", IsDown(game_state->input, KeyCode_a) ? "TRUE" : "FALSE");

        if (OnDown(game_state->input, KeyCode_ESCAPE))
        {
            running = false;
            break;
        }

#if 0 // TODO: Platform layer
        if (OnDown(game_state->input, KeyCode_z))
        {
            ForceColorClear();
            SwapBuffer(game_state);
            //WindowSetScreenMode(&game_state->window, ScreenMode_Windowed);
        }
        else if (OnDown(game_state->input, KeyCode_c))
        {
            ForceColorClear();
            SwapBuffer(game_state);
            //WindowSetScreenMode(&game_state->window, ScreenMode_Borderless);
        }
#endif

        static bool draw_debug = true;
        if (OnDown(game_state->input, KeyCode_BACKQUOTE))
        {
            draw_debug = !draw_debug;
        }

        Renderer* debug_renderer = draw_debug ? renderer : 0;

        TimeBeginFrame(game_state);

        // Update the scene first, pushing draw calls if necessary.
        // Then call begin_frame which builds matrices and clears buffers;
        float current_time = CurrentTime(game_state);
        if (current_time - last_fps_time > 1.0f)
        {
            last_fps_time = current_time;
            fps = frame_count;
            frame_count = 0;
        }
        frame_count++;
        DebugPrintf("FPS: \t\t%d \tFrames: \t%d", fps, FrameCount(game_state));

        DebugControlCamera(game_state, &default_camera);

        // TODO(cgenova): separate update and render calls so that things can be set up when rendering begins;
        BeginFrame(renderer, &game_state->window);

        ProfileBeginSection(Profile_SceneUpdate);

        DebugPrintPushColor(vec4(1.0f, 0, 0, 1.0f));
        DebugPrintf("Active scene entity usage: (%d / %d)", game_state->active_scene->active_entities, MAX_GAME_ENTITES);
        DebugPrintPopColor();

        UpdateSceneEntities(game_state, game_state->active_scene);
        DrawSceneEntities(game_state->active_scene, renderer);

        ProfileEndSection(Profile_SceneUpdate);

#if 1 // Spaghetti test
        const size_t num_verts = 200;
        static SimpleVertex v[num_verts];
        static bool initialized = false;
        if (!initialized)
        {
            initialized = true;
            for (uint32 i = 0; i < num_verts; ++i)
            {
                SimpleVertex verts = {};
                verts.position = vec2((float)(i / 50.f) - 2.f, (float)i);
                verts.color = vec4(1, 1, 0, 1.f);
                v[i] = verts;
            }
        }
        else
        {
            for (uint32 i = 0; i < num_verts; ++i)
            {
                v[i].position.y = sin(CurrentTime(game_state) + i / (PI * 20));
            }
        }

        PrimitiveDrawParams spaghetti_params = {};
        spaghetti_params.line_draw_flags |= PrimitiveDraw_Smooth;
        //      spaghetti_params.line_draw_flags |= Draw_ScreenSpace;
        spaghetti_params.line_width = 0;
        DrawLine(renderer, v, num_verts, spaghetti_params);
#endif

        DrawTileMap(game_state, game_state->active_scene->tilemap);

        UpdateUIWindow(game_state, ui);
        UpdateUIWindow(game_state, ui2);

        RenderDrawBuffer(renderer, draw_camera);

        ProfileEndSection(Profile_Frame);
        ProfileEndFrame(debug_renderer, TARGET_FPS);
        DebugDrawConsole(debug_renderer);

        // NOTE:
        // For drawing Debug info, the profiling in this section will be discarded,
        // but it is only drawing text and the debug graph.
        RenderDrawBuffer(renderer, draw_camera);

        SwapBuffer(game_state);

        // TODO(cgenova): High granularity sleep function!

        ResetArena(&game_state->temporary_memory);

    }// End main loop

    return 1;
}
示例#15
0
void CRenderManager::ReplaceScene(CScene* l_Scene)
{
	PopScene();
	PushScene(l_Scene);
}
示例#16
0
文件: WPJDirector.cpp 项目: woudX/WPJ
void WPJDirector::RunWithScene(WPJScene *pScene) 
{
	PushScene(pScene);
	StartAnimation();
}
示例#17
0
void CGameScene::FinalBossCreate() {
	cnt = 0;
	m_pFinalBoss = new FinalBoss();
	PushScene(m_pFinalBoss);
	m_pFinalBoss->SetPosition(App::WIDTH / 2, 0);
}