clean up
parent
a2ffbdefa9
commit
1981fb8186
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2010 Anton Gorenko.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien.c-types alien.strings fry byte-arrays
|
||||
USING: alien.c-types alien.strings fry byte-arrays classes.struct
|
||||
io.encodings.utf8 kernel locals math prettyprint
|
||||
gst gst.ffi glib.ffi gobject.ffi gtk gtk.ffi ;
|
||||
IN: gir.samples.lowlevel.gstreamer
|
||||
|
@ -12,7 +12,7 @@ CONSTANT: uri "http://tinyvid.tv/file/3gocxnjott7wr.ogg"
|
|||
f f gst_init
|
||||
"playbin" "player" [ utf8 string>alien ] bi@ gst_element_factory_make :> pipeline
|
||||
|
||||
GType gint64 [ heap-size ] bi@ 2 * + <byte-array> :> value
|
||||
GValue <struct> :> value
|
||||
value G_TYPE_STRING g_value_init drop
|
||||
value uri utf8 string>alien g_value_set_string
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ IN: gir.samples.lowlevel.hello-world
|
|||
frame label 120 110 gtk_fixed_put
|
||||
|
||||
button "clicked" utf8 string>alien
|
||||
[ nip "Hello! :)" utf8 string>alien gtk_label_set_text 1 ] GtkButton:clicked
|
||||
[ nip "Hello! :)" utf8 string>alien gtk_label_set_text t ] GtkButton:clicked
|
||||
label f 0 g_signal_connect_data drop
|
||||
|
||||
window ;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2010 Anton Gorenko.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien.c-types alien.strings byte-arrays
|
||||
USING: alien.c-types alien.strings byte-arrays classes.struct
|
||||
gtk glib.ffi gobject.ffi gtk.ffi io.encodings.utf8 kernel
|
||||
literals locals make math prettyprint sequences specialized-arrays
|
||||
gir.samples.lowlevel.hello-world
|
||||
|
@ -31,12 +31,12 @@ CONSTANT: samples {
|
|||
[ GTK_WIN_POS_CENTER gtk_window_set_position ] tri
|
||||
|
||||
gtk_tree_view_new :> list
|
||||
list 0 gtk_tree_view_set_headers_visible
|
||||
list f gtk_tree_view_set_headers_visible
|
||||
|
||||
gtk_cell_renderer_text_new :> renderer
|
||||
gtk_tree_view_column_new :> column
|
||||
column "Sample" utf8 string>alien gtk_tree_view_column_set_title
|
||||
column renderer 1 gtk_tree_view_column_pack_start
|
||||
column renderer t gtk_tree_view_column_pack_start
|
||||
column renderer "markup" utf8 string>alien 0 gtk_tree_view_column_add_attribute
|
||||
list column gtk_tree_view_append_column drop
|
||||
|
||||
|
@ -47,11 +47,8 @@ CONSTANT: samples {
|
|||
|
||||
store g_object_unref
|
||||
|
||||
! Временный фикс, нужно придумать что-то другое, так как нет
|
||||
! конструктора для создания GtkTreeIter
|
||||
gint gpointer [ heap-size ] bi@ 3 * + <byte-array> :> iter
|
||||
|
||||
GType gint64 [ heap-size ] bi@ 2 * + <byte-array> :> value
|
||||
GtkTreeIter <struct> :> iter
|
||||
GValue <struct> :> value
|
||||
value G_TYPE_STRING g_value_init drop
|
||||
samples [
|
||||
first2 swap [ "<big><b>" % % "</b></big>\n" % % ] "" make
|
||||
|
@ -66,8 +63,8 @@ CONSTANT: samples {
|
|||
|
||||
list "row-activated"
|
||||
utf8 string>alien
|
||||
[ list-on-row-activited ] GtkTreeView:row-activated dup .
|
||||
f f 0 g_signal_connect_data .
|
||||
[ list-on-row-activited ] GtkTreeView:row-activated
|
||||
f f 0 g_signal_connect_data drop
|
||||
|
||||
window "destroy" utf8 string>alien
|
||||
[ 2drop gtk_main_quit ] GtkObject:destroy
|
||||
|
|
|
@ -1,29 +1,27 @@
|
|||
! Copyright (C) 2010 Anton Gorenko.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien.strings gtk gobject.ffi gtk.ffi gdk.gl gtk.gl gdk.gl.ffi
|
||||
USING: alien.enums alien.strings gtk gobject.ffi gtk.ffi gdk.gl gtk.gl gdk.gl.ffi
|
||||
gtk.gl.ffi io.encodings.utf8 kernel locals math opengl.gl prettyprint ;
|
||||
IN: gir.samples.lowlevel.opengl
|
||||
|
||||
! Sample based on
|
||||
! This sample based on
|
||||
! http://code.valaide.org/content/simple-opengl-sample-using-gtkglext
|
||||
|
||||
:: on-configure ( sender event user-data -- result )
|
||||
sender gtk_widget_get_gl_context :> gl-context
|
||||
sender gtk_widget_get_gl_window :> gl-drawable
|
||||
|
||||
gl-drawable gl-context gdk_gl_drawable_gl_begin 1 =
|
||||
gl-drawable gl-context gdk_gl_drawable_gl_begin dup
|
||||
[
|
||||
0 0 200 200 glViewport
|
||||
gl-drawable gdk_gl_drawable_gl_end
|
||||
1
|
||||
]
|
||||
[ 0 ] if ;
|
||||
] when ;
|
||||
|
||||
:: on-expose ( sender event user-data -- result )
|
||||
sender gtk_widget_get_gl_context :> gl-context
|
||||
sender gtk_widget_get_gl_window :> gl-drawable
|
||||
|
||||
gl-drawable gl-context gdk_gl_drawable_gl_begin 1 =
|
||||
gl-drawable gl-context gdk_gl_drawable_gl_begin dup
|
||||
[
|
||||
GL_COLOR_BUFFER_BIT glClear
|
||||
|
||||
|
@ -41,9 +39,7 @@ IN: gir.samples.lowlevel.opengl
|
|||
[ glFlush ] if
|
||||
|
||||
gl-drawable gdk_gl_drawable_gl_end
|
||||
1
|
||||
]
|
||||
[ 0 ] if ;
|
||||
] when ;
|
||||
|
||||
:: opengl-win ( -- window )
|
||||
GTK_WINDOW_TOPLEVEL gtk_window_new :> window
|
||||
|
@ -53,12 +49,10 @@ IN: gir.samples.lowlevel.opengl
|
|||
[ 200 200 gtk_window_set_default_size ]
|
||||
[ GTK_WIN_POS_CENTER gtk_window_set_position ] tri
|
||||
|
||||
! window 1 gtk_container_set_reallocate_redraws
|
||||
|
||||
GDK_GL_MODE_RGBA GDK_GL_MODE_DOUBLE bitor
|
||||
GDK_GL_MODE_RGBA enum>number
|
||||
gdk_gl_config_new_by_mode :> gl-config
|
||||
|
||||
window gl-config f 1 GDK_GL_RGBA_TYPE
|
||||
window gl-config f t GDK_GL_RGBA_TYPE enum>number
|
||||
gtk_widget_set_gl_capability drop
|
||||
|
||||
window "configure-event" utf8 string>alien
|
||||
|
|
Loading…
Reference in New Issue