1. SDL2 Wrapper Not Working Under 4.1.0
- Posted by Icy_Viking Sep 11, 2014
- 2531 views
Hello All,
My SDL2 Wrapper that I wrote in Euphoria does not seem to work in 4.1.0 beta. I even re-wrote it from scratch and nothing appears to be working. No window pops up or nothing. It seems to run, then exits. I've put in checks, but nothing seems to pop up. It does work under 4.0.5
include std/machine.e include flags.ew include EuSDL2.ew atom dummy = SDL_Init(SDL_INIT_VIDEO) if dummy = -1 then puts(1,"Could not init SDL!\n") end if atom win = SDL_CreateWindow("Win",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,640,480,SDL_WINDOW_SHOWN) if win = -1 then puts(1,"Could not create window!\n") end if SDL_Delay(3000) SDL_Quit()
I can upload the re-wrtten version if it is needed. I plan to, I just wanna see if I can get it all to work before I upload it.
Specs: CPU: Intel Core Duo 2 - 2.10 Ghz RAM: 4GB Gfx: Nivida Geforce 8600M GS OS: Windows 7 Ultimate
2. Re: SDL2 Wrapper Not Working Under 4.1.0
- Posted by ghaberek (admin) Sep 12, 2014
- 2491 views
Are you using 64-bit Euphoria 4.1 and a 32-bit DLL? The two will surely be incompatible. You'll need to get a 64-bit DLL or install 32-bit Euphoria 4.1.
-Greg
3. Re: SDL2 Wrapper Not Working Under 4.1.0
- Posted by Icy_Viking Sep 12, 2014
- 2445 views
My OS is 64-bit. However I am using 32-bits Euphoria and the SDL 2 library is 32-bits as well.
4. Re: SDL2 Wrapper Not Working Under 4.1.0
- Posted by Icy_Viking Sep 15, 2014
- 2416 views
So I've noticed that this code runs.
include std/machine.e include EuSDL2.ew clear_screen() atom cpu_count cpu_count = SDL_GetCPUCount() position(1,1) printf(1,"CPUs: %d\n", {cpu_count})
However, this code appears to run, but nothing shows up.
include std/machine.e include EuSDL2.ew atom dummy = SDL_Init(SDL_INIT_VIDEO) if dummy = -1 then puts(1,"Could not init SDL!\n") end if atom win = SDL_CreateWindow("Win",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,640,480,SDL_WINDOW_SHOWN) if win = -1 then puts(1,"Could not create window!\n") end if SDL_Delay(3000) SDL_DestroyWindow(win) SDL_Quit()
Is there something wrong with my flag values?
--Euphoria SDL 2 Init Flags public constant SDL_INIT_TIMER = 1, SDL_INIT_AUDIO = 16, SDL_INIT_VIDEO = 32, SDL_INIT_JOYSTICK = 512, SDL_INIT_HAPTIC = 4096, SDL_INIT_GAMECONTROLLER = 8192, SDL_INIT_EVENTS = 16384, SDL_INIT_NOPARACHUTE = 1048576, SDL_INIT_EVERYTHING = SDL_INIT_TIMER and SDL_INIT_AUDIO and SDL_INIT_VIDEO and SDL_INIT_EVENTS and SDL_INIT_JOYSTICK and SDL_INIT_HAPTIC and SDL_INIT_GAMECONTROLLER public constant SDL_WINDOW_FULLSCREEN = 1, SDL_WINDOW_OPENGL = 2, SDL_WINDOW_SHOWN = 4, SDL_WINDOW_HIDDEN = 8, SDL_WINDOW_BORDERLESS = 16, SDL_WINDOW_RESIZABLE = 32, SDL_WINDOW_MINIMIZED = 64, SDL_WINDOW_MAXIMIZED = 128, SDL_WINDOW_GRABBED = 256, SDL_WINDOW_INPUT_FOCUS = 512, SDL_WINDOW_MOUSE_FOCUS = 1024, SDL_WINDOW_FULLSCREEN_DESKTOP = SDL_WINDOW_FULLSCREEN or 4096, SDL_WINDOW_FOREIGN = 2048, SDL_WINDOW_ALLOW_HIGHDPI = 8192, SDL_WINDOW_MOUSE_CAPTURE = 16384 public constant SDL_WINDOWPOS_UNDEFINED_MASK = 536805376, SDL_WINDOWPOS_UNDEFINED_DISPLAY = SDL_WINDOWPOS_UNDEFINED_MASK, SDL_WINDOWPOS_UNDEFINED = SDL_WINDOWPOS_UNDEFINED_DISPLAY, SDL_WINDOWPOS_ISUNDEFINED = 4294901760 or SDL_WINDOWPOS_UNDEFINED_MASK public constant SDL_WINDOWPOS_CENTERED_MASK = 805240832, SDL_WINDOWPOS_CENTERED_DISPLAY = SDL_WINDOWPOS_CENTERED_MASK, SDL_WINDOWPOS_CENTERED = SDL_WINDOWPOS_CENTERED_DISPLAY, SDL_WINDOWPOS_ISCENTERED = 4294901760 or SDL_WINDOWPOS_CENTERED_MASK public constant SDL_WINDOWEVENT_NONE = 0, SDL_WINDOWEVENT_SHOWN = 1, SDL_WINDOWEVENT_HIDDEN = 2, SDL_WINDOWEVENT_EXPOSED = 3, SDL_WINDOWEVENT_MOVED = 4, SDL_WINDOWEVENT_RESIZED = 5, SDL_WINDOWEVENT_SIZE_CHANGED = 6, SDL_WINDOWEVENT_MINIMIZED = 7, SDL_WINDOWEVENT_MAXIMIZED = 8, SDL_WINDOWEVENT_RESTORED = 9, SDL_WINDOWEVENT_ENTER = 10, SDL_WINDOWEVENT_LEAVE = 11, SDL_WINDOWEVENT_FOCUS_GAINED = 12, SDL_WINDOWEVENT_FOCUS_LOST = 13, SDL_WINDOWEVENT_CLOSE = 14 public constant SDL_GL_RED_SIZE = 0, SDL_GL_GREEN_SIZE = 1, SDL_GL_BLUE_SIZE = 2, SDL_GL_ALPHA_SIZE = 3, SDL_GL_BUFFER_SIZE = 4, SDL_GL_DOUBLEBUFFER = 5, SDL_GL_DEPTH_SIZE = 6, SDL_GL_STENCIL_SIZE = 7, SDL_GL_ACCUM_RED_SIZE = 8, SDL_GL_ACCUM_GREEN_SIZE = 9, SDL_GL_ACCUM_BLUE_SIZE = 10, SDL_GL_ACCUM_ALPHA_SIZE = 11, SDL_GL_STEREO = 12, SDL_GL_MULTISAMPLEBUFFERS = 13, SDL_GL_MULTISAMPLESAMPLES = 14, SDL_GL_ACCELERATED_VISUAL = 15, SDL_GL_RETAINED_BACKING = 16, SDL_GL_CONTEXT_MAJOR_VERSION = 17, SDL_GL_CONTEXT_MINOR_VERSION = 18, SDL_GL_CONTEXT_EGL = 19, SDL_GL_CONTEXT_FLAGS = 20, SDL_GL_CONTEXT_PROFILE_MASK = 21, SDL_GL_SHARE_WITH_CURRENT_CONTEXT = 22, SDL_GL_FRAMEBUFFER_SRGB_CAPABLE = 23 public constant SDL_GL_CONTEXT_PROFILE_CORE = 1, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 2, SDL_GL_CONTEXT_PROFILE_ES = 4 public constant SDL_GL_CONTEXT_DEBUG_FLAG = 1, SDL_GL_CONTEXT_FORWARD_COMPATIABLE_FLAG = 2, SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 4, SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 8 public constant SDL_RENDERER_SOFTWARE = 1, SDL_RENDERER_ACCELERATED = 2, SDL_RENDERER_PRESENTVSYNC = 4, SDL_RENDERER_TARGETTEXTURE = 8 public constant SDL_TEXTUREACCESS_STATIC = 1, SDL_TEXTUREACCESS_STREAMING = 2, SDL_TEXTUREACCES_TARGET = 3 public constant SDL_TEXTUREMODULATE_NONE = 0, SDL_TEXTUREMODULATE_COLOR = 1, SDL_TEXTUREMODULATE_ALPHA = 2 public constant SDL_FLIP_NONE = 0, SDL_FLIP_HORIZONTAL = 1, SDL_FLIP_VERTICAL = 2 public constant SDL_PIXELTYPE_UNKNOWN = 0, SDL_PIXELTYPE_INDEX1 = 1, SDL_PIXELTYPE_INDEX4 = 2, SDL_PIXELTYPE_INDEX8 = 3, SDL_PIXELTYPE_PACKED8 = 4, SDL_PIXELTYPE_PACKED16 = 5, SDL_PIXELTYPE_PACKED32 = 6, SDL_PIXELTYPE_ARRAYU8 = 7, SDL_PIXELTYPE_ARRAYU16 = 8, SDL_PIXELTYPE_ARRAYU32 = 9, SDL_PIXELTYPE_ARRAYF16 = 10, SDL_PIXELTYPE_ARRAYF32 = 11 public constant SDL_BITMAPBORDER_NONE = 0, SDL_BITMAPBORDER_4321 = 1, SDL_BITMAPBORDER_1234 = 2 public constant SDL_PACKEDORDER_NONE = 0, SDL_PACKEDORDER_XRGB = 1, SDL_PACKEDORDER_RGBX = 2, SDL_PACKEDORDER_ARGB = 3, SDL_PACKEDORDER_RGBA = 4, SDL_PACKEDORDER_XBGR = 5, SDL_PACKEDORDER_BGRX = 6, SDL_PACKEDORDER_ABGR = 7, SDL_PACKEDORDER_BGRA = 8 public constant SDL_ARRAYORDER_NONE = 0, SDL_ARRAYORDER_RGB = 1, SDL_ARRAYORDER_RGBA = 2, SDL_ARRAYORDER_ARGB = 3, SDL_ARRAYORDER_BGR = 4, SDL_ARRAYORDER_BGRA = 5, SDL_ARRAYORDER_ABGR = 6 public constant SDL_PACKEDLAYOUT_NONE = 0, SDL_PACKEDLAYOUT_332 = 1, SDL_PACKEDLAYOUT_4444 = 2, SDL_PACKEDLAYOUT_1555 = 3, SDL_PACKEDLAYOUT_5551 = 4, SDL_PACKEDLAYOUT_565 = 5, SDL_PACKEDLAYOUT_8888 = 6, SDL_PACKEDLAYOUT_2101010 = 7, SDL_PACKEDLAYOUT_1010102 = 8 public constant SDL_PIXELFLAG = 1, SDL_PIXELTYPE = 2, SDL_PIXELORDER = 3, SDL_PIXELLAYOUT = 4, SDL_BITSPERPIXEL = 5, SDL_BYTESPERPIXEL = 6 public constant SDL_RWOPS_UNKNOWN = 0, SDL_RWOPS_WINFILE = 1, SDL_RWOPS_STDFILE = 2, SDL_RWOPS_JNIFILE = 3, SDL_RWOPS_MEMORY = 4, SDL_RWOPS_MEMORY_RO = 5 public constant SDL_SWSURFACE = 0, SDL_PREALLOC = 1, SDL_RLEACCEL = 2, SDL_DONTFREE = 4 public constant SDL_SYSWM_UNKNOWN = 0, SDL_SYSWM_WINDOWS = 1, SDL_SYSWM_X11 = 2, SDL_SYSWM_DIRECTFB = 3, SDL_SYSWM_COCOA = 4, SDL_SYSWM_UIKIT = 5, SDL_SYSWM_WAYLAND = 6, SDL_SYSWM_MIR = 7, SDL_SYSWM_WINRT = 8, SDL_SYSWM_ANDROID = 9 public constant SDL_FIRSTEVENT = 0, SDL_QUIT = 256, SDL_APP_LOWMEMORY = 2, SDL_APP_WILLENTERBACKGROUND = 3, SDL_APP_DIDENTERBACKGROUND = 4, SDL_APP_WILLENTERFOREGROUND = 5, SDL_APP_DIDENTERFOREGROUND = 6 public constant SDL_WINDOWEVENT = 512, SDL_SYSWMEVENT = 7 public constant SDL_KEYDOWN = 768, SDL_KEYUP = 8, SDL_TEXTEDITING = 9, SDL_TEXTINPUT = 10 public constant SDL_MOUSEMOTION = 1024, SDL_MOUSEBUTTONDOWN = 11, SDL_MOUSEBUTTONUP = 12, SDL_MOUSEWHEEL = 13 public constant SDL_JOYAXISMOTION = 1536, SDL_JOYBALLMOTION = 14, SDL_JOYHATMOTION = 15, SDL_JOYBUTTONDOWN = 16, SDL_JOYBUTTONUP = 17, SDL_JOYDEVICEADDED = 18, SDL_JOYDEVICEREMOVED = 19 public constant SDL_CONTROLLERAXISMOTION = 1616, SDL_CONTROLLERBUTTONDOWN = 20, SDL_CONTROLLERBUTTONUP = 21, SDL_CONTROLLERDEVICEADDED = 22, SDL_CONTROLLERDEVICEREMOVED = 23, SDL_CONTROLLERDEVICEREMAPPED = 24 public constant SDL_FINGERDOWN = 1792, SDL_FINGERUP = 25, SDL_FINGERMOTION = 26 public constant SDL_DOLLARGESTURE = 2048, SDL_DOLLARRECORD = 27, SDL_MULTIGESTURE = 28 public constant SDL_CLIPBOARDUPDATE = 2304 public constant SDL_DROPFILE = 4096 public constant SDL_RENDER_TARGETS_RESET = 8192, SDL_RENDER_DEVICE_RESET = 29 public constant SDL_USEREVENT = 32768 public constant SDL_LASTEVENT = 65535 public constant SDL_ADDEVENT = 1, SDL_PEEKEVENT = 2, SDL_GETEVENT = 3 public constant SDL_SCANCODE_UNKNOWN = 0, SDL_SCANCODE_A = 4, SDL_SCANCODE_B = 5, SDL_SCANCODE_C = 6, SDL_SCANCODE_D = 7, SDL_SCANCODE_E = 8, SDL_SCANCODE_F = 9, SDL_SCANCODE_G = 10, SDL_SCANCODE_H = 11, SDL_SCANCODE_I = 12, SDL_SCANCODE_J = 13, SDL_SCANCODE_K = 14, SDL_SCANCODE_L = 15, SDL_SCANCODE_M = 16, SDL_SCANCODE_N = 17, SDL_SCANCODE_O = 18, SDL_SCANCODE_P = 19, SDL_SCANCODE_Q = 20, SDL_SCANCODE_R = 21, SDL_SCANCODE_S = 22, SDL_SCANCODE_T = 23, SDL_SCANCODE_U = 24, SDL_SCANCODE_V = 25, SDL_SCANCODE_W = 26, SDL_SCANCODE_X = 27, SDL_SCANCODE_Y = 28, SDL_SCANCODE_Z = 29 public constant SDL_SCANCODE_1 = 30, SDL_SCANCODE_2 = 31, SDL_SCANCODE_3 = 32, SDL_SCANCODE_4 = 33, SDL_SCANCODE_5 = 34, SDL_SCANCODE_6 = 35, SDL_SCANCODE_7 = 36, SDL_SCANCODE_8 = 37, SDL_SCANCODE_9 = 38, SDL_SCANCODE_0 = 39 public constant SDL_SCANCODE_RETURN = 40, SDL_SCANCODE_ESCAPE = 41, SDL_SCANCODE_BACKSPACE = 42, SDL_SCANCODE_TAB = 43, SDL_SCANCODE_SPACE = 44 public constant SDL_SCANCODE_MINUS = 45, SDL_SCANCODE_EQUALS = 46, SDL_SCANCODE_LEFTBRACKET = 47, SDL_SCANCODE_RIGHTBRACKET = 48, SDL_SCANCODE_BACKSLASH = 49 public constant SDL_SCANCODE_NONUSHASH = 50 public constant SDL_SCANCODE_SEMICOLON = 51, SDL_SCANCODE_APOSTROPHE = 52, SDL_SCANCODE_GRAVE = 53 public constant SDL_SCANCODE_COMMA = 54, SDL_SCANCODE_PERIOD = 55, SDL_SCANCODE_SLASH = 56 public constant SDL_SCANCODE_CAPSLOCK = 57 public constant SDL_SCANCODE_F1 = 58, SDL_SCANCODE_F2 = 59, SDL_SCANCODE_F3 = 60, SDL_SCANCODE_F4 = 61, SDL_SCANCODE_F5 = 62, SDL_SCANCODE_F6 = 63, SDL_SCANCODE_F7 = 64, SDL_SCANCODE_F8 = 65, SDL_SCANCODE_F9 = 66, SDL_SCANCODE_F10 = 67, SDL_SCANCODE_F11 = 68, SDL_SCANCODE_F12 = 69 public constant SDL_SCANCODE_PRINTSCREEN = 70, SDL_SCANCODE_SCROLLLOCK = 71, SDL_SCANCODE_PAUSE = 72, SDL_SCANCODE_INSERT = 73 public constant SDL_SCANCODE_HOME = 74, SDL_SCANCODE_PAGEUP = 75, SDL_SCANCODE_DELETE = 76, SDL_SCANCODE_END = 77, SDL_SCANCODE_PAGEDOWN = 78, SDL_SCANCODE_RIGHT = 79, SDL_SCANCODE_LEFT = 80, SDL_SCANCODE_DOWN = 81, SDL_SCANCODE_UP = 82 public constant SDL_SCANCODE_NUMLOCKCLEAR = 83 public constant SDL_SCANCODE_KP_DIVIDE = 84, SDL_SCANCODE_KP_MULTIPLY = 85, SDL_SCANCODE_KP_MINUS = 86, SDL_SCANCODE_KP_PLUS = 87, SDL_SCANCODE_KP_ENTER = 88, SDL_SCANCODE_KP_1 = 89, SDL_SCANCODE_KP_2 = 90, SDL_SCANCODE_KP_3 = 91, SDL_SCANCODE_KP_4 = 92, SDL_SCANCODE_KP_5 = 93, SDL_SCANCODE_KP_6 = 94, SDL_SCANCODE_KP_7 = 95, SDL_SCANCODE_KP_8 = 96, SDL_SCANCODE_KP_9 = 97, SDL_SCANCODE_KP_0 = 98, SDL_SCANCODE_KP_PERIOD = 99 public constant SDL_SCANCODE_NONUSBACKSLASH = 100 public constant SDL_SCANCODE_APPLICATION = 101, SDL_SCANCODE_POWER = 102 public constant SDL_SCANCODE_KP_EQUALS = 103, SDL_SCANCODE_F13 = 104, SDL_SCANCODE_F14 = 105, SDL_SCANCODE_F15 = 106, SDL_SCANCODE_F16 = 107, SDL_SCANCODE_F17 = 108, SDL_SCANCODE_F18 = 109, SDL_SCANCODE_F19 = 110, SDL_SCANCODE_F20 = 111, SDL_SCANCODE_F21 = 112, SDL_SCANCODE_F22 = 113, SDL_SCANCODE_F23 = 114, SDL_SCANCODE_F24 = 115, SDL_SCANCODE_EXECUTE = 116, SDL_SCANCODE_HELP = 117, SDL_SCANCODE_MENU = 118, SDL_SCANCODE_SELECT = 119, SDL_SCANCODE_STOP = 120, SDL_SCANCODE_AGAIN = 121, SDL_SCANCODE_UNDO = 122, SDL_SCANCODE_CUT = 123, SDL_SCANCODE_COPY = 124, SDL_SCANCODE_PASTE = 125, SDL_SCANCODE_FIND = 126, SDL_SCANCODE_MUTE = 127, SDL_SCANCODE_VOLUMEUP = 128, SDL_SCANCODE_VOLUMEDOWN = 129, SDL_SCANCODE_LOCKINGCAPSLOCK = 130, SDL_SCANCODE_LOCKINGNUMLOCK = 131, SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, SDL_SCANCODE_KP_COMMA = 133, SDL_SCANCODE_KP_EQUALS400 = 134 public constant SDL_SCANCODE_INTERNATIONAL1 = 135, SDL_SCANCODE_INTERNATIONAL2 = 136, SDL_SCANCODE_INTERNATIONAL3 = 137, SDL_SCANCODE_INTERNATIONAL4 = 138, SDL_SCANCODE_INTERNATIONAL5 = 139, SDL_SCANCODE_INTERNATIONAL6 = 140, SDL_SCANCODE_INTERNATIONAL7 = 141, SDL_SCANCODE_INTERNATIONAL8 = 142, SDL_SCANCODE_INTERNATIONAL9 = 143, SDL_SCANCODE_LANG1 = 144, SDL_SCANCODE_LANG2 = 145, SDL_SCANCODE_LANG3 = 146, SDL_SCANCODE_LANG4 = 147, SDL_SCANCODE_LANG5 = 148, SDL_SCANCODE_LANG6 = 149, SDL_SCANCODE_LANG7 = 150, SDL_SCANCODE_LANG8 = 151, SDL_SCANCODE_LANG9 = 152 public constant SDL_SCANCODE_ALTERASE = 153, SDL_SCANCODE_SYSREQ = 154, SDL_SCANCODE_CANCEL = 155, SDL_SCANCODE_CLEAR = 156, SDL_SCANCODE_PRIOR = 157, SDL_SCANCODE_RETURN2 = 158, SDL_SCANCODE_SEPARATOR = 159, SDL_SCANCODE_OUT = 160, SDL_SCANCODE_OPER = 161, SDL_SCANCODE_CLEARAGAIN = 162, SDL_SCANCODE_CRSEL = 163, SDL_SCANCODE_EXSEL = 164 public constant SDL_SCANCODE_KP_00 = 176, SDL_SCANCODE_KP_000 = 177, SDL_SCANCODE_THOUNSANDSEPARATOR = 178, SDL_SCANCODE_DECIMALSEPARATOR = 179, SDL_SCANCODE_CURRENCYUNIT = 180, SDL_SCANCODE_CURRENCYSUBUNIT = 181, SDL_SCANCODE_KP_LEFTPAREN = 182, SDL_SCANCODE_KP_RIGHTPAREN = 183, SDL_SCANCODE_KP_LEFTBRACE = 184, SDL_SCANCODE_KP_RIGHTBRACE = 185, SDL_SCANCODE_KP_TAB = 186, SDL_SCANCODE_KP_BACKSPACE = 187, SDL_SCANCODE_KP_A = 188, SDL_SCANCODE_KP_B = 189, SDL_SCANCODE_KP_C = 190, SDL_SCANCODE_KP_D = 191, SDL_SCANCODE_KP_E = 192, SDL_SCANCODE_KP_F = 193, SDL_SCANCODE_KP_XOR = 194, SDL_SCANCODE_KP_POWER = 195, SDL_SCANCODE_KP_PERCENT = 196, SDL_SCANCODE_KP_LESS = 197, SDL_SCANCODE_KP_GREATER = 198, SDL_SCANCODE_KP_AMPERSAND = 199, SDL_SCANCODE_KP_DBLAMPERSAND = 200, SDL_SCANCODE_KP_VERTICALBAR = 201, SDL_SCANCODE_KP_COLON = 203, SDL_SCANCODE_KP_HASH = 204, SDL_SCANCODE_KP_SPACE = 205, SDL_SCANCODE_KP_AT = 206, SDL_SCANCODE_KP_EXCLAM = 207, SDL_SCANCODE_KP_MEMSTORE = 208, SDL_SCANCODE_KP_MEMRECALL = 209, SDL_SCANCODE_KP_MEMCLEAR = 210, SDL_SCANCODE_KP_MEMADD = 211, SDL_SCANCODE_KP_MEMSUBTRACT = 212, SDL_SCANCODE_KP_MEMMULTIPLY = 213, SDL_SCANCODE_KP_MEMDIVIDE = 214, SDL_SCANCODE_KP_PLUSMINUS = 215, SDL_SCANCODE_KP_CLEAR = 216, SDL_SCANCODE_KP_CLEARENTRY = 217, SDL_SCANCODE_KP_BINARY = 218, SDL_SCANCODE_KP_OCTAL = 219, SDL_SCANCODE_KP_DECIMAL = 220, SDL_SCANCODE_KP_HEXADECIMAL = 221 public constant SDL_SCANCODE_LCTRL = 224, SDL_SCANCODE_LSHIFT = 225, SDL_SCANCODE_LALT = 226, SDL_SCANCODE_LGUI = 227, SDL_SCANCODE_RCTRL = 228, SDL_SCANCODE_RSHIFT = 229, SDL_SCANCODE_RALT = 230, SDL_SCANCODE_RGUI = 231 public constant SDL_SCANCODE_MODE = 257 public constant SDL_SCANCODE_AUDIONEXT = 258, SDL_SCANCODE_AUDIOPREV = 259, SDL_SCANCODE_AUDIOSTOP = 260, SDL_SCANCODE_AUDIOPLAY = 261, SDL_SCANCODE_AUDIOMUTE = 262, SDL_SCANCODE_MEDIASELECT = 263, SDL_SCANCODE_WWW = 264, SDL_SCANCODE_MAIL = 265, SDL_SCANCODE_CALCULATOR = 266, SDL_SCANCODE_COMPUTER = 267, SDL_SCANCODE_AC_SEARCH = 268, SDL_SCANCODE_AC_HOME = 269, SDL_SCANCODE_AC_BACK = 270, SDL_SCANCODE_AC_FORWARD = 271, SDL_SCANCODE_AC_STOP = 272, SDL_SCANCODE_AC_REFRESH = 273, SDL_SCANCODE_AC_BOOKMARKS = 274 public constant SDL_SCANCODE_BRIGHTNESSDOWN = 275, SDL_SCANCODE_BRIGHTNESSUP = 276, SDL_SCANCODE_DISPLAYSWITCH = 277 public constant SDL_SCANCODE_KBDILLUMTOGGLE = 278, SDL_SCANCODE_KBDILLUMDOWN = 279, SDL_SCANCODE_KBDILLUMUP = 280, SDL_SCANCODE_EJECT = 281, SDL_SCANCODE_SLEEP = 282, SDL_SCANCODE_APP1 = 283, SDL_SCANCODE_APP2 = 284 public constant SDL_NUM_SCANCODES = 512 public enum SDL_SYSTEM_CURSOR_ARROW, SDL_SYSTEM_CURSOR_IBEAM, SDL_SYSTEM_CURSOR_WAIT, SDL_SYSTEM_CURSOR_CROSSHAIR, SDL_SYSTEM_CURSOR_WAITARROW, SDL_SYSTEM_CURSOR_SIZENWSE, SDL_SYSTEM_CURSOR_SIZENESW, SDL_SYSTEM_CURSOR_SIZEWE, SDL_SYSTEM_CURSOR_SIZENS, SDL_SYSTEM_CURSOR_SIZEALL, SDL_SYSTEM_CURSOR_NO, SDL_SYSTEM_CURSOR_HAND, SDL_NUM_SYSTEM_CURSORS public constant SDL_BUTTON = 1, SDL_BUTTON_LEFT = 1, SDL_BUTTON_MIDDLE = 2, SDL_BUTTON_RIGHT = 3, SDL_BUTTON_X1 = 4, SDL_BUTTON_X2 = 5, SDL_BUTTON_LMASK = SDL_BUTTON_LEFT, SDL_BUTTON_MMASK = SDL_BUTTON_MIDDLE, SDL_BUTTON_RMASK = SDL_BUTTON_RIGHT, SDL_BUTTON_X1MASK = SDL_BUTTON_X1, SDL_BUTTON_X2MASK = SDL_BUTTON_X2 public constant SDL_HAT_CENTERED = 0, SDL_HAT_UP = 1, SDL_HAT_RIGHT = 2, SDL_HAT_DOWN = 4, SDL_HAT_LEFT = 8, SDL_HAT_RIGHTUP = SDL_HAT_RIGHT and SDL_HAT_UP, SDL_HAT_RIGHTDOWN = SDL_HAT_RIGHT and SDL_HAT_DOWN, SDL_HAT_LEFTUP = SDL_HAT_LEFT and SDL_HAT_UP, SDL_HAT_LEFTDOWN = SDL_HAT_LEFT and SDL_HAT_DOWN public constant SDL_CONTROLLER_BINDTYPE_NONE = 0, SDL_CONTROLLER_BINDTYPE_BUTTON = 1, SDL_CONTROLLER_BINDTYPE_AXIS = 2, SDL_CONTROLLER_BINDTYPE_HAT = 3 public constant SDL_CONTROLLER_AXIS_INVALID = -1, SDL_CONTROLLER_AXIS_LEFTX = 1, SDL_CONTROLLER_AXIS_LEFTY = 2, SDL_CONTROLLER_AXIS_RIGHTX = 3, SDL_CONTROLLER_AXIS_RIGHTY = 4, SDL_CONTROLLER_AXIS_TRIGGERLEFT = 5, SDL_CONTROLLER_AXIS_TRIGGERIGHT = 6, SDL_CONTROLLER_AXIS_MAX = 7 public constant SDL_CONTROLLER_BUTTON_INVALID = -1, SDL_CONTROLLER_BUTTON_A = 1, SDL_CONTROLLER_BUTTON_B = 2, SDL_CONTROLLER_BUTTON_X = 3, SDL_CONTROLLER_BUTTON_Y = 4, SDL_CONTROLLER_BUTTON_BACK = 5, SDL_CONTROLLER_BUTTON_GUIDE = 6, SDL_CONTROLLER_BUTTON_START = 7, SDL_CONTROLLER_BUTTON_LEFTSTICK = 8, SDL_CONTROLLER_BUTTON_RIGHTSTICK = 9, SDL_CONTROLLER_BUTTON_LEFTSHOULDER = 10, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER = 11, SDL_CONTROLLER_BUTTON_DPAD_UP = 12, SDL_CONTROLLER_BUTTON_DPAD_DOWN = 13, SDL_CONTROLLER_BUTTON_DPAD_LEFT = 14, SDL_CONTROLLER_BUTTON_DPAD_RIGHT = 15, SDL_CONTROLLER_BUTTON_MAX = 16 public constant SDL_HAPTIC_CONSTANT = 1, SDL_HAPTIC_SINE = 2, SDL_HAPTIC_LEFTRIGHT = 3, SDL_HAPTIC_SQUARE = 4, SDL_HAPTIC_TRIANGLE = 5, SDL_HAPTIC_SAWTOOTHUP = 6, SDL_HAPTIC_SAWTOOTHDOWN = 7, SDL_HAPTIC_RAMP = 8, SDL_HAPTIC_SPRING = 9, SDL_HAPTIC_DAMPER = 10, SDL_HAPTIC_INTERTIA = 11, SDL_HAPTIC_FRICTION = 12, SDL_HAPTIC_CUSTOM = 13, SDL_HAPTIC_GAIN = 14, SDL_HAPTIC_AUTOCENTER = 15, SDL_HAPTIC_STATUS = 16, SDL_HAPTIC_PAUSE = 17 public constant SDL_HAPTIC_POLAR = 0, SDL_HAPTIC_CARTESIAN = 1, SDL_HAPTIC_SPHERICAL = 2, SDL_HAPTIC_INFINITY = 285960729237 public constant SDL_AUDIO_MASK_BITSIZE = 255, SDL_AUDIO_MASK_DATATYPE = 18, SDL_AUDIO_MASK_ENDIAN = 112, SDL_AUDIO_MASK_SIGNED = 115, SDL_AUDIO_BITSIZE = SDL_AUDIO_MASK_BITSIZE, SDL_AUDIO_ISFLOAT = SDL_AUDIO_MASK_DATATYPE, SDL_AUDIO_ISBIGENDIAN = SDL_AUDIO_MASK_ENDIAN, SDL_AUDIO_ISSIGNED = SDL_AUDIO_MASK_SIGNED, SDL_AUDIO_ISINT = SDL_AUDIO_ISFLOAT, SDL_AUDIO_ISLITTLEENDIAN = SDL_AUDIO_ISBIGENDIAN, SDL_AUDIO_ISUNSIGNED = SDL_AUDIO_ISSIGNED public constant AUDIO_U8 = 8, AUDIO_S8 = 32776, AUDIO_U16LSB = 16, AUDIO_S16LSB = 32784, AUDIO_U16MSB = 4112, AUDIO_S16MSB = 36880, AUDIO_U16 = AUDIO_U16LSB, AUDIO_S16 = AUDIO_S16LSB public constant AUDIO_S32LSB = 32800, AUDIO_S32MSB = 36896, AUDIO_S32 = AUDIO_S32LSB public constant AUDIO_F32LSB = 33056, AUDIO_F32MSB = 37152, AUDIO_F32 = AUDIO_F32LSB public constant SDL_AUDIO_ALLOW_FREQUENCY_CHANGE = 1, SDL_AUDIO_ALLOW_FORMAT_CHANGE = 2, SDL_AUDIO_ALLOW_CHANNELS_CHANGE = 4, SDL_AUDIO_ALLOW_ANY_CHANGE = SDL_AUDIO_ALLOW_FREQUENCY_CHANGE or SDL_AUDIO_ALLOW_FORMAT_CHANGE or SDL_AUDIO_ALLOW_CHANNELS_CHANGE public constant SDL_THREAD_PRIORITY_LOW = 1, SDL_THREAD_PRIORITY_NORMAL = 2, SDL_THREAD_PRIORITY_HIGH = 3 public constant SDL_MUTEX_TIMEDOUT = 1, SDL_MUTEX_MAXWAIT = 0 public enum SDL_POWERSTATE_UNKNOWN, SDL_POWERSTATE_ON_BATTERY, SDL_POWERSTATE_NO_BATTERY, SDL_POWERSTATE_CHARGING, SDL_POWERSTATE_CHARGED
I know the flags might be alot to go through, but any help is appericated.
5. Re: SDL2 Wrapper Not Working Under 4.1.0
- Posted by ghaberek (admin) Sep 15, 2014
- 2353 views
Is there something wrong with my flag values?
public constant SDL_INIT_TIMER = 1, SDL_INIT_AUDIO = 16, SDL_INIT_VIDEO = 32, SDL_INIT_JOYSTICK = 512, SDL_INIT_HAPTIC = 4096, SDL_INIT_GAMECONTROLLER = 8192, SDL_INIT_EVENTS = 16384, SDL_INIT_NOPARACHUTE = 1048576, SDL_INIT_EVERYTHING = SDL_INIT_TIMER and SDL_INIT_AUDIO and SDL_INIT_VIDEO and SDL_INIT_EVENTS and SDL_INIT_JOYSTICK and SDL_INIT_HAPTIC and SDL_INIT_GAMECONTROLLER
Yes. I can see right here that you've got a problem.
The keywords and and or are logical or boolean (true/false) operators not bitwise (flags/math) operations. You'll need to use the library function or_all() to combine flags.
include std/math.e public constant SDL_INIT_TIMER = 1, SDL_INIT_AUDIO = 16, SDL_INIT_VIDEO = 32, SDL_INIT_JOYSTICK = 512, SDL_INIT_HAPTIC = 4096, SDL_INIT_GAMECONTROLLER = 8192, SDL_INIT_EVENTS = 16384, SDL_INIT_NOPARACHUTE = 1048576, SDL_INIT_EVERYTHING = or_all({ SDL_INIT_TIMER, SDL_INIT_AUDIO, SDL_INIT_VIDEO, SDL_INIT_EVENTS, SDL_INIT_JOYSTICK, SDL_INIT_HAPTIC, SDL_INIT_GAMECONTROLLER })
If you're translating Euphoria constants from C macros, you'll need to be aware of the difference between boolean and bitwise operations.
operation | C | Euphoria |
---|---|---|
bitwise AND | & | and_bits() function |
bitwise OR | | | or_bits() or or_all() function |
bitwise XOR | ^ | xor_bits() function |
bitwise NOT | ~ | not_bits() function |
boolean AND | && | and keyword |
boolean OR | || | or keyword |
boolean NOT | ! | not keyword |
Hope this helps.
-Greg
P.S. If you have a lot of code to share, try using Pastey (link on the right of this page under Misc Menu) instead of dumping it all into the discussion directly.
6. Re: SDL2 Wrapper Not Working Under 4.1.0
- Posted by Icy_Viking Sep 15, 2014
- 2388 views
Is there something wrong with my flag values?
public constant SDL_INIT_TIMER = 1, SDL_INIT_AUDIO = 16, SDL_INIT_VIDEO = 32, SDL_INIT_JOYSTICK = 512, SDL_INIT_HAPTIC = 4096, SDL_INIT_GAMECONTROLLER = 8192, SDL_INIT_EVENTS = 16384, SDL_INIT_NOPARACHUTE = 1048576, SDL_INIT_EVERYTHING = SDL_INIT_TIMER and SDL_INIT_AUDIO and SDL_INIT_VIDEO and SDL_INIT_EVENTS and SDL_INIT_JOYSTICK and SDL_INIT_HAPTIC and SDL_INIT_GAMECONTROLLER
Yes. I can see right here that you've got a problem.
The keywords and and or are logical or boolean (true/false) operators not bitwise (flags/math) operations. You'll need to use the library function or_all() to combine flags.
include std/math.e public constant SDL_INIT_TIMER = 1, SDL_INIT_AUDIO = 16, SDL_INIT_VIDEO = 32, SDL_INIT_JOYSTICK = 512, SDL_INIT_HAPTIC = 4096, SDL_INIT_GAMECONTROLLER = 8192, SDL_INIT_EVENTS = 16384, SDL_INIT_NOPARACHUTE = 1048576, SDL_INIT_EVERYTHING = or_all({ SDL_INIT_TIMER, SDL_INIT_AUDIO, SDL_INIT_VIDEO, SDL_INIT_EVENTS, SDL_INIT_JOYSTICK, SDL_INIT_HAPTIC, SDL_INIT_GAMECONTROLLER })
If you're translating Euphoria constants from C macros, you'll need to be aware of the difference between boolean and bitwise operations.
operation | C | Euphoria |
---|---|---|
bitwise AND | & | and_bits() function |
bitwise OR | | | or_bits() or or_all() function |
bitwise XOR | ^ | xor_bits() function |
bitwise NOT | ~ | not_bits() function |
boolean AND | && | and keyword |
boolean OR | || | or keyword |
boolean NOT | ! | not keyword |
Hope this helps.
-Greg
P.S. If you have a lot of code to share, try using Pastey (link on the right of this page under Misc Menu) instead of dumping it all into the discussion directly.
Thanks for the help. Also, thanks for the tip. I made the changes, but the SDL window is still not showing up. I added some more flags I forgot and still nothing. I'm beginning to think that there is some sorta compatbility bug with 4.1.0 and SDL2. My wrapper worked fine under 4.0.5. I might have to go back to that.
7. Re: SDL2 Wrapper Not Working Under 4.1.0
- Posted by Jerome Sep 16, 2014
- 2255 views
My SDL2 Wrapper that I wrote in Euphoria does not seem to work in 4.1.0 beta. I even re-wrote it from scratch and nothing appears to be working. No window pops up or nothing. It seems to run, then exits. I've put in checks, but nothing seems to pop up. It does work under 4.0.5
The SDL2 Wrapper available at rapideuphoria.com works for me with 4.1.0 beta on Windoze and Linux. Both computers are 64bit using the 64bit version of SDL2.
C:\Code\EuSDL2>eui -v Euphoria Interpreter v4.1.0 development 64-bit Windows, Using System Memory Revision Date: 2014-01-16 02:53:44, Id: 5783:d41527402a7a
I used this sample program to make sure I could draw to the screen:
include std/machine.e include EuSDL2.ew if SDL_Init(SDL_INIT_VIDEO) = -1 then puts(1,"Could not init SDL!\n") abort(1) end if atom win = SDL_CreateWindow("Win",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,640,480,SDL_WINDOW_SHOWN) atom ren = SDL_CreateRenderer(win, -1, 0) if win = -1 or ren = -1 then puts(1,"Could not create window or renderer!\n") abort(1) end if atom rect = allocate(16) poke4(rect,{100,100,200,100}) SDL_RenderClear(ren) SDL_SetRenderDrawColor(ren,255,0,0,0) SDL_RenderFillRect(ren, rect) SDL_RenderPresent(ren) SDL_Delay(5000) SDL_DestroyWindow(win) SDL_Quit()
If you post your new version, I can try that one too! Maybe there is an issue with the 32bit SDL2/Eu on a 64bit system?
Thanks,
Ira
8. Re: SDL2 Wrapper Not Working Under 4.1.0
- Posted by ryanj Sep 16, 2014
- 2220 views
Thanks for the help. Also, thanks for the tip. I made the changes, but the SDL window is still not showing up. I added some more flags I forgot and still nothing. I'm beginning to think that there is some sorta compatbility bug with 4.1.0 and SDL2. My wrapper worked fine under 4.0.5. I might have to go back to that.
I have noticed that 4.1 is more picky about C data types. My win32api wrappers in FluidAE stopped working when i switched to 4.1, but once I went through and carefully changed all the data types to be more precise (instead of just using C_INT for almost everything), it worked fine. I wonder if that is similar to your problem. Also, I put ? or puts() or pretty_print() statements between each line of code that accesses memory or calls C functions, so i can see exactly how far it gets (and exactly what values are returned/written) before it fails.
9. Re: SDL2 Wrapper Not Working Under 4.1.0
- Posted by Icy_Viking Sep 16, 2014
- 2262 views
My SDL2 Wrapper that I wrote in Euphoria does not seem to work in 4.1.0 beta. I even re-wrote it from scratch and nothing appears to be working. No window pops up or nothing. It seems to run, then exits. I've put in checks, but nothing seems to pop up. It does work under 4.0.5
The SDL2 Wrapper available at rapideuphoria.com works for me with 4.1.0 beta on Windoze and Linux. Both computers are 64bit using the 64bit version of SDL2.
C:\Code\EuSDL2>eui -v Euphoria Interpreter v4.1.0 development 64-bit Windows, Using System Memory Revision Date: 2014-01-16 02:53:44, Id: 5783:d41527402a7a
I used this sample program to make sure I could draw to the screen:
include std/machine.e include EuSDL2.ew if SDL_Init(SDL_INIT_VIDEO) = -1 then puts(1,"Could not init SDL!\n") abort(1) end if atom win = SDL_CreateWindow("Win",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,640,480,SDL_WINDOW_SHOWN) atom ren = SDL_CreateRenderer(win, -1, 0) if win = -1 or ren = -1 then puts(1,"Could not create window or renderer!\n") abort(1) end if atom rect = allocate(16) poke4(rect,{100,100,200,100}) SDL_RenderClear(ren) SDL_SetRenderDrawColor(ren,255,0,0,0) SDL_RenderFillRect(ren, rect) SDL_RenderPresent(ren) SDL_Delay(5000) SDL_DestroyWindow(win) SDL_Quit()
If you post your new version, I can try that one too! Maybe there is an issue with the 32bit SDL2/Eu on a 64bit system?
Thanks,
Ira
Ah, that is interesting. It works while using the 64-bit version of Eu 4.1.0 and SDL2 64-bit. However there seems to be an issue with the 32-bit version. I'll upload what I have re-wrote, and see if anyone can help me with this.
http://www.rapideuphoria.com/uploads/eusdl2.zip - Here's the temporary link for the new version, I re-wrote from scratch. It is all 32-bit.
Ok so I got it to work using 64-bit Euphoria and 64-bit SDL. So there appears to be a comptatbility issue with 32 and 64-bit OS and Euphoria.
10. Re: SDL2 Wrapper Not Working Under 4.1.0
- Posted by Jerome Sep 16, 2014
- 2219 views
Ah, that is interesting. It works while using the 64-bit version of Eu 4.1.0 and SDL2 64-bit. However there seems to be an issue with the 32-bit version. I'll upload what I have re-wrote, and see if anyone can help me with this.
http://www.rapideuphoria.com/uploads/eusdl2.zip - Here's the temporary link for the new version, I re-wrote from scratch. It is all 32-bit.
Ok so I got it to work using 64-bit Euphoria and 64-bit SDL. So there appears to be a comptatbility issue with 32 and 64-bit OS and Euphoria.
It gets better; the new version of the library does work for me on 64bit Linux using 32bit Eu/SDL2. It seems that it is just Windoze that is having trouble with 32bit Eu/SDL2.
-Ira
11. Re: SDL2 Wrapper Not Working Under 4.1.0
- Posted by Icy_Viking Sep 16, 2014
- 2195 views
Yes it appears that 64-bit is the only one working under 4.1.0 as of right now.
Can someone help me with this? When I try to run the code below, it says bad routine number (1). It appears I am not doing something right when loading images in SDL, or perhaps I am not going about it the correct way?
include std/get.e include std/io.e include std/machine.e include EuSDL2.ew atom dummy = SDL_Init(SDL_INIT_EVERYTHING) if dummy = -1 then puts(1,"Could not initailize SDL!\n") abort(1) end if atom win = SDL_CreateWindow("Win",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,640,480,SDL_WINDOW_SHOWN) atom surf = SDL_GetWindowSurface(win) atom pic = SDL_LoadBMP("EPic.bmp") atom rect = allocate(16) poke4(rect,{100,100,100,100}) if win = -1 then puts(1,"Could not create window!\n") abort(1) end if atom key = 0 atom running = 1 while running = 1 do SDL_PumpEvents() key = SDL_GetKeyboardState(key) if (peek(key+SDL_SCANCODE_ESCAPE) > 0) then running = 0 end if dummy = SDL_BlitSurface(pic,0,win,rect) --Here it says bad routine number (1) SDL_UpdateWindowSurface(win) end while SDL_FreeSurface(pic) SDL_FreeSurface(surf) SDL_DestroyWindow(win) SDL_Quit()
12. Re: SDL2 Wrapper Not Working Under 4.1.0
- Posted by mattlewis (admin) Sep 17, 2014
- 2138 views
It gets better; the new version of the library does work for me on 64bit Linux using 32bit Eu/SDL2. It seems that it is just Windoze that is having trouble with 32bit Eu/SDL2.
I think there is a problem with 32-bit Windows and C calls on 4.1 right now but I haven't tracked it down yet.
Matt
13. Re: SDL2 Wrapper Not Working Under 4.1.0
- Posted by Icy_Viking Sep 19, 2014
- 2040 views
I have released the new re-written EuSDL2. It includes some sample programs, and I provided some basic documentation. Any other help is greatly appericated. It is 64-bit for now.