mirror of
https://github.com/lxsang/Diya-API.git
synced 2025-04-20 07:26:45 +02:00
Text rendering iss working now
This commit is contained in:
parent
ce08ac49e2
commit
8cb2cb543a
@ -5,11 +5,10 @@ Class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{ #category : #'as yet unclassified' }
|
{ #category : #'as yet unclassified' }
|
||||||
Diya2DNode >> gltf: points [
|
Diya2DNode >> gltf: points do: block [
|
||||||
^ points collect: [ :point | |coord|
|
^ points collect: [ :point | |coord|
|
||||||
coord := self tf +* { point x. point y. 1.0 }.
|
coord := self tf +* { point x. point y. 1.0 }.
|
||||||
coord at:3 put: 0.0.
|
block value: coord first value: (coord at:2)
|
||||||
coord
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -4,9 +4,34 @@ Class {
|
|||||||
#category : #'Diya-Core'
|
#category : #'Diya-Core'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaBaseObject >> checkGLError: mark [
|
||||||
|
|err|
|
||||||
|
err := OpenGL getError.
|
||||||
|
err = 0 ifFalse:[
|
||||||
|
self stderror:mark, ': return error code ', err hex.
|
||||||
|
].
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaBaseObject >> logError: string [
|
||||||
|
self stderr nextPutAll: string; cr
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaBaseObject >> stderr [
|
DiyaBaseObject >> stderr [
|
||||||
VTermOutputDriver stderr
|
^VTermOutputDriver stderr
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaBaseObject >> stderror: string [
|
||||||
|
self stderr nextPutAll: string; nextPutAll: Character cr asString.
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaBaseObject >> stdlog: string [
|
||||||
|
self stdout nextPutAll: string;
|
||||||
|
nextPutAll: Character cr asString.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
|
@ -4,7 +4,6 @@ Class {
|
|||||||
#instVars : [
|
#instVars : [
|
||||||
'running',
|
'running',
|
||||||
'window',
|
'window',
|
||||||
'renderer',
|
|
||||||
'context',
|
'context',
|
||||||
'display',
|
'display',
|
||||||
'clock'
|
'clock'
|
||||||
@ -36,14 +35,6 @@ DiyaBoot >> createGLContext [
|
|||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #events }
|
|
||||||
DiyaBoot >> createRenderer [
|
|
||||||
renderer := window primCreateRenderer: -1 flags: SDL_RENDERER_ACCELERATED.
|
|
||||||
renderer ifNil: [ ^self error: SDL2 getErrorMessage ].
|
|
||||||
^renderer
|
|
||||||
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #events }
|
{ #category : #events }
|
||||||
DiyaBoot >> createWindow [
|
DiyaBoot >> createWindow [
|
||||||
window := SDL2 createWindow: 'Diya'
|
window := SDL2 createWindow: 'Diya'
|
||||||
@ -54,12 +45,20 @@ DiyaBoot >> createWindow [
|
|||||||
flags: SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL.
|
flags: SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL.
|
||||||
window ifNil: [ ^self error: SDL2 getErrorMessage ].
|
window ifNil: [ ^self error: SDL2 getErrorMessage ].
|
||||||
"handle fullscreen: SDL_WINDOW_FULLSCREEN."
|
"handle fullscreen: SDL_WINDOW_FULLSCREEN."
|
||||||
|
"SDL2 glSetAttribute: SDL_GL_CONTEXT_PROFILE_MASK value: SDL_GL_CONTEXT_PROFILE_ES.
|
||||||
|
SDL2 glSetAttribute: SDL_GL_CONTEXT_MAJOR_VERSION value: 2.
|
||||||
|
SDL2 glSetAttribute: SDL_GL_CONTEXT_MINOR_VERSION value: 0.
|
||||||
|
SDL2 glSetAttribute: SDL_GL_ACCELERATED_VISUAL value: 1."
|
||||||
|
"SDL2 glSetAttribute: SDL_GL_DOUBLEBUFFER value: 1.
|
||||||
|
SDL2 glSetAttribute: SDL_GL_DEPTH_SIZE value: 24."
|
||||||
|
|
||||||
^window
|
^window
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #events }
|
{ #category : #events }
|
||||||
DiyaBoot >> init [
|
DiyaBoot >> init [
|
||||||
| status |
|
| status |
|
||||||
|
SDL2 setHint: 'SDL_RENDER_DRIVER' value: 'opengles2'.
|
||||||
status := SDL2 init: SDL_INIT_EVERYTHING.
|
status := SDL2 init: SDL_INIT_EVERYTHING.
|
||||||
status = 0
|
status = 0
|
||||||
ifFalse: [ ^ self error: SDL2 getErrorMessage ].
|
ifFalse: [ ^ self error: SDL2 getErrorMessage ].
|
||||||
@ -106,9 +105,11 @@ DiyaBoot >> render [
|
|||||||
DiyaRenderer uniqueInstance root: root.
|
DiyaRenderer uniqueInstance root: root.
|
||||||
rec := root addNode: (DiyaRectangle size: 120@160 shader: GLSimpleShader uniqueInstance) at: 200 @ 200.
|
rec := root addNode: (DiyaRectangle size: 120@160 shader: GLSimpleShader uniqueInstance) at: 200 @ 200.
|
||||||
rec := root addNode: (DiyaRectangle size: 50@50 shader: GLSimpleShader uniqueInstance) at: 200 @ 500.
|
rec := root addNode: (DiyaRectangle size: 50@50 shader: GLSimpleShader uniqueInstance) at: 200 @ 500.
|
||||||
"rec rotation: (Float pi / -8.0).
|
rec rotation: (Float pi / -8.0).
|
||||||
rec scale: 1.5@1.5."
|
rec scale: 1.5@1.5.
|
||||||
text := root addNode: (DiyaText data: 'Hello,world' shader: TotoShader uniqueInstance) at: 0@0.
|
text := root addNode: (DiyaText data: 'the quick brown fox jumped over the lazy dog' shader: TotoShader uniqueInstance) at: 50@100.
|
||||||
|
text extent: 100@100.
|
||||||
|
"text rotation:(Float pi / 4.0)."
|
||||||
OpenGL viewportX: 0 Y:0 W: display w H: display h.
|
OpenGL viewportX: 0 Y:0 W: display w H: display h.
|
||||||
"TODO: maybe give node to customize this"
|
"TODO: maybe give node to customize this"
|
||||||
[ running ] whileTrue: [
|
[ running ] whileTrue: [
|
||||||
@ -182,10 +183,6 @@ DiyaBoot >> showSystemInfo [
|
|||||||
stream nextPutAll: rinfo name readString; nextPutAll:' '.
|
stream nextPutAll: rinfo name readString; nextPutAll:' '.
|
||||||
].
|
].
|
||||||
stream cr.
|
stream cr.
|
||||||
renderer ifNotNil:[
|
|
||||||
renderer primGetRendererInfo: rinfo.
|
|
||||||
stream nextPutAll: 'SDL_RENDER_DRIVER selected: '; nextPutAll: rinfo name readString; cr.
|
|
||||||
].
|
|
||||||
stream nextPutAll:'Display resolution: ';
|
stream nextPutAll:'Display resolution: ';
|
||||||
nextPutAll:display w asString;
|
nextPutAll:display w asString;
|
||||||
nextPutAll: 'x';
|
nextPutAll: 'x';
|
||||||
@ -199,12 +196,11 @@ DiyaBoot >> startx [
|
|||||||
display ifNil: [ ^self error: 'Please run #init before this method' ].
|
display ifNil: [ ^self error: 'Please run #init before this method' ].
|
||||||
self createWindow.
|
self createWindow.
|
||||||
self createGLContext.
|
self createGLContext.
|
||||||
self createRenderer.
|
SDL2 glMakeCurrent: window context: context.
|
||||||
self showSystemInfo.
|
self showSystemInfo.
|
||||||
DiyaRendererContext uniqueInstance display: display; useProjection: OrthoProjectionMatrix.
|
DiyaRendererContext uniqueInstance display: display; useProjection: OrthoProjectionMatrix.
|
||||||
self render.
|
self render.
|
||||||
context delete.
|
context delete.
|
||||||
renderer destroy.
|
|
||||||
window destroy.
|
window destroy.
|
||||||
DiyaFontManager reset.
|
DiyaFontManager reset.
|
||||||
DiyaRendererContext reset.
|
DiyaRendererContext reset.
|
||||||
|
@ -2,7 +2,7 @@ Class {
|
|||||||
#name : #DiyaFontFamily,
|
#name : #DiyaFontFamily,
|
||||||
#superclass : #DiyaBaseObject,
|
#superclass : #DiyaBaseObject,
|
||||||
#instVars : [
|
#instVars : [
|
||||||
'faces',
|
'styles',
|
||||||
'name'
|
'name'
|
||||||
],
|
],
|
||||||
#category : #'Diya-Fonts'
|
#category : #'Diya-Fonts'
|
||||||
@ -16,23 +16,13 @@ DiyaFontFamily class >> fromFace: face [
|
|||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaFontFamily >> addFace: face [
|
DiyaFontFamily >> addFace: face [
|
||||||
name ifNil: [ name := face familyName ].
|
name ifNil: [ name := face familyName ].
|
||||||
faces at: face styleName ifAbsentPut: face.
|
styles at: face styleName ifAbsentPut: (DiyaFontStyle fromFace: face).
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaFontFamily >> face: styleName [
|
|
||||||
^faces at: styleName ifAbsent: [^faces at: 'Regular']
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaFontFamily >> faces [
|
|
||||||
^ faces
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
DiyaFontFamily >> initialize [
|
DiyaFontFamily >> initialize [
|
||||||
super initialize.
|
super initialize.
|
||||||
faces := Dictionary new.
|
styles := Dictionary new.
|
||||||
name := nil
|
name := nil
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -47,6 +37,16 @@ DiyaFontFamily >> name: anObject [
|
|||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaFontFamily >> styleNames [
|
DiyaFontFamily >> style: styleName [
|
||||||
^faces keys
|
^styles at: styleName ifAbsent: [^styles at: 'Regular']
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaFontFamily >> styleNames [
|
||||||
|
^styles keys
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaFontFamily >> styles [
|
||||||
|
^ styles
|
||||||
]
|
]
|
||||||
|
@ -27,14 +27,6 @@ DiyaFontManager >> defaultFamily [
|
|||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
|
||||||
DiyaFontManager >> face: styleName from: familyName [
|
|
||||||
|family|
|
|
||||||
family := families at: familyName ifAbsent: [ self defaultFamily ].
|
|
||||||
^family face: styleName
|
|
||||||
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaFontManager >> families [
|
DiyaFontManager >> families [
|
||||||
^ families
|
^ families
|
||||||
@ -99,3 +91,11 @@ DiyaFontManager >> reset [
|
|||||||
"reset all stored faces"
|
"reset all stored faces"
|
||||||
families := Dictionary new.
|
families := Dictionary new.
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #initialization }
|
||||||
|
DiyaFontManager >> style: styleName from: familyName [
|
||||||
|
|family|
|
||||||
|
family := families at: familyName ifAbsent: [ self defaultFamily ].
|
||||||
|
^family style: styleName
|
||||||
|
|
||||||
|
]
|
||||||
|
55
Diya/DiyaFontStyle.class.st
Normal file
55
Diya/DiyaFontStyle.class.st
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
Class {
|
||||||
|
#name : #DiyaFontStyle,
|
||||||
|
#superclass : #DiyaBaseObject,
|
||||||
|
#instVars : [
|
||||||
|
'face',
|
||||||
|
'name',
|
||||||
|
'charmap'
|
||||||
|
],
|
||||||
|
#category : #'Diya-Fonts'
|
||||||
|
}
|
||||||
|
|
||||||
|
{ #category : #'instance creation' }
|
||||||
|
DiyaFontStyle class >> fromFace: aFace [
|
||||||
|
^self new face: aFace; yourself
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaFontStyle >> face [
|
||||||
|
^ face
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaFontStyle >> face: anObject [
|
||||||
|
face := anObject.
|
||||||
|
name := anObject styleName
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #initialization }
|
||||||
|
DiyaFontStyle >> initialize [
|
||||||
|
super initialize.
|
||||||
|
charmap := Dictionary new.
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #initialization }
|
||||||
|
DiyaFontStyle >> loadChar: charCode size: size [
|
||||||
|
|tex dic|
|
||||||
|
"lookup in the char map"
|
||||||
|
dic := charmap at: charCode ifAbsentPut: Dictionary new.
|
||||||
|
tex := dic at: size ifAbsentPut: [
|
||||||
|
face setPixelWidth:0 height: size.
|
||||||
|
face loadCharacter: charCode flags: (1 << 2).
|
||||||
|
OpenGLFontTex fromFace: face
|
||||||
|
].
|
||||||
|
^tex
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaFontStyle >> name [
|
||||||
|
^ name
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaFontStyle >> name: anObject [
|
||||||
|
name := anObject
|
||||||
|
]
|
@ -9,7 +9,8 @@ Class {
|
|||||||
'rotation',
|
'rotation',
|
||||||
'tf',
|
'tf',
|
||||||
'shader',
|
'shader',
|
||||||
'context'
|
'context',
|
||||||
|
'extent'
|
||||||
],
|
],
|
||||||
#pools : [
|
#pools : [
|
||||||
'OpenGLConstants',
|
'OpenGLConstants',
|
||||||
@ -18,6 +19,16 @@ Class {
|
|||||||
#category : #'Diya-Graphics'
|
#category : #'Diya-Graphics'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ #category : #'instance creation' }
|
||||||
|
DiyaNode class >> size: size [
|
||||||
|
^(self new) extent: size; yourself
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #'instance creation' }
|
||||||
|
DiyaNode class >> size: size shader:s [
|
||||||
|
^(self with:s) extent: size; yourself
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'instance creation' }
|
{ #category : #'instance creation' }
|
||||||
DiyaNode class >> with: shader [
|
DiyaNode class >> with: shader [
|
||||||
^self new shader: shader; yourself
|
^self new shader: shader; yourself
|
||||||
@ -52,11 +63,26 @@ DiyaNode >> draw [
|
|||||||
self subclassResponsibility
|
self subclassResponsibility
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaNode >> extent [
|
||||||
|
^ extent
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaNode >> extent: anObject [
|
||||||
|
extent := anObject
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'as yet unclassified' }
|
{ #category : #'as yet unclassified' }
|
||||||
DiyaNode >> gltf: points [
|
DiyaNode >> gltf: points [
|
||||||
^self subclassResponsibility
|
^self subclassResponsibility
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaNode >> height [
|
||||||
|
^ extent y
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
DiyaNode >> initialize [
|
DiyaNode >> initialize [
|
||||||
super initialize.
|
super initialize.
|
||||||
@ -144,3 +170,8 @@ DiyaNode >> tf [
|
|||||||
DiyaNode >> updateTF [
|
DiyaNode >> updateTF [
|
||||||
self subclassResponsibility
|
self subclassResponsibility
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
DiyaNode >> wdith [
|
||||||
|
^ extent x
|
||||||
|
]
|
||||||
|
@ -1,22 +1,9 @@
|
|||||||
Class {
|
Class {
|
||||||
#name : #DiyaRectangle,
|
#name : #DiyaRectangle,
|
||||||
#superclass : #Diya2DNode,
|
#superclass : #Diya2DNode,
|
||||||
#instVars : [
|
|
||||||
'size'
|
|
||||||
],
|
|
||||||
#category : #'Diya-Graphics'
|
#category : #'Diya-Graphics'
|
||||||
}
|
}
|
||||||
|
|
||||||
{ #category : #'as yet unclassified' }
|
|
||||||
DiyaRectangle class >> size: s [
|
|
||||||
^(self new) size:s; yourself
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #'as yet unclassified' }
|
|
||||||
DiyaRectangle class >> size: size shader:s [
|
|
||||||
^(self with:s) size: size; yourself
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaRectangle >> draw [
|
DiyaRectangle >> draw [
|
||||||
self transformDo:[:i :e|
|
self transformDo:[:i :e|
|
||||||
@ -42,26 +29,18 @@ DiyaRectangle >> draw [
|
|||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaRectangle >> initialize [
|
DiyaRectangle >> initialize [
|
||||||
super initialize.
|
super initialize.
|
||||||
self size:10@10.
|
self extent:10@10.
|
||||||
translation := nil.
|
translation := nil.
|
||||||
children := nil
|
children := nil
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaRectangle >> size [
|
|
||||||
^ size
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
|
||||||
DiyaRectangle >> size: anObject [
|
|
||||||
size := anObject.
|
|
||||||
]
|
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaRectangle >> transformDo: block [
|
DiyaRectangle >> transformDo: block [
|
||||||
|i|
|
|i|
|
||||||
i := 1.
|
i := 1.
|
||||||
(self gltf: { 0.0@0.0. 0.0@ (size y). size. (size x) @0. }) do:[:p|
|
self gltf: { 0.0@0.0. 0.0@ (extent y). extent. (extent x) @0. } do:[:x :y|
|
||||||
p do: [ :e|
|
block value: i value:x.
|
||||||
block value:i value:e. i := i+1]].
|
block value: i + 1 value: y.
|
||||||
|
block value: i + 2 value: 0.0.
|
||||||
|
i := i+3].
|
||||||
]
|
]
|
||||||
|
@ -53,9 +53,9 @@ DiyaRendererContext >> initialize [
|
|||||||
vao bind.
|
vao bind.
|
||||||
vbo bind: GL_ARRAY_BUFFER.
|
vbo bind: GL_ARRAY_BUFFER.
|
||||||
projection := Array2D identity: 4.
|
projection := Array2D identity: 4.
|
||||||
buffer := FFIExternalArray externalNewType: GLfloat size: 128.
|
buffer := FFIExternalArray externalNewType: GLfloat size: 32.
|
||||||
buffer autoRelease.
|
buffer autoRelease.
|
||||||
vbo data: GL_ARRAY_BUFFER data: nil size:512 usage: GL_DYNAMIC_DRAW.
|
vbo data: GL_ARRAY_BUFFER data: nil size:128 usage: GL_DYNAMIC_DRAW.
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@ Class {
|
|||||||
'fontStyle',
|
'fontStyle',
|
||||||
'fontSize',
|
'fontSize',
|
||||||
'fontName',
|
'fontName',
|
||||||
'data'
|
'data',
|
||||||
|
'style'
|
||||||
],
|
],
|
||||||
#pools : [
|
#pools : [
|
||||||
'FT2Types'
|
'FT2Types'
|
||||||
@ -35,30 +36,25 @@ DiyaText >> data: anObject [
|
|||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaText >> draw [
|
DiyaText >> draw [
|
||||||
|face offset|
|
| offset|
|
||||||
data ifNil: [ ^self ].
|
data ifNil: [ ^self ].
|
||||||
offset := 100.0@100.0.
|
offset := 0.0@0.0.
|
||||||
OpenGL enable: GL_CULL_FACE.
|
OpenGL enable: GL_CULL_FACE.
|
||||||
OpenGL enable: GL_BLEND.
|
OpenGL enable: GL_BLEND.
|
||||||
|
OpenGL enable: GL_TEXTURE_2D.
|
||||||
OpenGL blendFnWithSfactor: GL_SRC_ALPHA dfactor: GL_ONE_MINUS_SRC_ALPHA.
|
OpenGL blendFnWithSfactor: GL_SRC_ALPHA dfactor: GL_ONE_MINUS_SRC_ALPHA.
|
||||||
self shader use.
|
self shader use.
|
||||||
self shader setUniform: #u_time value: DiyaClock uniqueInstance elapsedTime asFloat.
|
self shader setUniform: #u_time value: DiyaClock uniqueInstance elapsedTime asFloat.
|
||||||
self shader setUniform: #u_projection value: context projection buffer.
|
self shader setUniform: #u_projection value: context projection buffer.
|
||||||
self shader setUniform: #u_texture value: 0.
|
self shader setUniform: #u_texture value: 0.
|
||||||
self shader setUniform: #u_resolution value: { context resolution x. context resolution y }.
|
self shader setUniform: #u_resolution value: { context resolution x. context resolution y }.
|
||||||
context mouse ifNotNil: [
|
style := DiyaFontManager uniqueInstance style: self fontStyle from: self fontName.
|
||||||
"in shader, window origin is bottom left conor of the window
|
|
||||||
the mouse position should be transformed to this coodinate"
|
|
||||||
shader setUniform: #u_mouse value: { context mouse x. context resolution y - context mouse y }.
|
|
||||||
].
|
|
||||||
face := DiyaFontManager uniqueInstance face: self fontStyle from: self fontName.
|
|
||||||
"set fontsize"
|
|
||||||
face setPixelWidth:0 height: self fontSize.
|
|
||||||
OpenGL pixelstorei: GL_UNPACK_ALIGNMENT param: 1.
|
OpenGL pixelstorei: GL_UNPACK_ALIGNMENT param: 1.
|
||||||
"configure vao vbo for texture QUAD"
|
"configure vao vbo for texture QUAD"
|
||||||
|
context texture0 active.
|
||||||
context vao enableAttribute: 0.
|
context vao enableAttribute: 0.
|
||||||
OpenGLVertexArray vertexAttributePointerIndex: 0 size:4 type: GL_FLOAT normalized: GL_FALSE stride: 16 pointer: nil .
|
OpenGLVertexArray vertexAttributePointerIndex: 0 size:4 type: GL_FLOAT normalized: GL_FALSE stride: 16 pointer: nil .
|
||||||
data do:[:c | self drawCharacter: c at: offset with: face.].
|
data do:[:c | self drawCharacter: c at: offset].
|
||||||
context vao disableAttribute: 0.
|
context vao disableAttribute: 0.
|
||||||
"reset value"
|
"reset value"
|
||||||
OpenGL pixelstorei: GL_UNPACK_ALIGNMENT param: 4.
|
OpenGL pixelstorei: GL_UNPACK_ALIGNMENT param: 4.
|
||||||
@ -68,46 +64,46 @@ DiyaText >> draw [
|
|||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaText >> drawCharacter: c at: offset with: face [
|
DiyaText >> drawCharacter: c at: offset [
|
||||||
|tex2D|
|
|tex2D|
|
||||||
face loadCharacter: c asciiValue flags: (1 << 2) "FT_LOAD_RENDER".
|
tex2D := style loadChar: c asciiValue size: self fontSize.
|
||||||
tex2D := OpenGLTexImage2D new target: GL_TEXTURE_2D;
|
|
||||||
level: 0;
|
|
||||||
internalFormat: GL_RED;
|
|
||||||
width: face glyph width;
|
|
||||||
height: face glyph height;
|
|
||||||
border: 0;
|
|
||||||
format: GL_RED;
|
|
||||||
type: GL_UNSIGNED_BYTE;
|
|
||||||
data: (FTFaceRec fromHandle: face getHandle) glyph bitmap buffer;
|
|
||||||
yourself.
|
|
||||||
context texture0 setImage2D: tex2D.
|
context texture0 setImage2D: tex2D.
|
||||||
OpenGLTexture parameteri: GL_TEXTURE_2D pname: GL_TEXTURE_WRAP_S param: GL_CLAMP_TO_EDGE.
|
OpenGLTexture parameteri: GL_TEXTURE_2D pname: GL_TEXTURE_WRAP_S param: GL_CLAMP_TO_EDGE.
|
||||||
OpenGLTexture parameteri: GL_TEXTURE_2D pname: GL_TEXTURE_WRAP_T param: GL_CLAMP_TO_EDGE.
|
OpenGLTexture parameteri: GL_TEXTURE_2D pname: GL_TEXTURE_WRAP_T param: GL_CLAMP_TO_EDGE.
|
||||||
OpenGLTexture parameteri: GL_TEXTURE_2D pname: GL_TEXTURE_MIN_FILTER param: GL_LINEAR.
|
OpenGLTexture parameteri: GL_TEXTURE_2D pname: GL_TEXTURE_MIN_FILTER param: GL_LINEAR.
|
||||||
OpenGLTexture parameteri: GL_TEXTURE_2D pname: GL_TEXTURE_MAG_FILTER param: GL_LINEAR.
|
OpenGLTexture parameteri: GL_TEXTURE_2D pname: GL_TEXTURE_MAG_FILTER param: GL_LINEAR.
|
||||||
"fill the buffer"
|
"fill the buffer"
|
||||||
self fillVerticesBuffer: context buffer at: offset with: face.
|
((offset x > extent x) and: (tex2D width > 0)) ifTrue:[
|
||||||
|
offset setX: 0.0 setY: (offset y )- (tex2D linespace * (self scale y)).].
|
||||||
|
self fillVerticesBuffer: context buffer at: offset tex: tex2D.
|
||||||
context vbo subData: GL_ARRAY_BUFFER offset: 0 data: context buffer.
|
context vbo subData: GL_ARRAY_BUFFER offset: 0 data: context buffer.
|
||||||
OpenGL drawArrays: GL_TRIANGLES first:0 count:6.
|
OpenGL drawArrays: GL_TRIANGLES first:0 count:6.
|
||||||
offset setX: (offset x + ((face glyph advanceX )* (self scale x)) ) setY: offset y.
|
offset setX: (offset x + ((tex2D advance x )* (self scale x)) ) setY: offset y.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaText >> fillVerticesBuffer: buffer at: offset with: face [
|
DiyaText >> fillVerticesBuffer: buffer at: offset tex: tex [
|
||||||
|x y w h i|
|
|x y w h i uvs|
|
||||||
x := offset x + ((face glyph hBearingX )*(self scale x)).
|
x := offset x + ((tex bearing x )*(self scale x)).
|
||||||
y := offset y - (((face glyph height) - (face glyph hBearingY))*(self scale y)).
|
y := offset y - (((tex height) - (tex bearing y))*(self scale y)).
|
||||||
w := (face glyph width)*(self scale x).
|
w := (tex width)*(self scale x).
|
||||||
h := (face glyph height)*(self scale y).
|
h := (tex height)*(self scale y).
|
||||||
i := 1.
|
i := 1.
|
||||||
{x. y + h. 0.0. 0.0.
|
uvs := { 0@0. 0@1. 1@1. 0@0. 1@1. 1@0 }.
|
||||||
|
self gltf:{x@(y+h). x@y. (x+w)@y. x@(y+h). (x+w)@y. (x+w)@(y+h). } do:[:cx :cy| |uv|
|
||||||
|
uv := uvs at: ((i -1)/4) + 1.
|
||||||
|
buffer at:i put: cx.
|
||||||
|
buffer at: i +1 put: cy.
|
||||||
|
buffer at: i + 2 put: uv x.
|
||||||
|
buffer at: i + 3 put: uv y.
|
||||||
|
i := i+4.
|
||||||
|
].
|
||||||
|
"{x. y + h. 0.0. 0.0.
|
||||||
x. y. 0.0. 1.0.
|
x. y. 0.0. 1.0.
|
||||||
x + w. y. 1.0. 1.0.
|
x + w. y. 1.0. 1.0.
|
||||||
x. y + h. 0.0. 0.0.
|
x. y + h. 0.0. 0.0.
|
||||||
x + w. y. 1.0. 1.0.
|
x + w. y. 1.0. 1.0.
|
||||||
x + w. y + h. 1.0. 0.0. }
|
x + w. y + h. 1.0. 0.0. }"
|
||||||
do: [ :e| buffer at:i put:e. i := i+1 ]
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -117,7 +113,7 @@ DiyaText >> fontName [
|
|||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaText >> fontName: anObject [
|
DiyaText >> fontName: anObject [
|
||||||
fontName := anObject
|
fontName := anObject.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -127,7 +123,7 @@ DiyaText >> fontSize [
|
|||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaText >> fontSize: anObject [
|
DiyaText >> fontSize: anObject [
|
||||||
fontSize := anObject
|
fontSize := anObject.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -137,14 +133,14 @@ DiyaText >> fontStyle [
|
|||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
DiyaText >> fontStyle: anObject [
|
DiyaText >> fontStyle: anObject [
|
||||||
fontStyle := anObject
|
fontStyle := anObject.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
DiyaText >> initialize [
|
DiyaText >> initialize [
|
||||||
super initialize.
|
super initialize.
|
||||||
fontStyle := 'Regular'.
|
self fontName: 'Ubuntu'.
|
||||||
fontName := 'Ubuntu'.
|
self fontStyle: 'Regular'.
|
||||||
fontSize := 40.
|
self fontSize: 14.
|
||||||
data := nil.
|
data := nil.
|
||||||
]
|
]
|
||||||
|
@ -63,6 +63,11 @@ OpenGL class >> end [
|
|||||||
^ self ffiCall: #(void glEnd( void ))
|
^ self ffiCall: #(void glEnd( void ))
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'as yet unclassified' }
|
||||||
|
OpenGL class >> getError [
|
||||||
|
^self ffiCall: #(GLenum glGetError( void))
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #'as yet unclassified' }
|
{ #category : #'as yet unclassified' }
|
||||||
OpenGL class >> getIntegerv: pname data: data [
|
OpenGL class >> getIntegerv: pname data: data [
|
||||||
^self ffiCall: #(void glGetIntegerv( GLenum pname,GLint * data))
|
^self ffiCall: #(void glGetIntegerv( GLenum pname,GLint * data))
|
||||||
|
@ -38,6 +38,7 @@ Class {
|
|||||||
'GL_LINE_LOOP',
|
'GL_LINE_LOOP',
|
||||||
'GL_LINE_STRIP',
|
'GL_LINE_STRIP',
|
||||||
'GL_LINK_STATUS',
|
'GL_LINK_STATUS',
|
||||||
|
'GL_MAX_TEXTURE_SIZE',
|
||||||
'GL_ONE_MINUS_SRC_ALPHA',
|
'GL_ONE_MINUS_SRC_ALPHA',
|
||||||
'GL_PACK_ALIGNMENT',
|
'GL_PACK_ALIGNMENT',
|
||||||
'GL_POINTS',
|
'GL_POINTS',
|
||||||
@ -45,6 +46,7 @@ Class {
|
|||||||
'GL_QUADS',
|
'GL_QUADS',
|
||||||
'GL_QUAD_STRIP',
|
'GL_QUAD_STRIP',
|
||||||
'GL_RED',
|
'GL_RED',
|
||||||
|
'GL_RGB',
|
||||||
'GL_SHADER_SOURCE_LENGTH',
|
'GL_SHADER_SOURCE_LENGTH',
|
||||||
'GL_SHADER_TYPE',
|
'GL_SHADER_TYPE',
|
||||||
'GL_SHORT',
|
'GL_SHORT',
|
||||||
@ -103,7 +105,8 @@ OpenGLConstants class >> initCommonConstants [
|
|||||||
GL_RED := 16r1903.
|
GL_RED := 16r1903.
|
||||||
GL_BLUE := 16r1905.
|
GL_BLUE := 16r1905.
|
||||||
GL_GREEN := 16r1904.
|
GL_GREEN := 16r1904.
|
||||||
GL_ALPHA := 16r1903.
|
GL_ALPHA := 16r1906.
|
||||||
|
GL_RGB := 16r1907.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'class initialization' }
|
{ #category : #'class initialization' }
|
||||||
@ -166,6 +169,7 @@ OpenGLConstants class >> initTextureConstants [
|
|||||||
GL_TEXTURE_MAG_FILTER := 16r2800.
|
GL_TEXTURE_MAG_FILTER := 16r2800.
|
||||||
GL_LINEAR := 16r2601.
|
GL_LINEAR := 16r2601.
|
||||||
GL_TEXTURE_UNIT_BASE := 16r84C0.
|
GL_TEXTURE_UNIT_BASE := 16r84C0.
|
||||||
|
GL_MAX_TEXTURE_SIZE := 16r0D33
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
71
Diya/OpenGLFontTex.class.st
Normal file
71
Diya/OpenGLFontTex.class.st
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
Class {
|
||||||
|
#name : #OpenGLFontTex,
|
||||||
|
#superclass : #OpenGLTexImage2D,
|
||||||
|
#instVars : [
|
||||||
|
'bearing',
|
||||||
|
'advance',
|
||||||
|
'linespace'
|
||||||
|
],
|
||||||
|
#pools : [
|
||||||
|
'OpenGLConstants',
|
||||||
|
'OpenGLTypes'
|
||||||
|
],
|
||||||
|
#category : #'Diya-Fonts'
|
||||||
|
}
|
||||||
|
|
||||||
|
{ #category : #'instance creation' }
|
||||||
|
OpenGLFontTex class >> fromFace: face [
|
||||||
|
^self new fromFace: face; yourself
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
OpenGLFontTex >> advance [
|
||||||
|
^ advance
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
OpenGLFontTex >> advance: anObject [
|
||||||
|
advance := anObject
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
OpenGLFontTex >> bearing [
|
||||||
|
^ bearing
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
OpenGLFontTex >> bearing: anObject [
|
||||||
|
bearing := anObject
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
OpenGLFontTex >> fromFace: aFTFace [
|
||||||
|
|size glyph rec|
|
||||||
|
glyph := aFTFace glyph.
|
||||||
|
size := glyph width * glyph height.
|
||||||
|
data := FFIExternalArray externalNewType: #uint8 size:size.
|
||||||
|
rec := (FTFaceRec fromHandle: aFTFace getHandle).
|
||||||
|
data autoRelease.
|
||||||
|
LibC memCopy: (rec glyph bitmap buffer) to:data getHandle size: size.
|
||||||
|
level := 0.
|
||||||
|
internalFormat := GL_ALPHA.
|
||||||
|
width := glyph width.
|
||||||
|
height := glyph height.
|
||||||
|
linespace := (rec size metrics height / 64) asInteger.
|
||||||
|
border := 0.
|
||||||
|
format := GL_ALPHA.
|
||||||
|
type := GL_UNSIGNED_BYTE.
|
||||||
|
target := GL_TEXTURE_2D.
|
||||||
|
bearing := (glyph hBearingX )@ (glyph hBearingY).
|
||||||
|
advance := (glyph advanceX )@ (glyph advanceY).
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
OpenGLFontTex >> linespace [
|
||||||
|
^ linespace
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
OpenGLFontTex >> linespace: anObject [
|
||||||
|
linespace := anObject
|
||||||
|
]
|
@ -39,6 +39,19 @@ OpenGLTexImage2D >> data: anObject [
|
|||||||
data := anObject
|
data := anObject
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
OpenGLTexImage2D >> debug [
|
||||||
|
self
|
||||||
|
stdlog: 'Target:',target hex;
|
||||||
|
stdlog: 'level:',level asString;
|
||||||
|
stdlog: 'border :',border asString;
|
||||||
|
stdlog: 'width :',width asString;
|
||||||
|
stdlog: 'height :',height asString;
|
||||||
|
stdlog: 'type :',type hex;
|
||||||
|
stdlog: 'format :',format hex;
|
||||||
|
stdlog: 'internalformat :',internalFormat hex
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
OpenGLTexImage2D >> format [
|
OpenGLTexImage2D >> format [
|
||||||
^ format
|
^ format
|
||||||
|
@ -88,9 +88,19 @@ OpenGLTexture >> initialize [
|
|||||||
unit := 0.
|
unit := 0.
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #initialization }
|
||||||
|
OpenGLTexture >> maxTextureSize [
|
||||||
|
|ptr v|
|
||||||
|
ptr := FFIExternalArray externalNewType: GLint size:1.
|
||||||
|
ptr at:1 put: -1.
|
||||||
|
OpenGL getIntegerv: GL_MAX_TEXTURE_SIZE data: ptr getHandle.
|
||||||
|
v := ptr at:1.
|
||||||
|
ptr free.
|
||||||
|
^v
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
OpenGLTexture >> setImage2D: tex2D [
|
OpenGLTexture >> setImage2D: tex2D [
|
||||||
self active.
|
|
||||||
self bind: tex2D target.
|
self bind: tex2D target.
|
||||||
self class image2D: tex2D target
|
self class image2D: tex2D target
|
||||||
level: tex2D level
|
level: tex2D level
|
||||||
@ -100,7 +110,7 @@ OpenGLTexture >> setImage2D: tex2D [
|
|||||||
border: tex2D border
|
border: tex2D border
|
||||||
format: tex2D format
|
format: tex2D format
|
||||||
type: tex2D type
|
type: tex2D type
|
||||||
data: tex2D data
|
data: tex2D data getHandle.
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #initialization }
|
{ #category : #initialization }
|
||||||
|
@ -17,134 +17,8 @@ uniform vec2 u_resolution;
|
|||||||
uniform vec2 u_mouse;
|
uniform vec2 u_mouse;
|
||||||
uniform float u_time;
|
uniform float u_time;
|
||||||
void main(void) {
|
void main(void) {
|
||||||
gl_FragColor = texture2D(u_texture, texcoord); //vec4(1, 1, 1, texture2D(u_texture, texcoord).r) * vec4(1,1,1,1);
|
gl_FragColor = vec4(1, 1, 1, texture2D(u_texture, texcoord).a) * vec4(1,1,1,1);
|
||||||
}'!
|
}'
|
||||||
|
|
||||||
|pkgn dest pkg fileReference fileName writer core hePackage ignoresClasses|
|
|
||||||
FFIMethodRegistry resetAll.
|
|
||||||
dest := Smalltalk arguments first.
|
|
||||||
pkgn := Smalltalk arguments at:2.
|
|
||||||
|
|
||||||
core := HEPackage new.
|
|
||||||
core classes: OrderedCollection new.
|
|
||||||
core traits: OrderedCollection new.
|
|
||||||
core extensionMethods: OrderedCollection new.
|
|
||||||
core packageName: pkgn.
|
|
||||||
|
|
||||||
packages := #(
|
|
||||||
'Kernel-Chronology-Extras'
|
|
||||||
'Jobs'
|
|
||||||
'Collections-Arithmetic'
|
|
||||||
'Ring-Deprecated-Core-Kernel'
|
|
||||||
'Math-Operations-Extensions'
|
|
||||||
'Collections-Atomic'
|
|
||||||
'Collections-DoubleLinkedList'
|
|
||||||
'DeprecatedFileStream'
|
|
||||||
'Zinc-Resource-Meta-Core'
|
|
||||||
'Zinc-Character-Encoding-Core'
|
|
||||||
'FileSystem-Core'
|
|
||||||
'FileSystem-Disk'
|
|
||||||
'FileSystem-Memory'
|
|
||||||
'Compression'
|
|
||||||
'FileSystem-Zip'
|
|
||||||
'Multilingual-Encodings'
|
|
||||||
'Multilingual-Languages'
|
|
||||||
'Multilingual-TextConversion'
|
|
||||||
'Text-Core'
|
|
||||||
'AST-Core'
|
|
||||||
'Debugging-Core'
|
|
||||||
'OpalCompiler-Core'
|
|
||||||
'Kernel-Traits'
|
|
||||||
'AST-Core-Traits'
|
|
||||||
'Collections-Abstract-Traits'
|
|
||||||
'Transcript-Core-Traits'
|
|
||||||
'TraitsV2-Compatibility'
|
|
||||||
'Alien-Core'
|
|
||||||
'System-Model'
|
|
||||||
'PragmaCollector'
|
|
||||||
'UnifiedFFI'
|
|
||||||
'UnifiedFFI-Legacy'
|
|
||||||
'Slot-Core'
|
|
||||||
'System-Localization'
|
|
||||||
'STON-Core'
|
|
||||||
'Diya'
|
|
||||||
"
|
|
||||||
'Graphics-Primitives'
|
|
||||||
'Graphics-Transformations'
|
|
||||||
'Graphics-Canvas'
|
|
||||||
'FreeType'
|
|
||||||
'Graphics-Display Objects'
|
|
||||||
'EmbeddedFreeType'
|
|
||||||
'Text-Scanning'
|
|
||||||
'Multilingual-OtherLanguages'
|
|
||||||
'Multilingual-TextConverterOtherLanguages'
|
|
||||||
'Graphics-Fonts'
|
|
||||||
'System-FileRegistry'
|
|
||||||
'Graphics-Files'
|
|
||||||
'Graphics-Shapes'"
|
|
||||||
).
|
|
||||||
|
|
||||||
ignoresClasses := {
|
|
||||||
RGCommentDefinition.
|
|
||||||
RGMethodDefinition.
|
|
||||||
ChangeRecord.
|
|
||||||
PluggableListMorph.
|
|
||||||
TextLine.
|
|
||||||
TransformMorph.
|
|
||||||
StringMorph.
|
|
||||||
AthensCairoSDLSurface.
|
|
||||||
SourceFileArray.
|
|
||||||
GlyphForm
|
|
||||||
}.
|
|
||||||
|
|
||||||
packages do:[:name | |pkg trait classes extensionMethods|
|
|
||||||
Transcript show: 'Processing package ',name;cr.
|
|
||||||
FFIMethodRegistry resetAll.
|
|
||||||
pkg := RPackageOrganizer default packageNamed: name asSymbol.
|
|
||||||
traits := (pkg definedClasses select: #isTrait) do: [ :e | core traits add:(HETrait for: e) ].
|
|
||||||
(pkg definedClasses reject: #isTrait) do: [ :e |
|
|
||||||
(ignoresClasses includes:e superclass) ifFalse:[
|
|
||||||
core addClass: (HEClass for: e) ].
|
|
||||||
].
|
|
||||||
pkg extensionMethods do: [ :e |
|
|
||||||
(ignoresClasses includes:e classBinding value) ifFalse:[
|
|
||||||
core extensionMethods add:(HEMethod for: e)
|
|
||||||
]
|
|
||||||
].
|
|
||||||
].
|
|
||||||
|
|
||||||
"SDL binding class"
|
|
||||||
pkg := RPackageOrganizer default packageNamed: 'OSWindow-SDL2' asSymbol.
|
|
||||||
(pkg classNamesForClassTag: 'Bindings') do:[:e|
|
|
||||||
(ignoresClasses includes:e asClass) ifFalse:[
|
|
||||||
core addClass:(HEClass for:e asClass) ]].
|
|
||||||
|
|
||||||
"FreeType binding class"
|
|
||||||
|
|
||||||
pkg := RPackageOrganizer default packageNamed: 'FreeType' asSymbol.
|
|
||||||
(pkg classNamesForClassTag: 'Base') do:[:e|
|
|
||||||
(ignoresClasses includes:e asClass) ifFalse:[
|
|
||||||
core addClass:(HEClass for:e asClass) ]].
|
|
||||||
(pkg classNamesForClassTag: 'Bindings') do:[:e|
|
|
||||||
(ignoresClasses includes:e asClass) ifFalse:[
|
|
||||||
core addClass:(HEClass for:e asClass) ]].
|
|
||||||
"fixing some missing classes"
|
|
||||||
core addClass: (HEClass for:OSWindowPlatformSpecificHandle);
|
|
||||||
addClass: (HEClass for:ChunkWriteStream);
|
|
||||||
addClass: (HEClass for:ChunkReadStream);
|
|
||||||
addClass: (HEClass for:STCommandLineHandler);
|
|
||||||
addClass: (HEClass for:FreeTypeFace)
|
|
||||||
.
|
|
||||||
|
|
||||||
fileReference := (dest,'/',(pkgn replaceAll: Character space with: $-),'.hermes') asFileReference.
|
|
||||||
fileName := fileReference fullName.
|
|
||||||
writer := HEBinaryReaderWriter new
|
|
||||||
stream: (File openForWriteFileNamed:fileName);
|
|
||||||
yourself.
|
|
||||||
core writeInto: writer.
|
|
||||||
|
|
||||||
writer stream flush.
|
|
||||||
Transcript show: 'File exported to ', dest, '/', pkgn, '.hermes'; cr.
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #'as yet unclassified' }
|
{ #category : #'as yet unclassified' }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user