1
0
forked from 0ad/0ad

CInput: swapped direction of mouse-wheel scrolling.

wsdl: initialise handles such that wsdl_shutdown doesn't try to close
them if they remain unchanged.
GameSetup: made work in Atlas.
Renderer: fixed progressive loading of water textures.

This was SVN commit r2941.
This commit is contained in:
Ykkrosh 2005-10-14 21:59:08 +00:00
parent 6ff0cf4cab
commit d7996c104a
6 changed files with 32 additions and 23 deletions

View File

@ -573,14 +573,14 @@ void CInput::HandleMessage(const SGUIMessage &Message)
break;
case GUIM_MOUSE_WHEEL_DOWN:
GetScrollBar(0).ScrollMinus();
GetScrollBar(0).ScrollPlus();
// Since the scroll was changed, let's simulate a mouse movement
// to check if scrollbar now is hovered
HandleMessage(SGUIMessage(GUIM_MOUSE_MOTION));
break;
case GUIM_MOUSE_WHEEL_UP:
GetScrollBar(0).ScrollPlus();
GetScrollBar(0).ScrollMinus();
// Since the scroll was changed, let's simulate a mouse movement
// to check if scrollbar now is hovered
HandleMessage(SGUIMessage(GUIM_MOUSE_MOTION));

View File

@ -93,8 +93,8 @@ HWND hWnd = (HWND)INVALID_HANDLE_VALUE;
static DEVMODE dm; // current video mode
static HDC hDC;
static HGLRC hGLRC;
static HDC hDC = (HDC)INVALID_HANDLE_VALUE;
static HGLRC hGLRC = (HGLRC)INVALID_HANDLE_VALUE;
static int depth_bits = 24; // depth buffer size; set via SDL_GL_SetAttribute

View File

@ -793,7 +793,7 @@ void Shutdown()
# pragma optimize("", off)
#endif
void Init(int argc, char* argv[], bool setup_gfx, bool setup_gui)
void Init(int argc, char* argv[], bool setup_videomode, bool setup_gui)
{
debug_printf("INIT &argc=%p &argv=%p\n", &argc, &argv);
@ -837,7 +837,7 @@ void Init(int argc, char* argv[], bool setup_gfx, bool setup_gui)
// and fonts are set later in InitPs())
g_Console = new CConsole();
if(setup_gfx)
if(setup_videomode)
InitSDL();
// preferred video mode = current desktop settings
@ -860,7 +860,7 @@ void Init(int argc, char* argv[], bool setup_gfx, bool setup_gui)
bool windowed = false;
CFG_GET_SYS_VAL("windowed", Bool, windowed);
if (setup_gfx)
if (setup_videomode)
{
SDL_WM_SetCaption("0 A.D.", "0 A.D.");
@ -870,14 +870,14 @@ void Init(int argc, char* argv[], bool setup_gfx, bool setup_gui)
LOG(ERROR, LOG_CATEGORY, "Could not set %dx%d graphics mode: %s", g_xres, g_yres, SDL_GetError());
throw PSERROR_System_VmodeFailed();
}
uint quality = SANE_TEX_QUALITY_DEFAULT; // TODO: set value from config file
SetTextureQuality(quality);
// required by ogl_tex to detect broken gfx card/driver combos
get_gfx_info();
}
uint quality = SANE_TEX_QUALITY_DEFAULT; // TODO: set value from config file
SetTextureQuality(quality);
// required by ogl_tex to detect broken gfx card/driver combos
get_gfx_info();
oglCheck();
if(!g_Quickstart)
@ -961,7 +961,6 @@ void Init(int argc, char* argv[], bool setup_gfx, bool setup_gui)
}
#endif
if (setup_gfx)
{
TIMER(Init_renderblank);
MICROLOG(L"render blank");

View File

@ -19,4 +19,6 @@ extern void Render();
extern void Shutdown();
extern void Init(int argc, char* argv[], bool setup_gfx, bool setup_gui);
// If setup_videmode is false, it is assumed that the video mode has already
// been set up and is ready for rendering.
extern void Init(int argc, char* argv[], bool setup_videomode, bool setup_gui);

View File

@ -90,6 +90,8 @@ CRenderer::CRenderer()
m_TWaterScrollCounter=0;
m_WaterCurrentTex=0;
cur_loading_water_tex = 0;
ONCE( ScriptingInit(); );
}
@ -1462,7 +1464,6 @@ void CRenderer::UnloadAlphaMaps()
int CRenderer::LoadWaterTextures()
{
uint i;
const uint num_textures = ARRAY_SIZE(m_WaterTexture);
// yield after this time is reached. balances increased progress bar
@ -1471,26 +1472,30 @@ int CRenderer::LoadWaterTextures()
// initialize to 0 in case something fails below
// (we then abort the loop, but don't want undefined values in here)
for (i = 0; i < num_textures; i++)
m_WaterTexture[i] = 0;
if (cur_loading_water_tex == 0)
{
for (uint i = 0; i < num_textures; i++)
m_WaterTexture[i] = 0;
}
for (i = 0; i < num_textures; i++)
while (cur_loading_water_tex < num_textures)
{
char waterName[VFS_MAX_PATH];
// TODO: add a member variable and setter for this. (can't make this
// a parameter because this function is called via delay-load code)
const char* water_type = "animation2";
snprintf(waterName, ARRAY_SIZE(waterName), "art/textures/terrain/types/water/%s/water%02d.dds", water_type, i+1);
snprintf(waterName, ARRAY_SIZE(waterName), "art/textures/terrain/types/water/%s/water%02d.dds", water_type, cur_loading_water_tex+1);
Handle ht = ogl_tex_load(waterName);
if (ht <= 0)
{
LOG(ERROR, LOG_CATEGORY, "LoadWaterTextures failed on \"%s\"", waterName);
return ht;
}
m_WaterTexture[i]=ht;
m_WaterTexture[cur_loading_water_tex]=ht;
RETURN_ERR(ogl_tex_upload(ht));
LDR_CHECK_TIMEOUT(i, num_textures);
cur_loading_water_tex++;
LDR_CHECK_TIMEOUT(cur_loading_water_tex, num_textures);
}
return 0;

View File

@ -371,6 +371,9 @@ protected:
// If false, use a multipass fallback for player colors.
bool m_FastPlayerColor;
// State used by LoadWaterTextures with progressive loading
uint cur_loading_water_tex;
};