⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gameobjects.cpp

📁 游戏编程精华02-含有几十个游戏编程例子
💻 CPP
字号:
/* Copyright (C) Bruce Dawson, 2001. 
 * All rights reserved worldwide.
 *
 * This software is provided "as is" without express or implied
 * warranties. You may freely copy and compile this source into
 * applications you distribute provided that the copyright text
 * below is included in the resulting source code, for example:
 * "Portions Copyright (C) Bruce Dawson, 2001"
 */
#include "priv_precompiled.h"

#include "gameobjects.h"
#include "imagelibrary/csbitmap.h"
#include "gamelibrary/microthreads.h"
using namespace MicroThread;

GameObject::GameObject()
	: m_pSprite(0), m_thread(0), m_x(0), m_y(0), m_deadFrames(0)
{
}

void GameObject::RenderSelf(CSBitmap* pBitmap)
{
	assert(pBitmap);
	assert(pBitmap->HasBitmap());
	if (m_pSprite)
		CompositeBitmap(pBitmap, m_pSprite, int(m_x), int(m_y));
}

static void MICROTHREADCALL RunMicroThread(void* pVoid)
{
	GameObject* pObject = (GameObject*)pVoid;
	pObject->MicroThreadProcess();
}

void GameObject::PostConstructorInit()
{
	m_thread = CreateMicroThread(RunMicroThread, this);
}

void GameObject::RunThread()
{
	SwitchToMicroThread(m_thread);
}

void GameObject::MicroThreadProcess()
{
	// Do nothing - just return.
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -