sokol: remove an absolute import

pull/8292/head
Alexander Medvednikov 2021-01-23 10:32:00 +01:00
parent d991712b3c
commit 45cc3ec664
4 changed files with 27 additions and 40 deletions

View File

@ -2863,34 +2863,31 @@ _SAPP_OBJC_RELEASE( menu_bar );
*/ */
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
// Create a child view for native rendering
CGRect wRect = _sapp.macos.window.frame; CGRect wRect = _sapp.macos.window.frame;
NSView *contentView =_sapp.macos.window.contentView; NSView *contentView =_sapp.macos.window.contentView;
CGRect cRect = contentView.frame; CGRect cRect = contentView.frame;
CGRect rect = CGRectMake(wRect.origin.x, wRect.origin.y, cRect.size.width, cRect.size.height); CGRect rect = CGRectMake(wRect.origin.x, wRect.origin.y, cRect.size.width, cRect.size.height);
NSWindow *overlayWindow = [[NSWindow alloc]initWithContentRect:rect NSWindow *overlayWindow = [[NSWindow alloc]initWithContentRect:rect
styleMask:NSBorderlessWindowMask styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered backing:NSBackingStoreBuffered
defer:NO]; defer:NO];
//overlayWindow.backgroundColor = [NSColor whiteColor]; //overlayWindow.backgroundColor = [NSColor whiteColor];
//overlayWindow.backgroundColor = [[NSColor whiteColor] colorWithAlphaComponent:0];
[overlayWindow setOpaque:YES];
[_sapp.macos.window setIgnoresMouseEvents:NO];
//[_sapp.macos.window setOpaque:NO];
//overlayWindow.alphaValue =0.1f;///.1f;
//overlayWindow.backgroundColor = [[NSColor whiteColor] colorWithAlphaComponent:0]; g_view = [[MyView2 alloc] init];
[overlayWindow setOpaque:YES]; overlayWindow.contentView = g_view;
[_sapp.macos.window setIgnoresMouseEvents:NO];
//[_sapp.macos.window setOpaque:NO];
[ contentView addSubview:g_view];
//overlayWindow.alphaValue =0.1f;///.1f;
g_view = [[MyView2 alloc] init];
overlayWindow.contentView = g_view;
[ contentView addSubview:g_view];
//[ _sapp.macos.window addChildWindow:overlayWindow ordered:NSWindowAbove]; //[ _sapp.macos.window addChildWindow:overlayWindow ordered:NSWindowAbove];
////////////////////////////////// //////////////////////////////////
@ -2913,7 +2910,8 @@ g_view = [[MyView2 alloc] init];
} }
@end @end
#include "/Users/alex/code/v/thirdparty/sokol/sokol_app2.h" //#include "/Users/alex/code/v/thirdparty/sokol/sokol_app2.h"
#include "sokol_app2.h"
@implementation _sapp_macos_window_delegate @implementation _sapp_macos_window_delegate
- (BOOL)windowShouldClose:(id)sender { - (BOOL)windowShouldClose:(id)sender {

View File

@ -396,7 +396,7 @@ pub fn is_file(path string) bool {
// is_abs_path returns `true` if `path` is absolute. // is_abs_path returns `true` if `path` is absolute.
pub fn is_abs_path(path string) bool { pub fn is_abs_path(path string) bool {
$if windows { $if windows {
return path[0] == `/` || // incase we're in MingGW bash return path[0] == `/` || // incase we're in MingGW bash
(path[0].is_letter() && path[1] == `:`) (path[0].is_letter() && path[1] == `:`)
} }
return path[0] == `/` return path[0] == `/`
@ -458,10 +458,10 @@ pub fn walk(path string, f fn (string)) {
// log will print "os.log: "+`s` ... // log will print "os.log: "+`s` ...
pub fn log(s string) { pub fn log(s string) {
//$if macos { //$if macos {
// Use NSLog() on macos // Use NSLog() on macos
//C.darwin_log(s) // C.darwin_log(s)
//} $else { //} $else {
println('os.log: ' + s) println('os.log: ' + s)
//} //}
} }

View File

@ -1,36 +1,29 @@
module c module c
pub const ( pub const (
used_import = 1 used_import = 1
) )
#flag -I @VROOT/thirdparty/sokol #flag -I @VROOT/thirdparty/sokol
#flag -I @VROOT/thirdparty/sokol/util #flag -I @VROOT/thirdparty/sokol/util
#flag freebsd -I /usr/local/include #flag freebsd -I /usr/local/include
#flag darwin -fobjc-arc #flag darwin -fobjc-arc
#flag linux -lX11 -lGL -lXcursor -lXi #flag linux -lX11 -lGL -lXcursor -lXi
#flag freebsd -L/usr/local/lib -lX11 -lGL -lXcursor -lXi #flag freebsd -L/usr/local/lib -lX11 -lGL -lXcursor -lXi
#flag windows -lgdi32 #flag windows -lgdi32
// METAL // METAL
#flag darwin -DSOKOL_METAL #flag darwin -DSOKOL_METAL
#flag darwin -framework Metal -framework Cocoa -framework MetalKit -framework QuartzCore #flag darwin -framework Metal -framework Cocoa -framework MetalKit -framework QuartzCore
// OPENGL // OPENGL
#flag linux -DSOKOL_GLCORE33 #flag linux -DSOKOL_GLCORE33
#flag freebsd -DSOKOL_GLCORE33 #flag freebsd -DSOKOL_GLCORE33
//#flag darwin -framework OpenGL -framework Cocoa -framework QuartzCore //#flag darwin -framework OpenGL -framework Cocoa -framework QuartzCore
// D3D // D3D
#flag windows -DSOKOL_GLCORE33 #flag windows -DSOKOL_GLCORE33
//#flag windows -DSOKOL_D3D11 //#flag windows -DSOKOL_D3D11
// for simplicity, all header includes are here because import order matters and we dont have any way // for simplicity, all header includes are here because import order matters and we dont have any way
// to ensure import order with V yet // to ensure import order with V yet
#define SOKOL_IMPL #define SOKOL_IMPL
// TODO should not be defined for android graphic (apk/aab using sokol) builds, but we have no ways to undefine // TODO should not be defined for android graphic (apk/aab using sokol) builds, but we have no ways to undefine
//#define SOKOL_NO_ENTRY //#define SOKOL_NO_ENTRY
#flag linux -DSOKOL_NO_ENTRY #flag linux -DSOKOL_NO_ENTRY
@ -40,14 +33,10 @@ pub const (
#flag freebsd -DSOKOL_NO_ENTRY #flag freebsd -DSOKOL_NO_ENTRY
#flag solaris -DSOKOL_NO_ENTRY #flag solaris -DSOKOL_NO_ENTRY
// TODO end // TODO end
#include "sokol_v.h" #include "sokol_v.h"
#include "sokol_app.h" #include "sokol_app.h"
#define SOKOL_IMPL #define SOKOL_IMPL
#define SOKOL_NO_DEPRECATED #define SOKOL_NO_DEPRECATED
#include "sokol_gfx.h" #include "sokol_gfx.h"
#define SOKOL_GL_IMPL #define SOKOL_GL_IMPL
#include "util/sokol_gl.h" #include "util/sokol_gl.h"

View File

@ -1964,7 +1964,7 @@ fn (mut p Parser) const_decl() ast.ConstDecl {
} }
pos := p.tok.position() pos := p.tok.position()
name := p.check_name() name := p.check_name()
if false && util.contains_capital(name) { if util.contains_capital(name) {
p.warn_with_pos('$p.file_name_dir const names cannot contain uppercase letters, use snake_case instead', p.warn_with_pos('$p.file_name_dir const names cannot contain uppercase letters, use snake_case instead',
pos) pos)
} }