Giter Site home page Giter Site logo

blitz-research / monkey2 Goto Github PK

View Code? Open in Web Editor NEW
129.0 129.0 42.0 328.52 MB

License: zlib License

Monkey 56.76% C++ 0.78% CMake 3.32% Objective-C 7.68% Perl 0.74% Python 7.34% Shell 0.22% Batchfile 0.08% GLSL 0.67% CSS 0.16% Makefile 1.37% Objective-C++ 0.67% HTML 1.60% Assembly 12.16% Awk 0.01% Ragel 2.09% M4 0.71% Lua 0.02% C# 3.56% Metal 0.06%

monkey2's Introduction

***** Welcome to Monkey2! *****

If you are reading this on github, please note there are prebuilt versions of monkey2 (with complete source code) available from https://blitzresearch.itch.io/monkey2.


***** Building monkey2 on Windows *****

1) Unless you are using one of the prebuilt releases, you will need to install the mingw-64 compiler. There is a self-extracting archive of mingw-64 that has been tested with monkey2 here:

http://monkeycoder.co.nz/get-file?file=i686-6.2.0-posix-dwarf-rt_v5-rev1.exe

If you install this to the monkey2 'devtools' directory, the following steps should 'just work' (ha!).

2) Open a command prompt and change to the 'monkey2\scripts' directory.

3) Enter 'rebuildall' and hit return. Wait...

4) If all went well, you should end up with a 'Monkey2 (Windows)' exe in the monkey2 directory. Run this to launch the Ted2go IDE.

5) You should now be able to build and run monkey2 apps. There are some sample apps in the monkey2/bananas directory.


***** Building monkey2 on MacOS/Linux *****

1) On MacoS, install the xcode command line tools. You can do this by entering 'xcode-select --install' in a shell.

2) Open a shell and change to the 'monkey2/scripts' directory.

3) Enter './rebuildall.sh' and hit return. Wait...

4) If all went well, you should end up with a 'Monkey2 (...)' app in the monkey2 directory. Run this to launch the Ted2go IDE.

5) You should now be able to build and run monkey2 apps. There are some sample apps in the monkey2/bananas directory.


***** More information *****

Monkey2 development blog: http://monkeycoder.co.nz/

Monkey2 itch.io page: https://blitzresearch.itch.io/monkey2

Monkey2 github page: https://github.com/blitz-research/monkey2

Ted2go github page: https://github.com/engor/Ted2Go

monkey2's People

Contributors

abakobo avatar arawkins avatar blitz-research avatar d-a-n-i-l-o avatar engor avatar jacereda avatar lucaswolschick avatar seyhajin avatar xanozoid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

monkey2's Issues

TED2 OSX user finetuning

The default copy/past keys for osx users are CMD+C and CMD+V
Its a small thing, but maybe its easy to add this extra shortcut :)

Same for CMD+S (save) and maybe other keys
CMD+F (search)

Double press mouse on text to highlight the word

Ted2 Close Image Crash

On MacOS when closing an open image Ted2 crashes here in imgdocument[90]

    If _image _image.Discard()

Resizing window causes MAV in Release mode

`"H:/Dropbox/CodeMonkey/Monkey/MonkeyXPro86e/monkey2/bin/mx2cc_windows" makeapp -target=Desktop -config=Release "H:/Dropbox/CodeMonkey/Monkey/MonkeyXPro86e/monkey2/modules/mojo/bananas/viewlayout/viewlayout.monkey2"
MX2CC V0.004

***** Building app 'H:/Dropbox/CodeMonkey/Monkey/MonkeyXPro86e/monkey2/modules/mojo/bananas/viewlayout/viewlayout.monkey2' *****

Parsing...
Semanting...
Translating...
Compiling....
Linking H:/Dropbox/CodeMonkey/Monkey/MonkeyXPro86e/monkey2/modules/mojo/bananas/viewlayout/viewlayout.buildv004/desktop_release_windows/viewlayout.exe
Running H:/Dropbox/CodeMonkey/Monkey/MonkeyXPro86e/monkey2/modules/mojo/bananas/viewlayout/viewlayout.buildv004/desktop_release_windows/viewlayout.exe
Window Resized to:640,512

***** Uncaught Monkey 2 Exception: Memory access violation *****`

Missing mojo.input.keycodes entry

Found that this was missing:
in the keycodes:
Equals = 61,

in the Modifiers:
Command= LeftGui|RightGui

Note - on a mac there is No Gui it is Command, so this needs adding ;)

memory access violation with vec2f

tested in ted21 and ted2

Mark, this was brought to me and confirmed with both ted21 and ted2, so I am assuming it is a proper bug:

`Namespace myapp

Import ""

Import ""

Using std..
Using mojo..

Class MyWindow Extends Window

Method New()
    Local FrameSetCollection:StringMap<FrameSet> = New StringMap<FrameSet>()

    Local player:Player =  New Player(FrameSetCollection, "Bla", 200, 300)
End

Method OnRender( canvas:Canvas ) Override
    canvas.DrawText( "Hello World",Width/2,Height/2,.5,.5 )
End

End

Function Main()
New AppInstance
New MyWindow
App.Run()
End

Class FrameSet

Field Position:= New Vec2f
Field Vector:= New Vector()

Method Move:Void(_mx:Float, _my:Float)
'   Print _mx
'   Print _my

' HERE IS THE ERROR,  CREATING NEW VEC2F
'
'
    Position=New Vec2f
'   Vector.x =  2
'   Vector.Set(3)
'   Position =  New Vec2f(_mx,_my)
End

End Class

Class Sprite
Field FrameSetCollection:StringMap
Field FrameSetColKey:String

Method New(_FrameSetCollection:StringMap<FrameSet>,_FrameSetColKey:String)
    FrameSetCollection = _FrameSetCollection
    FrameSetColKey = _FrameSetColKey

'   FrameSetCollection.Add(FrameSetColKey, New FrameSet)
End

End Class

Class Vector
Field x:Float

Method Set(_x:Float)
    x= _x
End

End Class

Class Player Extends Sprite

Method New(_FrameSetCollection:StringMap<FrameSet>,
    _FrameSetColKey:String,
    _initX:Float,
    _initY:Float)
    Super.New(_FrameSetCollection,_FrameSetColKey)

    _FrameSetCollection.Get(_FrameSetColKey).Move(_initX,_initY)
End

End Class`
The offending line is found in Frameset:

Position=New Vec2f

MX2 Import error

With the new build (1.0.3) whenever I import SDL2, I get an error.

lnkFiles1:
"C:/Users/Admin/Desktop/Substruct/Substruct.buildv1.0.3/build_cache/desktop_debug_windows/Substruct_0Substruct.cpp.o" "C:/Workbench/Monkey2/modules/sld2/sld2.buildv1.0.3/desktop_debug_windows/sld2.a" "C:/Workbench/Monkey2/modules/mojo/mojo.buildv1.0.3/desktop_debug_windows/mojo.a" "C:/Workbench/Monkey2/modules/std/std.buildv1.0.3/desktop_debug_windows/std.a" "C:/Workbench/Monkey2/modules/stb-vorbis/stb-vorbis.buildv1.0.3/desktop_debug_windows/stb-vorbis.a" "C:/Workbench/Monkey2/modules/stb-image-write/stb-image-write.buildv1.0.3/desktop_debug_windows/stb-image-write.a" "C:/Workbench/Monkey2/modules/stb-image/stb-image.buildv1.0.3/desktop_debug_windows/stb-image.a" "C:/Workbench/Monkey2/modules/miniz/miniz.buildv1.0.3/desktop_debug_windows/miniz.a" "C:/Workbench/Monkey2/modules/sdl2/sdl2.buildv1.0.3/desktop_debug_windows/sdl2.a" "C:/Workbench/Monkey2/modules/openal/openal.buildv1.0.3/desktop_debug_windows/openal.a" "C:/Workbench/Monkey2/modules/gles20/gles20.buildv1.0.3/desktop_debug_windows/gles20.a" "C:/Workbench/Monkey2/modules/libc/libc.buildv1.0.3/desktop_debug_windows/libc.a" "C:/Workbench/Monkey2/modules/freetype/freetype.buildv1.0.3/desktop_debug_windows/freetype.a" "C:/Workbench/Monkey2/modules/emscripten/emscripten.buildv1.0.3/desktop_debug_windows/emscripten.a" "C:/Workbench/Monkey2/modules/monkey/monkey.buildv1.0.3/desktop_debug_windows/monkey.a" -lcomdlg32 "C:/Workbench/Monkey2/modules/openal/openal-soft/lib/OpenAL32.lib" "C:/Workbench/Monkey2/modules/gles20/angle/lib/libEGL.lib" "C:/Workbench/Monkey2/modules/gles20/angle/lib/libGLESv2.lib" -ldsound -lxinput -ldinput -lole32 -loleaut32 -limm32 -lwinmm -lgdi32 -luser32 -lkernel32 -lversion

stderr1:
C:/Workbench/Monkey2/devtools/i686-5.3.0-posix-dwarf-rt_v4-rev0/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find C:/Workbench/Monkey2/modules/sld2/sld2.buildv1.0.3/desktop_debug_windows/sld2.a: No such file or directory collect2.exe: error: ld returned 1 exit status

I turns out I mistyped SDL for SLD but MX2 did not catch it

Fail to build TED2 with the latest git checkout

Getting som undefined references when trying to build TED2 from the latest checkout:

std.a(_1_1_1fiber_2native_2fiber.cpp.o):fiber.cpp:(.text+0x1c4): undefined reference to 'jump_fcontext'
std.a(_1_1_1fiber_2native_2fiber.cpp.o):fiber.cpp:(.text+0x3db): undefined reference to 'make_fcontext'

Seem to be related to the new fiber code.
Same error on Windows & Linux. Both while doing rebuildall.(bat/sh) on a clean install/copy.
Modules built without error on both systems, but ted2 fail.

Adding check-up to mx2cc

ok, this is a small amendment to add checking to mx2cc
in function main:
line 55 =
Print "Usage: mx2cc makeapp|makemods|makedocs|checkapp [-run] [-clean] [-verbose] [-target=desktop|emscripten] [-config=debug|release] source|modules..."
add line 71,72=
Case "makeapp" MakeApp( args )
add new function:
`Function CheckApp( args:String[] )

Local opts:=New BuildOpts
opts.productType="app"
opts.appType="gui"
opts.target="desktop"
opts.config="debug"
opts.clean=False
opts.fast=True
opts.run=true
opts.verbose=0

args=ParseOpts( opts,args )

If args.Length<>1 Fail( "Invalid app source file" )

Local cd:=CurrentDir()
ChangeDir( StartDir )
Local srcPath:=RealPath( args[0].Replace( "\","/" ) )
ChangeDir( cd )

opts.mainSource=srcPath

Print ""
Print "***** Checking app '"+opts.mainSource+"' *****"
Print ""

Local builder:=New Builder( opts )

builder.Parse()
If builder.errors.Length Return

builder.Semant()
If builder.errors.Length Return

Print "Application Checked"

End
`

unimplemented generi

`Function Main()
Local v1:Collision = New HitBox(new PVector2D(7,56),30,40,50,48)
Local v2:Collision = New HitCircle(new PVector2D(28,17),10,15,20)
v1.Render()
v2.Render()
End function

Class PVector2D
Field x:Float
Field y:Float

Method New()
End Method

Method New(x:Float,y:Float)
    Self.x = x
    Self.y = y
End Method

Method Set:Void(x:Float,y:Float)
    Self.x = x
    Self.y = y
End Method

End Class

Class Collision Abstract
Field pos:PVector2D
Field off:PVector2D

Method New()
    off = New PVector2D
End Method

Method Set:Void(pos:PVector2D,ox:Float,oy:Float,width:Float,height:Float) Abstract
Method Set:Void(pos:PVector2D,ox:Float,oy:Float,radius:Float) Abstract
Method Collided:Bool(col:Collision) Abstract
Method Render() Abstract

End Class

Class HitBox Extends Collision
Field width:Float
Field height:Float

Method New()

End Method

Method New(p:PVector2D,x:Float,y:Float,width:Float,height:Float)     
    Set(p,x,y,width,height)
End Method

Method Set:Void(pos:PVector2D,ox:Float,oy:Float,width:float,height:float) Override
    Self.pos = pos
    off.Set(ox,oy)
    Self.width = width
    Self.height = height
End Method

Method Collided:Bool(bx:Collision) Override
Local box := cast(bx)
Local b1x1:Float = pos.x + off.x
Local b1y1:Float = pos.y + off.y
Local b1x2:Float = pos.x + width
Local b1y2:Float = pos.y + height
Local b2x1:Float = box.pos.x + box.off.x
Local b2y1:Float = box.pos.y + box.off.y
Local b2x2:Float = box.pos.x + box.width
Local b2y2:Float = box.pos.y + box.height
If b1x1 > b2x2 Return False
If b1x2 < b2x1 Return False
If b1y1 > b2y2 Return False
If b1y2 < b2y1 Return False
Return True
End Method

Method Render:Void() Override
Print pos.y
End Method

End Class

Class HitCircle Extends Collision

Field radius:Float

Method New(pos:PVector2D,ox:Float,oy:Float,radius:Float)
    Set(pos,ox,oy,radius)
End Method

Method Set(pos:PVector2D,ox:Float,oy:Float,radius:Float=0) Override
    Self.pos = pos
    off.Set(ox,oy)
    Self.radius = radius
End Method

Method Collided:Bool(bx:Collision) Override
    Local box := Cast<HitBox>(bx)
    If box Then Return Rectangle(box)
    Local cir := Cast<HitCircle>(bx)
    If cir Then Return Circle(cir) 
    Return False
End Method

Method Circle:Bool(cir:HitCircle)
    Local totRadius:Float
    Local vx:Float = pos.x - cir.pos.x
    Local vy:Float = pos.y - cir.pos.y
    totRadius = Self.radius+cir.radius

    If (vx*vx+vy*vy) < totRadius*totRadius Return True
    Return false
End Method

Method Rectangle:Bool(rect:HitBox)
    Local vx:Float = rect.width/2
    Local vy:Float = rect.height/2
    Local radius:Float = Sqrt(vx*vx + vy*vy) 
    Local totRadius := Self.radius + radius
    Local nx:Float = pos.x - rect.pos.x 
    Local ny:Float = pos.y - rect.pos.y
    If totRadius*totRadius < (nx*nx + ny*ny) Return False
    Return True
End Method

Method Render:void() Override
    Print pos.x
End Method

End Class`

the above code translate with MX2 but fail to compile with the c compiler. apparently is due to the un implemented abstract method in the extended classes. Mx2 is not able to find errors with abstract methods that have the same name but different parameters and are not implemented in the extended classes.

mx2cc help missing -build argument

The mx2cc Usage help displayed when the command is invoked without arguments includes the -run argument option but omits the -build option.

Compiler Error - Problem with forward referencing.

I got a program that gives me an error when I try to pass a pointer to a method but only when I pass one of its fields:

Method InitLevel1()
    ufoManager = New UfoManager(playerManager.player.pos) '************

End Method

to this method on another Class:

Method New(playerPos:PVector2D) '******************
    Super.New()
    state = State.ENTERING
    Self.playerPos = playerPos '****************
End Method

and I get this error:

/Users/ayoitseve/Desktop/monkeypatrol/monkeypatrol.buildv1.0.3/build_cache/desktop_debug_macos/monkeypatrol_src_2entity.h:11:8: note: forward declaration of 't_default_PVector2D'
struct t_default_PVector2D;
^
1 error generated.
***** Fatal mx2cc error *****

Internal mx2cc build error

If I pass the object I don't get the error only if I pass the field:

Method InitLevel1()
    ufoManager = New UfoManager(playerManager.player) '**********

End Method

Method New(player:Vehicle) '********************************************
    Super.New()
    state = State.ENTERING
    Self.playerPos = player.pos  '*************************************
End Method

this does not give me an error and works fine.

Fatal error on build: Broken declaration in scope. (BlendMode)

Hi
When building in either release or debug I get a fatal error. It is an issue related to conversion form the enumerator 'BlendMode.?' to an integer as show here.

Class Test

Field blend:Int=BlendMode.Alpha

End Class

This build attempt was done with Ted2 and Monkey2 v-1.0.2.
mx2cc version 1.0.2


***** Building app '/home/moonbasealpha/Programming/monkey2/phoenix/phoenixusc.monkey2' *****

Parsing...
Semanting...
Translating...
Compiling....
Build error: System command 'g++ -std=c++11 -O0 -I"/home/moonbasealpha/Programming/monkey2-master/modules/freetype/freetype-2.6.3/include/" -I"/home/moonbasealpha/Programming/monkey2-master/modules/sdl2/SDL/include/" -I"/home/moonbasealpha/Programming/monkey2-master/modules/monkey/native" -c -o "/home/moonbasealpha/Programming/monkey2/phoenix/phoenixusc.buildv1.0.2/build_cache/desktop_debug_linux/phoenixusc_0phoenixwindow.cpp.o" "/home/moonbasealpha/Programming/monkey2/phoenix/phoenixusc.buildv1.0.2/build_cache/desktop_debug_linux/phoenixusc_phoenixwindow.cpp"' failed.

g++ -std=c++11 -O0 -I"/home/moonbasealpha/Programming/monkey2-master/modules/freetype/freetype-2.6.3/include/" -I"/home/moonbasealpha/Programming/monkey2-master/modules/sdl2/SDL/include/" -I"/home/moonbasealpha/Programming/monkey2-master/modules/monkey/native" -c -o "/home/moonbasealpha/Programming/monkey2/phoenix/phoenixusc.buildv1.0.2/build_cache/desktop_debug_linux/phoenixusc_0phoenixwindow.cpp.o" "/home/moonbasealpha/Programming/monkey2/phoenix/phoenixusc.buildv1.0.2/build_cache/desktop_debug_linux/phoenixusc_phoenixwindow.cpp"

In file included from /home/moonbasealpha/Programming/monkey2/phoenix/phoenixusc.buildv1.0.2/build_cache/desktop_debug_linux/phoenixusc_phoenixwindow.cpp:2:0:
/home/moonbasealpha/Programming/monkey2/phoenix/phoenixusc.buildv1.0.2/build_cache/desktop_debug_linux/phoenixusc_phoenixwindow.h:118:60: error: t_mojo_graphics_BlendMode was not declared in this scope
   bbInt m__0window_0blend=bbInt(t_mojo_graphics_BlendMode(1));
                                                            ^
***** Fatal mx2cc error *****


See: http://monkey2.monkey-x.com/forums/topic/fatal-error-on-build-broken-declaration-in-scope/

(libc module) documentation typo

In the docs of the libc module, it says:

The libc module contains wrappers for a number 'C' library functions and types.

I think 'of' was meant to be put after 'number'.

Ted2 SaveAs Linux issue

On a vanilla Ubuntu 16.04 installtion, the "Save As" does not display a text field to enter a file name. The directory structure can be browsed, but there is no place to enter a filename anywhere

Conditional returns

There must be a Return statement in the main body of a Method or an error is returned "Error: Missing Return Statement"

Consider the following
Method test(val:bool) if(val) Return True else Return False endif end
since the returns are nested in an if statement, the error is triggered. Surely this should be allowed?

Hello World Compile Error

Hello,

I'm almost certainly missing something obvious. I have just unzipped monkey2 into its own directory. Trying to compile the hello world demo goes like this :

[arpie@max Monkey2]$ ./bin/mx2cc_linux makeapp -run -clean -target=desktop -config=debug hello-world.monkey2
MX2CC V0.011

***** Building app '/home/arpie/Coding/Monkey/Monkey2/hello-world.monkey2' *****

Parsing...
Semanting...
Translating...
Compiling....
Build error: System command 'g++ -std=c++11 -O0 -I"/home/arpie/Coding/Monkey/Monkey2/modules/freetype/freetype-2.6.3/include/" -I"/home/arpie/Coding/Monkey/Monkey2/modules/sdl2-mixer/SDL_mixer/" -I"/home/arpie/Coding/Monkey/Monkey2/modules/sdl2/SDL/include/" -I"/home/arpie/Coding/Monkey/Monkey2/modules/monkey/native" -c -o "/home/arpie/Coding/Monkey/Monkey2/hello-world.buildv011/build_cache/desktop_debug_linux/hello_05world_0hello_05world.cpp.o" "/home/arpie/Coding/Monkey/Monkey2/hello-world.buildv011/build_cache/desktop_debug_linux/hello_5world_hello_5world.cpp"' failed.

g++ -std=c++11 -O0 -I"/home/arpie/Coding/Monkey/Monkey2/modules/freetype/freetype-2.6.3/include/" -I"/home/arpie/Coding/Monkey/Monkey2/modules/sdl2-mixer/SDL_mixer/" -I"/home/arpie/Coding/Monkey/Monkey2/modules/sdl2/SDL/include/" -I"/home/arpie/Coding/Monkey/Monkey2/modules/monkey/native" -c -o "/home/arpie/Coding/Monkey/Monkey2/hello-world.buildv011/build_cache/desktop_debug_linux/hello_05world_0hello_05world.cpp.o" "/home/arpie/Coding/Monkey/Monkey2/hello-world.buildv011/build_cache/desktop_debug_linux/hello_5world_hello_5world.cpp"

In file included from /home/arpie/Coding/Monkey/Monkey2/hello-world.buildv011/build_cache/desktop_debug_linux/hello_5world_hello_5world.cpp:2:0:
/home/arpie/Coding/Monkey/Monkey2/hello-world.buildv011/build_cache/desktop_debug_linux/hello_5world_hello_5world.h:9:87: fatal error: ../../../modules/mojo/mojo.buildv011/desktop_debug_linux/mojo_app_2window.h: No such file or directory
 #include "../../../modules/mojo/mojo.buildv011/desktop_debug_linux/mojo_app_2window.h"
                                                                                       ^
compilation terminated.


***** Fatal mx2cc error *****

Build error.
[arpie@max Monkey2]$ 

I can confirm that the directory /modules/mojo/mojo.build... doesn't exist. Should it be created on demand? Should I somehow compile mojo before compiling hello world?

I'm using Arch Linux if that has any bearing on the issue.

TIA

Russell

Cannot use function in Super.New() method

I am trying to call a function when creating an extended class, and calling the Super.New() method. This result in a Memory Access Violation, while the base class does have the New() method that accept an image:

Method New()
    Super.New( GetImage("sprites",1) )
End Method

GetImage(name, frame) is a function that will return an image from an array.

While this works, where images is a global variable, set to an image:

Method New()
    Super.New(images)
End Method

Key.Apostrophe missing in action

I don't seem to be able to find a name for the key to the right of my semicolon. The online docs suggest Apostrophe is a member of Key but it currently is not.

Ted2 looks better with leading

I have had a couple of attempts at adding leading to Ted2.

Leading

Fixing this could reduce 'FLTK look' in mojox apps.

My best attempt to date is modifying mojo.graphics.Font.Height to return _height*1.2 which I think is a big improvement. An actual implementation could add the 'em multiplier' as a Leading property of font or it could live in mojox style?

Spaces in OS X source path cause Ted 2 to fail to run app

On OS X when the source path contains spaces Ted 2 builds the code okay, but it doesn’t actually run the built code. The built applications are in the expected output folders and if I run them manually they work fine, but Ted 2 doesn’t seem to want to run them.

Using a source path without spaces everything works as expected.

Improve error message - missmatch of parenthesis

This:
Local x2:float = x - (Sin(direction + 2.4434) )* 8)

Shows:
: Error : Expecting end of line

Expected:
: Error : Line had Parenthesis missmatch. You open 2 x '(' but close 3 x ')'.

Note: Mark let me know if this is the preferred way to report. Also do you want usability things like these? or bugs only?

Image.Scale property not working with negative values

Trying to use the Image.Scale property to mirror an image using negative values does not work.

Example code:
`
Namespace myapp

Import ""

Import ""

Import "monkey2_64.png"

Using std..
Using mojo..

Class MyWindow Extends Window
Field img:Image

Method New()
    Super.New("Test",640,480)
    img=Image.Load("asset::monkey2_64.png")
End

Method OnRender( canvas:Canvas ) Override
    If Keyboard.KeyDown(Key.Space)
      Print("Flipping image on X axis...")
      img.Scale=New Vec2f(-1.0,1.0)
    Else
      img.Scale=New Vec2f(1,1)
    Endif

    canvas.DrawImage(img,0,0)   
    App.RequestRender()
End

End

Function Main()

New AppInstance

New MyWindow

App.Run()

End
`

building v1.03 failed on OSX

I get this error building on OSX 10.11.3 with latest xcode and latest command line tools. Following readme.

***** Making module 'std' *****

Parsing...
Semanting...
Translating...
Compiling....
Build error: System command 'as -o "/Users/koko/Desktop/monkey2103/modules/std/std.buildv1.0.3/build_cache/desktop_release_macos/_1_1_1fiber_2native_2asm_2make_0x86_064_0sysv_0macho_0gas.S.o" "/Users/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S"' failed.

as -o "/Users/koko/Desktop/monkey2103/modules/std/std.buildv1.0.3/build_cache/desktop_release_macos/_1_1_1fiber_2native_2asm_2make_0x86_064_0sysv_0macho_0gas.S.o" "/Users/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S"

).sers/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:7:Junk character 13 (
).sers/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:26:Junk character 13 (
).sers/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:27:Junk character 13 (
).sers/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:28:Rest of line ignored. 1st junk character valued 13 (
).sers/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:29:Rest of line ignored. 1st junk character valued 13 (
).sers/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:30:Junk character 13 (
/Users/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:32:invalid character (0xd) in operand 2
).sers/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:33:Junk character 13 (
/Users/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:35:invalid character (0xd) in operand 2
/Users/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:36:invalid character (0xd) in operand 2
).sers/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:37:Junk character 13 (
/Users/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:40:invalid character (0xd) in operand 2
).sers/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:41:Junk character 13 (
/Users/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:43:invalid character (0xd) in operand 2
).sers/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:44:Junk character 13 (
/Users/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:46:invalid character (0xd) in operand 2
/Users/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:49:invalid character (0xd) in operand 2
).sers/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:50:Junk character 13 (
).sers/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:52:Junk character 13 (
).sers/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:53:Junk character 13 (
/Users/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:55:invalid character (0xd) in operand 2
/Users/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:57:invalid character (0xd) in operand 1
/Users/koko/Desktop/monkey2103/modules/std/fiber/native/asm/make_x86_64_sysv_macho_gas.S:58:invalid character (0xd) in mnemonic

***** Fatal mx2cc error *****

Internal mx2cc build error
mx2cc version 1.0.3

CopyPixmap grabs pixels incorrectly

#Import "<std>"
#Import "<mojo>"

Using std..
Using mojo..


Class AppWindow Extends Window
    Field UpdateTimer:Timer
    Field DisplayStatistics:Bool
    Field TakeScreenshot:Bool

    Method New()
        SwapInterval=0
        ClearColor = Color.Black
    End Method

    Method OnUpdate()
        If Keyboard.KeyReleased(Key.Escape) Then App.Terminate()
        If Keyboard.KeyDown(Key.LeftControl) Then
            If Keyboard.KeyPressed(Key.F) Then DisplayStatistics = Not DisplayStatistics
            If Keyboard.KeyPressed(Key.P) Then TakeScreenshot = True
        Endif
        App.RequestRender()
    End Method

    Method OnRender(Canvas:Canvas) Override
        OnUpdate()

        If (DisplayStatistics = True) Then
            Canvas.Color = Color.White
            Canvas.DrawText("FPS :"+App.FPS,0,0)
        Endif

        If (TakeScreenshot = True) Then
            TakeScreenshot = False
            Local Screenshot:Pixmap = Canvas.CopyPixmap(New Recti(0, 0, 640, 480))'Rect)
            Print SavePixmap(Screenshot, "test.png")
        Endif
    End Method  

End Class

Function Main()
    New AppInstance 
    New AppWindow
    App.Run()
End Function

When it saves the pixmap, the image is saved to the monkey2 directory (not the application directory) and the pixels are vertically flipped.

test

Building a module fails if module is a symlink

Hi,

I used symlinks a lot to organize my modules outside the monkey1 folder. A simple shell command file recreates all symlinks inside the modules folder (for my own modules and other 3rd party modules) after I download a new Monkey release. But this approach is not working in monkey2.

This is the error. I'm on OS X EL Capitan, using release V008.

***** Making module 'renderwindow' *****

Parsing...
Semanting...
Translating...
Compiling....
Build error: System command 'g++ -std=c++11 -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality -O0 -I"/Applications/Leo/Blitz/monkey2/modules/freetype/freetype-2.6.3/include/" -I"/Applications/Leo/Blitz/monkey2/modules/sdl2-mixer/SDL_mixer/" -I"/Applications/Leo/Blitz/monkey2/modules/sdl2/SDL/include/" -I"/Applications/Leo/Blitz/monkey2/modules/monkey/native" -c -o "/Applications/Leo/Blitz/monkey2/modules/renderwindow/renderwindow.buildv008/build_cache/desktop_debug_macos/renderwindow_0renderwindow.cpp.o" "/Applications/Leo/Blitz/monkey2/modules/renderwindow/renderwindow.buildv008/build_cache/desktop_debug_macos/renderwindow_renderwindow.cpp"' failed.

g++ -std=c++11 -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality -O0 -I"/Applications/Leo/Blitz/monkey2/modules/freetype/freetype-2.6.3/include/" -I"/Applications/Leo/Blitz/monkey2/modules/sdl2-mixer/SDL_mixer/" -I"/Applications/Leo/Blitz/monkey2/modules/sdl2/SDL/include/" -I"/Applications/Leo/Blitz/monkey2/modules/monkey/native" -c -o "/Applications/Leo/Blitz/monkey2/modules/renderwindow/renderwindow.buildv008/build_cache/desktop_debug_macos/renderwindow_0renderwindow.cpp.o" "/Applications/Leo/Blitz/monkey2/modules/renderwindow/renderwindow.buildv008/build_cache/desktop_debug_macos/renderwindow_renderwindow.cpp"

/Applications/Leo/Blitz/monkey2/modules/renderwindow/renderwindow.buildv008/build_cache/desktop_debug_macos/renderwindow_renderwindow.cpp:6:10: fatal error: '../../../../mojo/mojo.buildv008/desktop_debug_macos/mojo_app_2app.h' file not found

include "../../../../mojo/mojo.buildv008/desktop_debug_macos/mojo_app_2app.h"

     ^

1 error generated.

***** Fatal mx2cc error *****

Mojo build error on Linux: no match for operator

Monkey2 build fails on compiling the mojo module. I get the following errors on Linux Mint 17.2:

/```
home/moonbasealpha/Programming/monkey2/modules/monkey/native/bbmonkey.h:21:7: error: no match for ▒operator> (operand types are ▒t_std_geom_Vec2_1i and ▒t_std_geom_Vec2_1i)
/home/moonbasealpha/Programming/monkey2/modules/monkey/native/bbmonkey.h:22:10: error: no match for ▒operator> (operand types are ▒t_std_geom_Vec2_1i and ▒t_std_geom_Vec2_1i)

/home/moonbasealpha/Programming/monkey2/modules/monkey/native/bbmonkey.h:21:7: error: no match for ▒operator> (operand types are ▒t_std_geom_Rect_1i and ▒t_std_geom_Rect_1i)
/home/moonbasealpha/Programming/monkey2/modules/monkey/native/bbmonkey.h:22:10: error: no match for ▒operator> (operand types are ▒t_std_geom_Rect_1i and ▒t_std_geom_Rect_1i)

Building modules fails if module is a symlink

Hi,

I used symlinks a lot to organize my modules outside the monkey1 folder. A simple shell command file recreates all symlinks inside the modules folder (for my own modules and other 3rd party modules) after I download a new Monkey release. But this approach is not working in monkey2.

This is the error. I'm on OS X EL Capitan, using release V008.

***** Making module 'renderwindow' *****

Parsing...
Semanting...
Translating...
Compiling....
Build error: System command 'g++ -std=c++11 -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality -O0 -I"/Applications/Leo/Blitz/monkey2/modules/freetype/freetype-2.6.3/include/" -I"/Applications/Leo/Blitz/monkey2/modules/sdl2-mixer/SDL_mixer/" -I"/Applications/Leo/Blitz/monkey2/modules/sdl2/SDL/include/" -I"/Applications/Leo/Blitz/monkey2/modules/monkey/native" -c -o "/Applications/Leo/Blitz/monkey2/modules/renderwindow/renderwindow.buildv008/build_cache/desktop_debug_macos/renderwindow_0renderwindow.cpp.o" "/Applications/Leo/Blitz/monkey2/modules/renderwindow/renderwindow.buildv008/build_cache/desktop_debug_macos/renderwindow_renderwindow.cpp"' failed.

g++ -std=c++11 -Wno-deprecated-declarations -Wno-tautological-pointer-compare -Wno-undefined-bool-conversion -Wno-int-to-void-pointer-cast -Wno-inconsistent-missing-override -Wno-logical-op-parentheses -Wno-parentheses-equality -O0 -I"/Applications/Leo/Blitz/monkey2/modules/freetype/freetype-2.6.3/include/" -I"/Applications/Leo/Blitz/monkey2/modules/sdl2-mixer/SDL_mixer/" -I"/Applications/Leo/Blitz/monkey2/modules/sdl2/SDL/include/" -I"/Applications/Leo/Blitz/monkey2/modules/monkey/native" -c -o "/Applications/Leo/Blitz/monkey2/modules/renderwindow/renderwindow.buildv008/build_cache/desktop_debug_macos/renderwindow_0renderwindow.cpp.o" "/Applications/Leo/Blitz/monkey2/modules/renderwindow/renderwindow.buildv008/build_cache/desktop_debug_macos/renderwindow_renderwindow.cpp"

/Applications/Leo/Blitz/monkey2/modules/renderwindow/renderwindow.buildv008/build_cache/desktop_debug_macos/renderwindow_renderwindow.cpp:6:10: fatal error: '../../../../mojo/mojo.buildv008/desktop_debug_macos/mojo_app_2app.h' file not found
#include "../../../../mojo/mojo.buildv008/desktop_debug_macos/mojo_app_2app.h"
         ^
1 error generated.


***** Fatal mx2cc error *****

Normaltest Banana example fails to compile

Failed to compile fragment shader:0:124(20): error: cannot construct mat3' from a matrix in GLSL 1.10 (GLSL 1.20 or GLSL ES 1.00 required) 0:124(20): error: operands to arithmetic operators must be numeric 0:124(9): error: no matching function for call tonormalize(error)'; candidates are:
0:124(9): error: float normalize(float)
0:124(9): error: vec2 normalize(vec2)
0:124(9): error: vec3 normalize(vec3)
0:124(9): error: vec4 normalize(vec4)

Language Documentation needs Anchors

Currently the online monkey2 language documentation cannot be referenced.

If someone asks about a Cast<> operator one cannot refer to the following part of the guide:

<h4 id="explicit-type-conversions">Explicit type conversions</h4>

Is it possible for some anchors to be added to use the following style url

http://monkey2.monkey-x.com/language-reference#explicit-type-conversions

Issue with List Sort

The following

#import "<std>"
Using std..

Class Cube
    field y:Int
    Global Order:=4 

    Method New(i:Int)
        y=i
    End

    Function CompareCubes:Int(a:Cube,b:Cube)
        Return b.SortDepth(Order)-a.SortDepth(Order)
    End

    Method SortDepth:Int(q:Int)
        Return y
    end
End

Function Main()
    Print "sort test"
    Local list:=New List<Cube>

    list.AddLast(New Cube(0))
    list.AddLast(New Cube(-1))
    list.AddLast(New Cube(1))

    list.Sort(Cube.CompareCubes)
    For Local cube:=Eachin list
        Print cube.y
    next    
end

outputs the following

0
-1
1

Ted2 Scripts broken for posix environments

The following mod to mainwindow.monkey2[1330] gets scripts running in Ted2 in non-Windows environments.

#If __HOSTOS__="windows"
        script+=".bat"
#Else If __HOSTOS__="macos"
        script="/bin/bash -l "+script+".sh"
#Else
        script="/bin/bash -l -c "+script+".sh"
#Endif
        Local cmd:=script

Caseless Select makes C++ cry

Function Main()
Local a:=0
Select a
Default
Print "yeh"
End
End

Causes following output:

/Users/simon/test1.buildv011/build_cache/desktop_release_macos/test1_test1.cpp:16:1: error: extraneous closing brace ('}')
}
^
2 errors generated.

Parser misses "If Struct" when compiling modules

I noticed that if I'm checking to see if a struct exists (which you can't do like you can with objects) within a module it misses it in the parser/semanting stage and only throws the error when it tries compiling with c++.

Example:

Struct Test
    Field x:Int
    Field y:Int
End

Function Main()

    Local s:=New Test

    If s
        Print "s doesn't exist"
    End

End

Edit: Does actually throw the error making an app as well.

sdl2 mixer decl

In SDL2.monkey2 the following corrects last two arguments to be unsigned.

Function SDL_LoadWAV_RW:SDL_AudioSpec Ptr(src_:SDL_RWops Ptr,freesrc_:Int,spec_:SDL_AudioSpec Ptr,audio_buf_:UByte Ptr Ptr,audio_len_:UInt Ptr)

Ted2 - tab opened for missing file

When Ted2 opens and restores the previous code files, if a file no longer exists a Tab is still created (and blank obviously). I guess the Tab should not be restored but (an optional?) prompt could be provided (not fussed myself on this one) advising file not found.

TED2 crashes

I have this on osx in Ted2 latest version

Ted21 crashes the second time when I run (in debug mode) a “error generated script” or using DebugStop() after not stopping the debug process (red button, in debug view) first.

so here is the full process.

  1. start a error generated script OR a good script using DebugStop() in debug mode
  2. ted2 keeps alive and opens the debug view
  3. on the osx background I kill the program manual (force kill) (not in ted2)
  4. I re run in debug mode (or change some lines first) - ted2 crashes (goes away)
  5. repeat 3.

To solve this, I guess you must clear / invoke that debug stop button (in the debug window) before every start in debug mode

Going in and out of full screen (OS X) causes memory violation

Steps:

  1. Open the viewlayout example in the mojo/bananas folder
  2. Click the green "full screen" button on the top left corner of the window
  3. Once in full screen, hover at the same corner, then click the full screen button again

This did not occur in V004.
Thanks!

MX2CC V0.006
***** Building app '/Applications/Leo/Blitz/monkey2/modules/mojo/bananas/viewlayout/viewlayout.monkey2' *****
Parsing...
Semanting...
Translating...
Compiling....
Linking /Applications/Leo/Blitz/monkey2/modules/mojo/bananas/viewlayout/viewlayout.buildv006/desktop_debug_macos/viewlayout.app/Contents/MacOS/viewlayout
Running /Applications/Leo/Blitz/monkey2/modules/mojo/bananas/viewlayout/viewlayout.buildv006/desktop_debug_macos/viewlayout.app/Contents/MacOS/viewlayout
Window moved to:Vec2(0,0)
Window resized to:Vec2(0,0)
Window resized to:Vec2(1680,1050)
Caught signal:Memory access violation

Event Eaten logic fails in arm environment

This line in event.monkey2[65]

Return (_type & EventType.Eaten)<>Null

needed to be changed to

Return (_type & EventType.Eaten)=EventType.Eaten

to work correctly on pi, otherwise function returns true for any non zero EventType.

json save in ted2 needs correcting

the son save saves as one long line of text, thus breaking the reason to use son - ease of reading

here is a very dirty replacement that adds tabs and new lines:

` local k:Int
local out:string = ""
local str:string = ""
local chr:string
local tab:string = ""
local length:int
for k = 0 to obj.ToJson().Length
chr = obj.ToJson().Mid(k,1)
select chr
case "{", "["
str = str + chr
out = out + str + "~n"
tab = tab + " "
str = tab
case "}", "]"
out = out + str + "~n"
length = tab.Length
tab = tab.Left( length - 2 )
str = tab + chr
case ","
str = str + chr
out = out + str + "~n"
str = tab
default
str = str + chr
end
next
out = out + str + "~n"

    SaveString( out,"bin/ted2.state.json" )

`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.