Code Monkey home page Code Monkey logo

nimx's Introduction

nimx travis nimble

Cross-platform GUI framework in Nim.

Live demo in WebGL

image

Usage

# File: main.nim
import nimx/window
import nimx/text_field

proc startApp() =
    # First create a window. Window is the root of view hierarchy.
    var wnd = newWindow(newRect(40, 40, 800, 600))

    # Create a static text field and add it to view hierarchy
    let label = newLabel(newRect(20, 20, 150, 20))
    label.text = "Hello, world!"
    wnd.addSubview(label)

# Run the app
runApplication:
    startApp()

Running

nim c -r --threads:on main.nim

Supported target platforms ------------Nimx officially supports Linux, MacOS, Windows, Android, iOS and WebAssembly (with Nim C backend and Emscripten, and Emscripten-less compilation is experimental).

Troubleshooting ------------Nimx is tested only against the latest devel version of Nim compiler. Before reporting any issues please verify that your Nim is as fresh as possible.

Running nimx samples

git clone https://github.com/yglukhov/nimx
cd nimx
nimble install -dy
nake # Build and run on the current platform
# or
nake js # Build and run in default web browser

Reference

See the docs for more information.

nimx's People

Contributors

apense avatar bogdan-voevoda avatar bopohdark avatar bromund avatar clyybber avatar denysrisukhin avatar dom96 avatar forlan-ua avatar fowlmouth avatar gpicron avatar iffy avatar imalento avatar jlp765 avatar kb2ma avatar kobi2187 avatar logc avatar ment1na avatar nikitinator avatar q-master avatar qqquinta avatar quantimnot avatar rrenderr avatar s-oram avatar sspkrolik avatar timotheecour avatar tormund avatar windgo-inc avatar xland avatar yglukhov avatar zdreni 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nimx's Issues

errors on compiling on windows

win10, nim x64

.nimble\pkgs\nimx-0.1\nimx\font.nim(244, 26) Error: type mismatch: got (stbtt_fontinfo, ptr font_type, int literal(0)) but expected one of: proc stbtt_InitFont(info: var stbtt_fontinfo; data: font_type; fontstart: cint): cint

if I delete ptr from stbtt_InitFont(fontinfo, cast[ptr font_type](rawData.cstring), 0):

.nimble\pkgs\nimx-0.1\nimx\view.nim(369, 14) template/generic instantiation from here .nimble\pkgs\nimx-0.1\nimx\class_registry.nim(49, 25) template/generic instantiation from here .nimble\pkgs\nimx-0.1\nimx\class_registry.nim(31, 32) template/generic instantiation from here .nimble\pkgs\variant-0.1.0\variant.nim(29, 46) Error: no generic parameters allowed for ref

cannot open 'private/edtaa3func'

When trying to compile rod with nake, I have the following error:
/home/wan/.nimble/pkgs/nimx-0.1/nimx/font.nim(16, 15) Error: cannot open 'private/edtaa3func'
Maybe it's a file that hasn't been committed to the nimx repo?

TextField

TextField allows writing over the bounding border , it is not clear from the test sample programs
how to limit this. I think the behavior should be horizontal scrolling within the border of the
TextField.

image.nim(594, 17) Error: undeclared field: 'statusCode'

I am using MSYS2+MingW64 on Win7 64 bits. But $ ./nim c -r --noMain --threads:on /e/prg/nim/my_code/test_nimx.nim says .nimble\pkgs\nimx-0.1\nimx\image.nim(594, 17) Error: undeclared field: 'statusCode'

the test_nimx.nim is just your demo

# File: main.nim
import nimx.window
import nimx.text_field
import nimx.system_logger # Required because of Nim bug (#4433)

proc startApp() =
    # First create a window. Window is the root of view hierarchy.
    var wnd = newWindow(newRect(40, 40, 800, 600))

    # Create a static text field and add it to view hierarchy
    let label = newLabel(newRect(20, 20, 150, 20))
    label.text = "Hello, world!"
    wnd.addSubview(label)

# Run the app
runApplication:
    startApp()

truetype font path

Please add

/usr/share/fonts/truetype

in font.nim abt line 351

this is the openSuse default truetype path

Multi-line text widget

Is there one yet? I couldn't find one.

Would it be best to use a table in the meantime?

Uncommitted source file?

nimx/private/font/stb_ttf_glyph_provider.nim has a lot of references to stbtt* which it neither imports nor defines and which naturally block successful compilation. Those symbols seem to come from some c2nim + much manual work on Sean Barrett's stb_truetype.h. [ I made a brief attempt post c2nim, but it seems like a lot of manual work. ]

can not run example from Readme

Hi, I just installed nimx via nimble on Ubuntu 16.04 and tried to run the example from the Readme with nim devel, but get the following error:

$ nim c -r --noMain --threads:on main.nim
.....
/home/pahl/.nimble/pkgs/variant-0.1.0/variant.nim(69) getTypeId
/home/pahl/.nimble/pkgs/variant-0.1.0/variant.nim(69) getTypeId(62) mangledName
/home/pahl/.nimble/pkgs/variant-0.1.0/variant.nim(69) getTypeId(62) mangledName(29) mangledName
/home/pahl/.nimble/pkgs/variant-0.1.0/variant.nim(69) getTypeId(62) mangledName(29) mangledName(29) mangledName
/home/pahl/.nimble/pkgs/variant-0.1.0/variant.nim(69) getTypeId(62) mangledName(29) mangledName(29) mangledName(40) mangledName
lib/system.nim(3416)     failedAssertImpl
lib/system.nim(3408)     raiseAssert
lib/system.nim(2547)     sysFatal
/home/pahl/.nimble/pkgs/nimx-0.1/nimx/view.nim(362, 7) template/generic instantiation from here
/home/pahl/.nimble/pkgs/nimx-0.1/nimx/property_visitor.nim(64, 39) template/generic instantiation from here
/home/pahl/.nimble/pkgs/variant-0.1.0/variant.nim(69) getTypeId(62) mangledName(29) mangledName(29) mangledName(40) mangledName(111, 30) template/generic instantiation from here
lib/system.nim(2547, 7) Error: unhandled exception: false

GL_VIEWPORT

In the main example in the README, the first import fails because GL_VIEWPORT can't be found. Changing this to its value directly (2978) works. Not sure if the error is here or in the opengl package.
Using win8.1 x64, btw.

problem with empty "NIMX_RES_PATH"

I get an error when compiling the any code sample with nimx:
stack trace: (most recent call last) nimx/resource_cache.nim(140) getResourceNames nimx/resource_cache.nim(128) getEnvCt lib/pure/strutils.nim(2242) removeSuffix lib/pure/strutils.nim(2242, 9) Error: index out of bounds

This problem disappears when I use
$ export NIMX_RES_PATH="123"

feature request: MenuBar

Would be nice for newbies not to have to build their own menubar each time they want a standard "windows" with the usual File|Edit|....|Help menu bar across the top (or whichever side)

Error: cannot open 'nimx/window'

Getting this error on Linux Mint 18 while trying to compile the simple example given below:

import nimx.window
import nimx.text_field
import nimx.system_logger # Required because of Nim bug (#4433)

proc startApp() =
    # First create a window. Window is the root of view hierarchy.
    var wnd = newWindow(newRect(40, 40, 800, 600))

    # Create a static text field and add it to view hierarchy
    let label = newLabel(newRect(20, 20, 150, 20))
    label.text = "Hello, world!"
    wnd.addSubview(label)

runApplication:
    startApp()

To be clear: I am using Nim version 0.17.0

could not load: libSDL2.so [under Ubuntu 16.04.2]

Running on Ubuntu 16.04.2 (to be accurate, it's an Ubuntu fork called elementaryOS), nim 0.17.0 (2017-05-17).

Trying to compile an example from the README:
nim c -r --noMain --threads:on main.nim

What I get after the compilation:

could not load: libSDL2.so
compile with -d:nimDebugDlOpen for more information
Error: execution of an external program failed: '/home/vladyio/projects/nim/Tutz/tutzui/main '

Running with -d:nimDebugDlOpen prints out just libSDL2.so: cannot open shared object file: No such file or directory

As far as I understand I have libSDL installed on my system since ls /usr/lib/x86_64-linux-gnu/ | grep libSD gives the following:

libSDL-1.2.so.0
libSDL-1.2.so.0.11.4
libSDL2-2.0.so.0
libSDL2-2.0.so.0.4.0
libSDL.a
libSDL_image-1.2.so.0
libSDL_image-1.2.so.0.8.4
libSDLmain.a
libSDL_mixer-1.2.so.0
libSDL_mixer-1.2.so.0.12.0
libSDL.so

Maybe I have to set up some symlinks for the library or anything else? Where must I put the libSDL file?

demo crash

nim c -r --threads:on --noMain main.nim
Animation was not played before cancelling!
Animation was not played before cancelling!
Traceback (most recent call last)
main.nim(92)             main
sdl_window.nim(321)      runUntilQuit
sdl_window.nim(301)      nextEvent
sdl_window.nim(252)      handleEvent
app.nim(52)              handleEvent
window_event_handling.nim(31) handleEvent
window_event_handling.nim(35) handleEvent
view_event_handling_new.nim(137) processTouchEvent
view_event_handling_new.nim(104) processOnlyTouchEvents
view_event_handling_new.nim(137) processTouchEvent
view_event_handling_new.nim(104) processOnlyTouchEvents
view_event_handling_new.nim(137) processTouchEvent
view_event_handling_new.nim(89) processOnlyTouchEvents
view_event_handling_new.nim(13) onTouchEv
button.nim(265)          onTouchEv
control.nim(12)          sendAction
button.nim(233)          sendAction
control.nim(14)          sendAction
control.nim(28)          :anonymous
sample06_timers.nim(52)  :anonymous
system.nim(344)          resume
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Error: execution of an external program failed: '/home/user/.nimble/pkgs/nimx-0.1/test/main '

Tried font '\Windows\Fonts\Arial.ttf' with no luck

on windows 10
Hint: [Link]
Hint: operation successful (46607 lines compiled; 1.846 sec total; 51.522MB; Debug Build) [SuccessX]
Shader compile log: WARNING: 0:1: '' : #version directive missing

Shader compile log: WARNING: 0:6: '' : #version directive missing

Shader compile log: WARNING: 0:1: '' : #version directive missing

Shader compile log: WARNING: 0:6: '' : #version directive missing

Tried font '\Windows\Fonts\Arial.ttf' with no luck
WARNING: Could not create system font
Error: execution of an external program failed

Please clarify license

TL;DR: please add the BSD license file.

There is no license file for this project. The nimble metadata says "BSD", which would have been sufficient for a license that doesn't have vastly different variants, but there's ambiguity if you mean BSD2, BSD3, or the horribly restrictive BSD4. I personally use the Unlicense for all my works, but any license on the copyfree.org white-list would also be OK.

I am promoting Nim as, among its many other virtues, a programming language with the most no-hassle unencumbered no-lawyers-needed permissively-licensed ecosystem. 89% of nimble packages fit the copyfree.org definition of free software, compared for example to 81% to runner-up cabal or 64% for npm. Towards this end, it is important to resolve any ambiguities in the licensing.

Thank you very much for all your great contributions to the Nim ecosystem! πŸ‘

Error running main nimx example code.

I followed the instructions but when I compiled/ran the example I get:

~/.nimble/pkgs/nimx-0.1/nimx/view.nim(400, 14) template/generic instantiation from here
~/.nimble/pkgs/nimx-0.1/nimx/class_registry.nim(49, 25) template/generic instantiation from here
~/.nimble/pkgs/nimx-0.1/nimx/class_registry.nim(31, 32) template/generic instantiation from here
~/.nimble/pkgs/variant-0.1.0/variant.nim(29, 46) Error: no generic parameters allowed for ref

Perhaps a troubleshooting section in the README?

Hi!
I've read through a bunch of the other issues (there seems to be a lot, comparatively ) regarding the example code in the readme. Would it not be good if we had a bunch of troubleshooting tips?
Like:
If your having trouble installing nimx, try doing the following before posting an issue:
nimble install -y variant
nimble install -y https://github.com/yglukhov/ttf
nimble install nimsl

No Documentation

Is this being worked on? I managed to figure out the place to start is probably to make a GraphicsContext from context.nim, other than that there is little go off of from there.

nimx build problem

I'm having some build problems, which may be due to my using 0.15 on Windows which I think has various issues. Anyway, first I hit that in ttf it couldn't find memory.h - and it doesn't seem to be in the mingw distributed with nim 0.15 - so I copied it from another mingw installation.

But then...

nim c --threads:on -r sample01_welcome.nim

gives

c:\users\alynch.nimble\pkgs\nimx-0.1\nimx\view_event_handling.nim(14, 8) Error: method is not a base

any hints?

Some issues with scrollbars

import nimx.window,
       nimx.text_field,
       nimx.scroll_view,
       nimx.system_logger,
       strutils

runApplication:
    let wnd = newWindow newRect(40, 40, 640, 480)
    let tv = TextField.new newRect(40, 40, 100, 100)
    tv.resizingMask = "wh"
    tv.text = "abcdefgi\n".repeat(20)
    tv.multiline = true
    let scroll = newScrollView tv
    wnd.addSubView scroll

The scrollbars are incorrect initially. It appears correct after I select some text, minimize the window and then bring up the window. Is my code correct?

trying to run tests

When I follow these instructions:
cd $(nimble path nimx)/test
nake # Build and run on the current platform

I get a permission denied error. I changed the permissions on the test/nakefile, and now I get this error, and it just hangs, and I have to kill the terminal session from the system monitor:

home/bruce/.nimble/pkgs/nimx-0.1/nimx/sdl_perform_on_main_thread.nim(6, 5) Warning: Cannot prove that 'evt' is initialized. This will become a compile time error in the future. [ProveInit]
I'm on elementary OS 0.3.2 Freya (64-bit), Built on Ubuntu 14.04

Compilation for Windows on Linux fails with "undefined reference to `WinMain'"

Hello,

new to nim and nimx. setting up my environment (debian amd64). Compilation of your hello world on linux for linux works OK, but when trying to cross compile for WIN target:

nim --os:windows --cpu:amd64 --gcc.exe:x86_64-w64-mingw32-gcc --gcc.linkerexe:x86_64-w64-mingw32-gcc --app:gui -r --noMain --threads:on c main.nim

it fails (probably during linking) with this message:

/usr/lib/gcc/x86_64-w64-mingw32/6.3-win32/../../../../x86_64-w64-mingw32/lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): In function main': ./mingw-w64-crt/crt/crt0_c.c:18: undefined reference to WinMain'
collect2: error: ld returned 1 exit status

Full log here: https://pastebin.com/UwfB8D4J

Or do i need to cross-compile libsdl2 first?

thank you

could not load some dlls

hi @yglukhov
I get this error when build main.nim, can you please take a look?
I have nake and nimx installed successfully by nimble.

by the way, when I tried to build examples in test folder, I get a lot of below errors:
os.nim(135) raiseOSError
nake.nim(90) moduleHook
nakelib.nim(260) runTask
naketools.nim(744) :anonymous
naketools.nim(642) build
naketools.nim(446) nimbleOverrideFlags
naketools.nim(206) nimblePath
osproc.nim(1225) execCmdEx
osproc.nim(559) startProcess
os.nim(135) raiseOSError
Error: unhandled exception: The system cannot find the file specified.

Additional info: Requested command not found: 'nimble.cmd path nimx'. OS error:
[OSError]
No task specified, running default task defined by nakefile.
windres: build\windows\nimcache\MyGame_res.o: No such file or directory

Note: I am using Nim 0.14.2 binary.

Windows compilation error

Trying to compile sample01_welcome.nim throws:

...\.nimble\pkgs\nimx-0.1\nimx\assets\web_url_handler.nim(77, 17) Error: undeclared field: 'statusCode'

Windows Vista x64
Nim: devel-0.17.1 with mingw (x86)

Example Usage Code on Readme Page Won't Run


MacOSX 10,11,16
Nim Version 0,16,0
Nimble Version 0,8,2

I've just downloaded Nimx today, to 'kick the tyres' but not got off to a very auspicious start. The provided example code, given under Usage on the Readme page won't run under OSX. Here's the error I'm getting:

β˜… Dalek β˜…  nimxTest  ᐅ  nim c -r --noMain --threads:on test.nim

Hint: used config file '/usr/local/Cellar/nim/0.16.0/nim/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: test [Processing]
Hint: window [Processing]
Hint: abstract_window [Processing]
Hint: view [Processing]
Hint: typetraits [Processing]
Hint: tables [Processing]
Hint: hashes [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: math [Processing]
Hint: algorithm [Processing]
Hint: etcpriv [Processing]
Hint: sequtils [Processing]
Hint: types [Processing]
Hint: context [Processing]
Hint: opengl [Processing]
Hint: macros [Processing]
Hint: dynlib [Processing]
Hint: system_logger [Processing]
Hint: logging [Processing]
Hint: times [Processing]
Hint: os [Processing]
Hint: posix [Processing]
Hint: matrixes [Processing]
Hint: font [Processing]
Hint: unicode [Processing]
Hint: streams [Processing]
Hint: resource [Processing]
Hint: json [Processing]
Hint: lexbase [Processing]
Hint: async_http_request [Processing]
Hint: asyncdispatch [Processing]
Hint: oids [Processing]
Hint: endians [Processing]
Hint: heapqueue [Processing]
Hint: nativesockets [Processing]
Hint: net [Processing]
Hint: sets [Processing]
Hint: deques [Processing]
Hint: selectors [Processing]
Hint: kqueue [Processing]
Hint: httpclient [Processing]
Hint: uri [Processing]
Hint: strtabs [Processing]
Hint: base64 [Processing]
Hint: mimetypes [Processing]
Hint: random [Processing]
Hint: httpcore [Processing]
Hint: asyncnet [Processing]
Hint: threadpool [Processing]
Hint: cpuinfo [Processing]
Hint: cpuload [Processing]
Hint: pathutils [Processing]
Hint: variant [Processing]
Hint: timer [Processing]
Hint: mini_profiler [Processing]
Hint: font_data [Processing]
Hint: stb_ttf_glyph_provider [Processing]
Hint: rect_packer [Processing]
Hint: ttf [Processing]
Hint: write_image_impl [Processing]
Hint: edtaa3func [Processing]
Hint: simple_table [Processing]
Hint: portable_gl [Processing]
Hint: image [Processing]
Hint: resource_cache [Processing]
Hint: oswalkdir [Processing]
stack trace: (most recent call last)
/Users/madra/.nimble/pkgs/nimx-0.1/nimx/resource_cache.nim(140) getResourceNames
/Users/madra/.nimble/pkgs/nimx-0.1/nimx/resource_cache.nim(128) getEnvCt
lib/pure/strutils.nim(2205) removeSuffix
lib/pure/strutils.nim(2205, 9) Error: index out of bounds

main.nim won't build

I get:

[Linking]
nimcache/nimx_main.o: In function `main':
nimcache/nimx_main.c:(.text+0x4940): multiple definition of `main'
nimcache/nimx_linkage_details.o:nimcache/nimx_linkage_details.c:(.text+0x0): first defined here
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: execution of an external program failed

main seems to be defined in both nimx/linkage_details.nim and main.nim.

Issues in tests

Run this:
cd $(nimble path nimx)/test && ./main
And try to click on tabs(Welcome, Controls, Image, Animation) not in order.
I cannot activate tab the first time.

Also font on the "segmented control" is very blurred.
If I press buttons on the "segmented control" I get text outside of text field.

I use Ubuntu 14.04 x64 with devel branch of nim.

Error when compiling example in README

When compiling the example, I get an error on ttf_ttf.c, saying that it cannot find memory.h.

ttf_ttf.c:701:23: fatal error: memory.h: No such file or directory.
#include <memory.h>

Is there any solution to this? Or a memory.h file that I need to just copy and paste into the nimcache directory?

Linker errors on Windows msvc

I get errors at the linking stage about the stb_image functions

[Linking]
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 12.00.31101.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/debug
/stack:33554432
/out:c:\users\phowl_000\src\nimx\test\main.exe
c:\users\phowl_000\src\nimx\test\nimcache\nimx_linkage_details.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_sdl_window.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_table_view.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_scroll_view.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_render_to_image.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_unistring.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_text_field.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_view_event_handling.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_window_event_handling.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_app.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_window.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_event.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_control.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_button.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_animation.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_write_image_impl.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_load_image_impl.obj
c:\users\phowl_000\src\nimx\test\nimcache\sdl2_sdl2.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_resource.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_image.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_portable_gl.obj
c:\users\phowl_000\src\nimx\test\nimcache\ttf_ttf.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_rect_packer.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_hashes.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_tables.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_unicode.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_font.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_math.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_matrixes.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_logging.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_unsigned.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_dynlib.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_times.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_parseutils.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_strutils.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_os.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_winlean.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_sequtils.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_macros.obj
c:\users\phowl_000\src\nimx\test\nimcache\opengl_opengl.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_context.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_types.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_typetraits.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_view.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_system.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_main.obj
nimx_image.obj : error LNK2019: unresolved external symbol @stbi_load@20 referen
ced in function @imagewithcontentsoffile_769309@4
nimx_image.obj : error LNK2019: unresolved external symbol @stbi_image_free@4 re
ferenced in function @imagewithcontentsoffile_769309@4
nimx_image.obj : error LNK2019: unresolved external symbol @stbi_load_from_memor
y@24 referenced in function @imagewithresource_769326@8
nimx_image.obj : error LNK2019: unresolved external symbol @stbi_write_tga@20 re
ferenced in function @writetofile_770036@12
nimx_image.obj : error LNK2019: unresolved external symbol @stbi_write_hdr@20 re
ferenced in function @writetofile_770036@12
nimx_image.obj : error LNK2019: unresolved external symbol @stbi_write_bmp@20 re
ferenced in function @writetofile_770036@12
nimx_image.obj : error LNK2019: unresolved external symbol @stbi_write_png@24 re
ferenced in function @writetofile_770036@12
nimx_font.obj : error LNK2019: unresolved external symbol @stbtt_FindGlyphIndex@
8 referenced in function @bakechars_748115@8
nimx_font.obj : error LNK2019: unresolved external symbol @stbtt_GetGlyphBitmapB
ox@32 referenced in function @bakechars_748115@8
nimx_font.obj : error LNK2019: unresolved external symbol @stbtt_MakeGlyphBitmap
@32 referenced in function @bakechars_748115@8
c:\users\phowl_000\src\nimx\test\main.exe : fatal error LNK1120: 10 unresolved e
xternals
Error: execution of an external program failed

I tried making a .def file and compiling with nim c --passL:"/DEF:win.def" --parallelBuild:1 main that was all I could think of doing

Editor issue

Editor fails if I press "save as" button:

Traceback (most recent call last)
sdl_window.nim(361)      nimxedit
sdl_window.nim(352)      runUntilQuit
sdl_window.nim(326)      nextEvent
sdl_window.nim(273)      handleEvent
app.nim(62)              handleEvent
window_event_handling.nim(76) handleEvent
window_event_handling.nim(81) handleEvent
view_event_handling_new.nim(105) processTouchEvent
view_event_handling_new.nim(105) processTouchEvent
view_event_handling_new.nim(88) processTouchEvent
view_event_handling_new.nim(13) onTouchEv
button.nim(303)          onTouchEv
button.nim(280)          handleMomentaryTouchEv
control.nim(12)          sendAction
button.nim(253)          sendAction
control.nim(14)          sendAction
control.nim(28)          :anonymous
edit_view.nim(174)       :anonymous
ui_document.nim(38)      saveAs
native_dialogs.nim(91)   callDialogFileSave
native_dialogs.nim(69)   callDialogFile
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Error: execution of an external program failed: './build/linux/nimxedit '

Can not compile example

File: main.nim

import nimx.sdl_window
import nimx.text_field

First create a window. Window is the root of view hierarchy.

Currently there are two types of windows. SdlWindow should be used

with native targets, JSCanvasWindow should be used for WebGL target

var wnd : SdlWindow
wnd.new()
wnd.init(newRect(40, 40, 800, 600))

Create a static text field and add it to view hierarchy

let label = newLabel(newRect(20, 20, 150, 20))
label.text = "Hello, world!"
wnd.addSubview(label)

Run the main loop

runUntilQuit()

I run this:
nim c -r --noMain main.nim

And get this:
/home/nick/.nimble/pkgs/nimx-0.1/nimx/sdl_window.nim(78, 87) Error: undeclared identifier: 'SDL_WINDOW_ALLOW_HIGHDPI'

Delay or crash when entering certain characters

Here's a short example that can be used to reproduce the issue:

import nimx.window
import nimx.text_field
import nimx.system_logger
proc startApp() = newWindow(newRect(40, 40, 800, 600)).addSubview(newTextField(newRect(20, 40, 20, 20)))
runApplication: startApp()

The crash occurs when the first character entered into the field is '€' for example, but it only results in a delay when it is not the first character. Characters like 'Γ₯', 'Γ€', and 'ΓΆ' do not cause a crash, but they also result in a delay of about 2 seconds.

Here is the stack trace for when it crashes:

Traceback (most recent call last)
sdl_window.nim(333)      main
sdl_window.nim(324)      runUntilQuit
sdl_window.nim(304)      nextEvent
sdl_window.nim(253)      handleEvent
app.nim(54)              handleEvent
window_event_handling.nim(29) handleEvent
window_event_handling.nim(43) handleEvent
view_event_handling.nim(17) onTextInput
window_event_handling.nim(22) onTextInput
view_event_handling.nim(17) onTextInput
text_field.nim(318)      onTextInput
text_field.nim(221)      insertText
text_field.nim(203)      updateCursorOffset
font.nim(465)            cursorOffsetForPositionInString
font.nim(436)            getQuadDataForRune
font.nim(414)            chunkAndCharIndexForRune
font.nim(290)            bakeChars
ttf.nim(2119)            stbtt_MakeGlyphBitmap
ttf.nim(2116)            stbtt_MakeGlyphBitmapSubpixel
ttf.nim(2063)            stbtt_Rasterize
ttf.nim(1967)            stbtt_rasterize
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

accessing local variables periodically

If indeed it's not possible, then some ways to deal with this includes:

  • Allowing the engine to be updated without exposing implementation details of targets, thus allowing timers to be bypassed
  • Associating an object with a timer, that is passed to the callback, or turning the callbacks into closures

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.