From 21167c19a74d66072e9e4c57594fd0fab7179e84 Mon Sep 17 00:00:00 2001 From: slava Date: Sat, 11 Mar 2006 02:51:35 +0000 Subject: [PATCH] Minor Cocoa fixes --- examples/cocoa/opengl.factor | 25 +++++++++++++++++++++++++ examples/cocoa/speech.factor | 7 +------ 2 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 examples/cocoa/opengl.factor diff --git a/examples/cocoa/opengl.factor b/examples/cocoa/opengl.factor new file mode 100644 index 0000000000..4afe3460ad --- /dev/null +++ b/examples/cocoa/opengl.factor @@ -0,0 +1,25 @@ +IN: cocoa-opengl +USING: alien cocoa compiler io kernel math objc objc-NSObject +objc-NSOpenGLView objc-NSWindow parser sequences threads ; + +{ + { "drawRect:" "void" { "int" "int" "int" "int" } [ drop ] } +} { } +"NSOpenGLView" "FactorView" define-objc-class +"FactorView" import-objc-class + +: + NSOpenGLView [alloc] + 0 0 100 100 NSOpenGLView [defaultPixelFormat] + [initWithFrame:pixelFormat:] ; + +"OpenGL demo" 10 10 600 600 +dup + + + +[setContentView:] + +dup f [makeKeyAndOrderFront:] + +event-loop diff --git a/examples/cocoa/speech.factor b/examples/cocoa/speech.factor index 503abeb013..7ecc5d1a4d 100644 --- a/examples/cocoa/speech.factor +++ b/examples/cocoa/speech.factor @@ -1,11 +1,6 @@ ! Copyright (C) 2006 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. -! This example requires Mac OS X. It has only been tested on -! 10.4. It must be run from a Factor runtime linked against the -! Cocoa library; you can obtain one with the 'macosx-sdl' target -! in the Makefile. - IN: cocoa-speech USING: cocoa kernel objc-NSObject objc-NSSpeechSynthesizer ; @@ -13,4 +8,4 @@ USING: cocoa kernel objc-NSObject objc-NSSpeechSynthesizer ; NSSpeechSynthesizer [alloc] f [initWithVoice:] swap [startSpeakingString:] ; -"Hello from Factor" say +"Hello from Factor" say drop