fixes for mac
This commit is contained in:
@@ -16,7 +16,7 @@ bool Font::load(const char* ttf, int font_size)
|
||||
auto bitmap = std::make_unique<uint8_t[]>(w*h);
|
||||
chars.resize(num_chars);
|
||||
int ret = stbtt_BakeFontBitmap(file.m_data, 0, (float)font_size, bitmap.get(), w, h, start_char, num_chars, chars.data());
|
||||
font_tex.create(w, h, GL_LUMINANCE, bitmap.get());
|
||||
font_tex.create(w, h, GL_RED, bitmap.get());
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1482,7 +1482,7 @@ public:
|
||||
init_template("tpl-panel-brushes");
|
||||
//m_layers_container = find<NodeBorder>("layers-container");
|
||||
static auto icons = FindAllBrushes("data/Icons/");
|
||||
if (m_container = find<NodeBorder>("brushes"))
|
||||
if ((m_container = find<NodeBorder>("brushes")))
|
||||
{
|
||||
int count = 0;
|
||||
for (auto& i : icons)
|
||||
@@ -1538,6 +1538,18 @@ public:
|
||||
}
|
||||
AAssetDir_close(dir);
|
||||
#else
|
||||
DIR *dp;
|
||||
struct dirent *ep;
|
||||
dp = opendir(folder.c_str());
|
||||
|
||||
if (dp != NULL)
|
||||
{
|
||||
while (ep = readdir (dp))
|
||||
names.push_back(ep->d_name);
|
||||
closedir(dp);
|
||||
}
|
||||
else
|
||||
LOG("Couldn't open the directory: %s", folder.c_str());
|
||||
#endif
|
||||
return names;
|
||||
}
|
||||
|
||||
@@ -194,18 +194,31 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
|
||||
}
|
||||
- (void)mouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_down(0, mouseLoc.x, App::I.height - mouseLoc.y - 1);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)mouseUp:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_up(0, mouseLoc.x, App::I.height - mouseLoc.y - 1);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
- (void)mouseMoved:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
-(void)mouseDragged:(NSEvent *)theEvent
|
||||
{
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1);
|
||||
CGLUnlockContext([[self openGLContext] CGLContextObj]);
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -257,7 +270,7 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
|
||||
|
||||
auto style = NSTitledWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask;
|
||||
window = [[Window alloc] initWithContentRect:r styleMask:style backing:NSBackingStoreBuffered defer:NO];
|
||||
[window setTitle:@"hello engine - ui shapes"];
|
||||
[window setTitle:@"PanoPainter 0.1.2 alpha"];
|
||||
[window center];
|
||||
[window makeKeyAndOrderFront:controller];
|
||||
[window setContentView:view];
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
//#pragma once
|
||||
|
||||
#define USE_VBO 0
|
||||
#define USE_VBO 1
|
||||
#define USE_SAMPLER 1
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenGL/gl3.h>
|
||||
#include <sys/stat.h>
|
||||
#define LOG printf
|
||||
#define SHADER_VERSION "#version 300 es\n"
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#define LOG(M,...) printf(M"\n", ##__VA_ARGS__)
|
||||
#define SHADER_VERSION "#version 150\n"
|
||||
|
||||
#elif __ANDROID__
|
||||
#include <EGL/egl.h>
|
||||
|
||||
@@ -31,5 +31,5 @@ glm::vec3 convert_rgb2hsv(const glm::vec3 c)
|
||||
glm::vec4 q = c.r < p.x ? glm::vec4(p.xyw, c.r) : glm::vec4(c.r, p.yzx);
|
||||
float d = q.x - glm::min(q.w, q.y);
|
||||
float e = 1.0e-10f;
|
||||
return glm::vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
return glm::vec3(fabs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user