About Monkey 2 › Forums › General Programming Discussion › Monkey2
This topic contains 6 replies, has 5 voices, and was last updated by 
 cocon 1 year, 12 months ago.
- 
		AuthorPosts
 - 
		
			
				
December 1, 2016 at 6:07 pm #5537
so I have just found this website and I like the idear of monkey2(maybe not the name though)
how close to blitzmax is it going to be? I never used monkey one as Max still works but struts , pointers etc sound way to good to not at least look at.
im going through a book “real time rendering with DX and hlsl” and there is a precompiled lib could I bring this into monkey2? as I couldn’t get it to work with max.
also has any one redone the nehe tuts yet and if so were are they as I cant find many tuts that interest me yet.
December 4, 2016 at 6:51 am #5577how close to blitzmax is it going to be? I never used monkey one as Max still works but struts
I never used Max…
and there is a precompiled lib could I bring this into monkey2? as I couldn’t get it to work with max
Theoretically Yes but it may require a lot of work depending on the size and complications you’ll encounter
from the docs:
System Imports
System files are files that are generally provided with the compiler toolset, and that the compiler and/or linker are configured to find automatically. Monkey2 recognizes the following system file types:
System file type suffix————System file type
.o, .obj, .a, .lib—————–Static library.
.so, .dll, .dylib——————Dynamic library.
.framework————————-MacOS framework.
.h, .hh, .hpp———————-C/C++/Objective C header.
.monkey2—————————Monkey2 module.also has any one redone the nehe tuts yet
Don’t know for Nehe but some people played with Opengl/monkey2 if you look in the formus..
For basic Monkey2 there’s this one :
https://github.com/Pakz001/Monkey2examplesAnd the bananas, examples in the official monkey2 releases (I think there’s some opengl stuff in there?):
https://github.com/blitz-research/monkey2/tree/master/bananasI also put most of my learning examples in a repo but it’s just some specific little things, some for external calls:
https://github.com/abakobo/learn_monkey2There isn’t much for now. Most of what I learnt was with these or by reading most of the posts on this forum. When I have more time I hope I can start some tutos with examples and stuffs because MX2 needs it! But i’m not into GL. I like monkey because it’s at higher level than openGL..
December 7, 2016 at 11:09 pm #5643Thank you for the reply im still trying to figure out using c++ I import the code and setup the Mx2 class but my class has a union in it is there a mx2 version of union?
[code]
class vec2
{
public:
union{
struct{float x, y;};
struct{float s, t;};
struct{float r, g;};
};
vec2() : x(0.0f), y(0.0f){}
~vec2(){}
vec2(float num) : x(num), y(num){}
vec2(float x, float y) : x(x), y(y){}
vec2(const vec2 &u) : x(u.x), y(u.y){}
vec2& operator = (const vec2 &u){x = u.x; y = u.y; return *this;}
vec2 operator - (){return vec2(-x, -y);}
float* operator & (){return (float*)this;};
vec2& operator += (float num){x += num; y += num; return *this;}
vec2& operator += (const vec2 &u){x += u.x; y += u.y; return *this;}
vec2& operator -= (float num){x -= num; y -= num; return *this;}
vec2& operator -= (const vec2 &u){x -= u.x; y -= u.y; return *this;}
vec2& operator *= (float num){x *= num; y *= num; return *this;}
vec2& operator *= (const vec2 &u){x *= u.x; y *= u.y; return *this;}
vec2& operator /= (float num){x /= num; y /= num; return *this;}
vec2& operator /= (const vec2 &u){x /= u.x; y /= u.y; return *this;}
friend vec2 operator + (const vec2 &u, float num){return vec2(u.x + num, u.y + num);}
friend vec2 operator + (float num, const vec2 &u){return vec2(num + u.x, num + u.y);}
friend vec2 operator + (const vec2 &u, const vec2 &v){return vec2(u.x + v.x, u.y + v.y);}
friend vec2 operator - (const vec2 &u, float num){return vec2(u.x - num, u.y - num);}
friend vec2 operator - (float num, const vec2 &u){return vec2(num - u.x, num - u.y);}
friend vec2 operator - (const vec2 &u, const vec2 &v){return vec2(u.x - v.x, u.y - v.y);}
friend vec2 operator * (const vec2 &u, float num){return vec2(u.x * num, u.y * num);}
friend vec2 operator * (float num, const vec2 &u){return vec2(num * u.x, num * u.y);}
friend vec2 operator * (const vec2 &u, const vec2 &v){return vec2(u.x * v.x, u.y * v.y);}
friend vec2 operator / (const vec2 &u, float num){return vec2(u.x / num, u.y / num);}
friend vec2 operator / (float num, const vec2 &u){return vec2(num / u.x, num / u.y);}
friend vec2 operator / (const vec2 &u, const vec2 &v){return vec2(u.x / v.x, u.y / v.y);}
};
float dot(const vec2 &u, const vec2 &v);
float length(const vec2 &u);
float length2(const vec2 &u);
vec2 mix(const vec2 &u, const vec2 &v, float a);
vec2 normalize(const vec2 &u);
vec2 reflect(const vec2 &i, const vec2 &n);
vec2 refract(const vec2 &i, const vec2 &n, float eta);
vec2 rotate(const vec2 &u, float angle);[/code]
it shouldn’t be that hard but I seem to be dim today!
February 10, 2017 at 6:07 pm #7082I have monkey 1 pro version, it’s ok ,
I just tried mx 2 today , tried all the samples,
emscription looks interesting , looks very power and promising.
February 13, 2017 at 12:39 pm #7132I guess you could emulate unions with properties
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142Class VectorField x:FloatField y:FloatProperty s:Float()Return xSetter (n:Float)x = nEndProperty t:Float()Return ySetter (n:Float)y = nEndProperty r:Float()Return xSetter (n:Float)x = nEndProperty g:Float()Return ySetter (n:Float)y = nEndEndFunction Main()Local Vec:= New VectorVec.x = 10Vec.y = 20Print Vec.s+","+Vec.tVec.r = 3.5Vec.g = 17.6Print Vec.x+","+Vec.yEndFebruary 13, 2017 at 6:51 pm #7138the SDL_Event is a union in it’s SDL_events.h
And SDL_Event is declared in extern section as a struct..
Dunno if it will react exactly as a union but sdl2 events works!
SDL_events.h[/crayon]Monkey123456789101112131415161718192021222324252627282930313233343536373839[crayon-5cb9bc624a8f5461698169 inline="true" ]typedef union SDL_Event{Uint32 type; /**< Event type, shared with all events */SDL_CommonEvent common; /**< Common event data */SDL_WindowEvent window; /**< Window event data */SDL_KeyboardEvent key; /**< Keyboard event data */SDL_TextEditingEvent edit; /**< Text editing event data */SDL_TextInputEvent text; /**< Text input event data */SDL_MouseMotionEvent motion; /**< Mouse motion event data */SDL_MouseButtonEvent button; /**< Mouse button event data */SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */SDL_JoyBallEvent jball; /**< Joystick ball event data */SDL_JoyHatEvent jhat; /**< Joystick hat event data */SDL_JoyButtonEvent jbutton; /**< Joystick button event data */SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */SDL_AudioDeviceEvent adevice; /**< Audio device event data */SDL_QuitEvent quit; /**< Quit request event data */SDL_UserEvent user; /**< Custom event data */SDL_SysWMEvent syswm; /**< System dependent window event data */SDL_TouchFingerEvent tfinger; /**< Touch finger event data */SDL_MultiGestureEvent mgesture; /**< Gesture event data */SDL_DollarGestureEvent dgesture; /**< Gesture event data */SDL_DropEvent drop; /**< Drag and drop event data *//* This is necessary for ABI compatibility between Visual C++ and GCCVisual C++ will respect the push pack pragma and use 52 bytes forthis structure, and GCC will use the alignment of the largest datatypewithin the union, which is 8 bytes.So... we'll add padding to force the size to be 56 bytes for both.*/Uint8 padding[56];} SDL_Event;sdl2.monkey2
[/crayon]Monkey12345678910111213141516171819202122232425262728[crayon-5cb9bc624a8fc070132441 inline="true" ]Struct SDL_EventField type:IntField common:SDL_CommonEventField window:SDL_WindowEventField key:SDL_KeyboardEventField edit:SDL_TextEditingEventField text:SDL_TextInputEventField motion:SDL_MouseMotionEventField button:SDL_MouseButtonEventField wheel:SDL_MouseWheelEventField jaxis:SDL_JoyAxisEventField jball:SDL_JoyBallEventField jhat:SDL_JoyHatEventField jbutton:SDL_JoyButtonEventField jdevice:SDL_JoyDeviceEventField caxis:SDL_ControllerAxisEventField cbutton:SDL_ControllerButtonEventField cdevice:SDL_ControllerDeviceEventField adevice:SDL_AudioDeviceEventField quit:SDL_QuitEventField user:SDL_UserEventField syswm:SDL_SysWMEventField tfinger:SDL_TouchFingerEventField mgesture:SDL_MultiGestureEventField dgesture:SDL_DollarGestureEventField drop:SDL_DropEventEndApril 22, 2017 at 8:14 am #7996For the record monkey2 has a Vector2 class, unless you want to increase your experience and writing it yourself.
 - 
		AuthorPosts
 
You must be logged in to reply to this topic.