[DEV] mac first openGL view of the exol real display

This commit is contained in:
Edouard DUPIN 2013-04-16 22:44:36 +02:00
parent a5451a9f7f
commit 80dfa5fdbf
5 changed files with 141 additions and 17 deletions

2
external/etk vendored

@ -1 +1 @@
Subproject commit 4ffe6c34272127f822d6643273a471a0074e7743
Subproject commit 7ef816f50c558c51814114a2eeb9b04fa2db3ee4

View File

@ -302,6 +302,10 @@ bool ewol::resource::Keep(const etk::UString& filename, ewol::TextureFile*& obje
if (false == filename.EndWith(".svg") ) {
size = ivec2(-1,-1);
}
#ifdef __TARGET_OS__MacOs
EWOL_WARNING("TODO : Remove this strange hack");
size = ivec2(64,64);
#endif
if (size.x()>0 && size.y()>0) {
ivec2 size2(nextP2(size.x()), nextP2(size.y()));
TmpFilename += ":";

View File

@ -0,0 +1,52 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#ifndef __C_INTERFACE_MAC_OS_H__
#define __C_INTERFACE_MAC_OS_H__
#include <etk/types.h>
#ifdef __cplusplus
extern "C" {
#endif
void eSystem_SetArchiveDir(int mode, const char* str);
void eSystem_Resize(int w, int h );
void eSystem_Move(int x, int y );
void eSystem_Hide(void);
void eSystem_Show(void);
void eSystem_SetInputMotion(int pointerID, float x, float y);
void eSystem_SetInputState(int pointerID, bool isDown, float x, float y);
void eSystem_SetMouseMotion(int pointerID, float x, float y);
void eSystem_SetMouseState(int pointerID, bool isDown, float x, float y);
/*
void eSystem_SetKeyboard(ewol::SpecialKey& special,
uniChar_t myChar,
bool isDown,
bool isARepeateKey=false);
void eSystem_SetKeyboardMove(ewol::SpecialKey& special,
ewol::keyEvent::keyboard_te move,
bool isDown,
bool isARepeateKey=false);
void eSystem_ClipBoardArrive(ewol::clipBoard::clipboardListe_te clipboardID);
*/
bool eSystem_Draw(bool displayEveryTime);
void eSystem_OpenGlContextDestroy(void);
void eSystem_OnKill(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -9,28 +9,21 @@
#import <ewol/renderer/os/gui.MacOs.OpenglView.h>
#include <OpenGL/gl.h>
#include <ewol/renderer/os/eSystemMacOSInterface.h>
static int32_t width=0, height=0;
static void drawAnObject (void)
{
glColor3f(1.0f, 0.85f, 0.35f);
glBegin(GL_TRIANGLES);
{
glVertex3f( 0.0, 0.6, 0.0);
glVertex3f( -0.2, -0.3, 0.0);
glVertex3f( 0.2, -0.3 ,0.0);
}
glEnd();
}
@implementation OpenGLView
-(void) drawRect: (NSRect) bounds
{
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
drawAnObject();
if( width!= bounds.size.width
|| height!= bounds.size.height) {
width= bounds.size.width;
height= bounds.size.height;
eSystem_Resize(width,height);
}
eSystem_Draw(true);
glFlush();
}

View File

@ -30,6 +30,81 @@
#include <mach/clock.h>
#include <mach/mach.h>
#include <ewol/renderer/os/eSystemMacOSInterface.h>
void eSystem_SetArchiveDir(int mode, const char* str)
{
eSystem::SetArchiveDir(mode, str);
}
void eSystem_Resize(int w, int h )
{
eSystem::Resize(w, h);
}
void eSystem_Move(int x, int y )
{
eSystem::Move(x, y);
}
void eSystem_Hide(void)
{
eSystem::Hide();
}
void eSystem_Show(void)
{
eSystem::Show();
}
void eSystem_SetInputMotion(int pointerID, float x, float y)
{
eSystem::SetInputMotion(pointerID, x, y);
}
void eSystem_SetInputState(int pointerID, bool isDown, float x, float y)
{
eSystem::SetInputState(pointerID, isDown, x, y);
}
void eSystem_SetMouseMotion(int pointerID, float x, float y)
{
eSystem::SetMouseMotion(pointerID, x, y);
}
void eSystem_SetMouseState(int pointerID, bool isDown, float x, float y)
{
eSystem::SetMouseState(pointerID, isDown, x, y);
}
/*
void eSystem_SetKeyboard(ewol::SpecialKey& special,
uniChar_t myChar,
bool isDown,
bool isARepeateKey=false);
void eSystem_SetKeyboardMove(ewol::SpecialKey& special,
ewol::keyEvent::keyboard_te move,
bool isDown,
bool isARepeateKey=false);
*/
/*
void eSystem_ClipBoardArrive(ewol::clipBoard::clipboardListe_te clipboardID)
{
eSystem::ClipBoardArrive(clipboardID);
}
*/
bool eSystem_Draw(bool displayEveryTime)
{
return eSystem::Draw(displayEveryTime);
}
void eSystem_OpenGlContextDestroy(void)
{
eSystem::OpenGlContextDestroy();
}
void eSystem_OnKill(void)
{
eSystem::OnKill();
}
int64_t guiInterface::GetTime(void)
{
struct timespec now;