27 #include "precompiled.h"
43 # define ALLOW_SYS_CURSOR 1
45 # define ALLOW_SYS_CURSOR 0
60 shared_ptr<u8> file;
size_t fileSize;
117 #warning TODO: implement cursors for GLES
120 glEnable(GL_TEXTURE_2D);
121 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
122 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
124 glDisable(GL_DEPTH_TEST);
125 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
135 glEnable(GL_DEPTH_TEST);
176 c->
forceGL = (va_arg(args,
int) != 0);
207 int hotspotx = 0, hotspoty = 0;
210 shared_ptr<u8> buf;
size_t size;
212 std::wstringstream s(std::wstring((
const wchar_t*)buf.get(), size));
213 s >> hotspotx >> hotspoty;
295 return h_alloc(H_Cursor, vfs, name, 0, (
int)forceGL);
305 return h_free(h, H_Cursor);
336 c->gl_cursor.draw(x, y);
341 if(c->gl_empty_system_cursor)
static Status Cursor_validate(const Cursor *c)
Status create(const PIVFS &vfs, const VfsPath &pathname, int hotspotx_, int hotspoty_)
Status h_free(Handle &h, H_Type type)
Path VfsPath
VFS path of the form "(dir/)*file?".
void draw(int x, int y) const
Status tex_transform_to(Tex *t, size_t new_flags)
Change <t>'s pixel format (2nd version) (note: this is equivalent to tex_transform(t, t->flags^new_flags).
Status ogl_tex_free(Handle &ht)
Release this texture reference.
Status sys_cursor_create(int w, int h, void *bgra_img, int hx, int hy, sys_cursor *cursor)
Create a cursor from the given color image.
flags & TEX_DXT is a field indicating compression.
indicates B and R pixel components are exchanged.
int swprintf_s(wchar_t *buf, size_t max_chars, const wchar_t *fmt,...) WPRINTF_ARGS(3)
Handle h_alloc(H_Type type, const PIVFS &vfs, const VfsPath &pathname, size_t flags,...)
static Handle cursor_load(const PIVFS &vfs, const VfsPath &name, bool forceGL)
Status sys_cursor_create_empty(sys_cursor *cursor)
Create a transparent cursor (used to hide the system cursor).
#define H_DEREF(h, type, var)
Status ogl_tex_bind(Handle ht, size_t unit)
Bind texture to the specified unit in preparation for using it in rendering.
#define H_TYPE_DEFINE(type)
#define UNUSED2(param)
mark a function local variable or parameter as unused and avoid the corresponding compiler warning...
Status cursor_draw(const PIVFS &vfs, const wchar_t *name, int x, int y, bool forceGL)
Draw the cursor on-screen.
static Status cursor_free(Handle &h)
static void Cursor_init(Cursor *c, va_list args)
u8 * tex_get_data(const Tex *t)
rationale: since Tex is a struct, its fields are accessible to callers.
void cursor_shutdown()
Forcibly frees all cursor handles.
i64 Status
Error handling system.
i64 Handle
`handle' representing a reference to a resource (sound, texture, etc.)
void h_mgr_free_type(const H_Type type)
Handle ogl_tex_load(const PIVFS &vfs, const VfsPath &pathname, size_t flags)
Load and return a handle to the texture.
#define DEBUG_WARN_ERR(status)
display the error dialog with text corresponding to the given error code.
Path ChangeExtension(Path extension) const
Status ogl_tex_set_filter(Handle ht, GLint filter)
Override default filter (see ogl_tex_set_defaults) for this texture.
#define WARN_RETURN(status)
Status sys_cursor_set(sys_cursor cursor)
override the current system cursor.
const size_t H_STRING_LEN
static void Cursor_dtor(Cursor *c)
Status sys_cursor_free(sys_cursor cursor)
destroy the indicated cursor and frees its resources.
static Status Cursor_to_string(const Cursor *c, wchar_t *buf)
static Status Cursor_reload(Cursor *c, const PIVFS &vfs, const VfsPath &name, Handle)
Status tex_decode(const shared_ptr< u8 > &data, size_t dataSize, Tex *t)
decode an in-memory texture file into texture object.
static Status load_sys_cursor(const PIVFS &vfs, const VfsPath &pathname, int hx, int hy, sys_cursor *cursor)
Status ogl_tex_upload(const Handle ht, GLenum fmt_ovr, int q_flags_ovr, GLint int_fmt_ovr)
Upload texture to OpenGL.
#define RETURN_STATUS_IF_ERR(expression)
Status ogl_tex_get_size(Handle ht, size_t *w, size_t *h, size_t *bpp)
Retrieve dimensions and bit depth of the texture.
sys_cursor gl_empty_system_cursor