#pragma once
#include <GameOS\GameOS.hpp>
#include <GOSScript\GOSScriptHeaders.hpp>
#include <gosHelp\gosGmlHeaders.hpp>
#include <string.h>
//#include "Scrollbar.h"

bool WithinArea(int x, int y, rect* R);
inline DWORD LoadTex(char* Text);
//inline int GetImageWidth(DWORD TexHandle);
//inline int GetImageHeight(DWORD TexHandle);
void DrawF(rect* Area, DWORD color);	//draw fill
void DrawImage(DWORD Tex, int x, int y);


inline int GetImageHeight(DWORD TexHandle)
{
	TEXTUREPTR Tex;
	gos_LockTexture(TexHandle, 0, true, &Tex);
	gos_UnLockTexture( TexHandle );
	return Tex.Height;
}

inline int GetImageWidth(DWORD TexHandle)
{
	TEXTUREPTR Tex;
	gos_LockTexture(TexHandle, 0, true, &Tex);
	gos_UnLockTexture( TexHandle );
	return Tex.Width;
}

inline DWORD LoadTex(char* Text)
{
	DWORD Tex;
	if(!strncmp(Text+strlen(Text)-4,".avi",4))
	{
		HGOSVIDEO HGVTemp=0;
		gosVideo_CreateResourceAsTexture( &HGVTemp, &Tex, Text );
		gosVideo_SetPlayMode( HGVTemp, gosVideo_Loop );
	}
	else
	{
		Tex=gos_NewTextureFromFile( gos_Texture_Detect, Text);
	}
	return Tex;
}