You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
934 B
42 lines
934 B
8 years ago
|
//
|
||
|
// NSWrapper.hpp
|
||
|
// XcodeOpenCL
|
||
|
//
|
||
|
// Created by Joshua Moerman on 13/04/14.
|
||
|
//
|
||
|
//
|
||
|
|
||
|
#pragma once
|
||
|
|
||
|
#include <memory>
|
||
|
#include <functional>
|
||
|
|
||
|
#include <CoreGraphics/CoreGraphics.h>
|
||
|
|
||
|
struct GLContext;
|
||
|
struct ContextParameters{
|
||
|
GLContext & context;
|
||
|
};
|
||
|
|
||
|
struct GLViewFunctionality {
|
||
|
// All three will only be called with the current gl context already set
|
||
|
// May be called from different threads
|
||
|
std::function<void(ContextParameters)> initialize_callback;
|
||
|
std::function<void(ContextParameters)> draw_callback;
|
||
|
std::function<void(ContextParameters, CGFloat, CGFloat)> resize_callback;
|
||
|
};
|
||
|
|
||
|
// returns a GLViewFunctionality with only its draw function set.
|
||
|
GLViewFunctionality simple_draw(std::function<void()> f);
|
||
|
|
||
|
struct NSAppWrapper {
|
||
|
NSAppWrapper();
|
||
|
~NSAppWrapper();
|
||
|
|
||
|
void run();
|
||
|
void create_window(GLViewFunctionality const &);
|
||
|
|
||
|
std::unique_ptr<struct NSAppWrapperImpl> impl;
|
||
|
};
|
||
|
|