Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with example tvintris.v #8

Open
ManPython opened this issue Aug 14, 2020 · 3 comments
Open

Problem with example tvintris.v #8

ManPython opened this issue Aug 14, 2020 · 3 comments

Comments

@ManPython
Copy link

I made some tests
vlang/v#6133

v-0.1.29\v\examples\tvintris>v install nsauzede.vsdl2
Error 10057 sending data to server (1)
Error performing handshake
Unhandled Exception 0xC0000005
print_backtrace_skipping_top_frames is not implemented
v-0.1.29\v\examples\tvintris>v run tvintris.v
tvintris.v:22:2: warning: const names cannot contain uppercase letters, use snake_case instead
   20 | const (
   21 |     vsdl2_version = vsdl2.version
   22 |     Title = 'tVintris'
      |     ~~~~~
   23 |     BASE = os.dir( os.real_path( os.executable() ) )
   24 |     font_name = BASE + '/fonts/RobotoMono-Regular.ttf'
tvintris.v:23:2: warning: const names cannot contain uppercase letters, use snake_case instead
   21 |     vsdl2_version = vsdl2.version
   22 |     Title = 'tVintris'
   23 |     BASE = os.dir( os.real_path( os.executable() ) )
      |     ~~~~
   24 |     font_name = BASE + '/fonts/RobotoMono-Regular.ttf'
   25 |     music_name = BASE + '/sounds/TwintrisThosenine.mod'
tvintris.v:29:2: warning: const names cannot contain uppercase letters, use snake_case instead
   27 |     snd_line_name = BASE + '/sounds/single.wav'
   28 |     snd_double_name = BASE + '/sounds/triple.wav'
   29 |     VLogo = BASE + '/images/v-logo_30_30.png'
      |     ~~~~~
   30 |     BlockSize = 20 // pixels
   31 |     FieldHeight = 20 // # of blocks
tvintris.v:30:2: warning: const names cannot contain uppercase letters, use snake_case instead
   28 |     snd_double_name = BASE + '/sounds/triple.wav'
   29 |     VLogo = BASE + '/images/v-logo_30_30.png'
   30 |     BlockSize = 20 // pixels
      |     ~~~~~~~~~
   31 |     FieldHeight = 20 // # of blocks
   32 |     FieldWidth = 10
tvintris.v:31:2: warning: const names cannot contain uppercase letters, use snake_case instead
   29 |     VLogo = BASE + '/images/v-logo_30_30.png'
   30 |     BlockSize = 20 // pixels
   31 |     FieldHeight = 20 // # of blocks
      |     ~~~~~~~~~~~
   32 |     FieldWidth = 10
   33 |     TetroSize = 4
tvintris.v:32:2: warning: const names cannot contain uppercase letters, use snake_case instead
   30 |     BlockSize = 20 // pixels
   31 |     FieldHeight = 20 // # of blocks
   32 |     FieldWidth = 10
      |     ~~~~~~~~~~
   33 |     TetroSize = 4
   34 |     WinWidth = BlockSize * FieldWidth * 3
tvintris.v:33:2: warning: const names cannot contain uppercase letters, use snake_case instead
   31 |     FieldHeight = 20 // # of blocks
   32 |     FieldWidth = 10
   33 |     TetroSize = 4
      |     ~~~~~~~~~
   34 |     WinWidth = BlockSize * FieldWidth * 3
   35 |     WinHeight = BlockSize * FieldHeight
tvintris.v:34:2: warning: const names cannot contain uppercase letters, use snake_case instead
   32 |     FieldWidth = 10
   33 |     TetroSize = 4
   34 |     WinWidth = BlockSize * FieldWidth * 3
      |     ~~~~~~~~
   35 |     WinHeight = BlockSize * FieldHeight
   36 |     TimerPeriod = 250 // ms
tvintris.v:35:2: warning: const names cannot contain uppercase letters, use snake_case instead
   33 |     TetroSize = 4
   34 |     WinWidth = BlockSize * FieldWidth * 3
   35 |     WinHeight = BlockSize * FieldHeight
      |     ~~~~~~~~~
   36 |     TimerPeriod = 250 // ms
   37 |     TextSize = 16
tvintris.v:36:2: warning: const names cannot contain uppercase letters, use snake_case instead
   34 |     WinWidth = BlockSize * FieldWidth * 3
   35 |     WinHeight = BlockSize * FieldHeight
   36 |     TimerPeriod = 250 // ms
      |     ~~~~~~~~~~~
   37 |     TextSize = 16
   38 |     AudioBufSize = 1024
tvintris.v:37:2: warning: const names cannot contain uppercase letters, use snake_case instead
   35 |     WinHeight = BlockSize * FieldHeight
   36 |     TimerPeriod = 250 // ms
   37 |     TextSize = 16
      |     ~~~~~~~~
   38 |     AudioBufSize = 1024
   39 |
tvintris.v:38:2: warning: const names cannot contain uppercase letters, use snake_case instead
   36 |     TimerPeriod = 250 // ms
   37 |     TextSize = 16
   38 |     AudioBufSize = 1024
      |     ~~~~~~~~~~~~
   39 |
   40 |     P2FIRE = C.SDLK_l
tvintris.v:40:2: warning: const names cannot contain uppercase letters, use snake_case instead
   38 |     AudioBufSize = 1024
   39 |
   40 |     P2FIRE = C.SDLK_l
      |     ~~~~~~
   41 |     P2UP = C.SDLK_UP
   42 |     P2DOWN = C.SDLK_DOWN
tvintris.v:41:2: warning: const names cannot contain uppercase letters, use snake_case instead
   39 |
   40 |     P2FIRE = C.SDLK_l
   41 |     P2UP = C.SDLK_UP
      |     ~~~~
   42 |     P2DOWN = C.SDLK_DOWN
   43 |     P2LEFT = C.SDLK_LEFT
tvintris.v:42:2: warning: const names cannot contain uppercase letters, use snake_case instead
   40 |     P2FIRE = C.SDLK_l
   41 |     P2UP = C.SDLK_UP
   42 |     P2DOWN = C.SDLK_DOWN
      |     ~~~~~~
   43 |     P2LEFT = C.SDLK_LEFT
   44 |     P2RIGHT = C.SDLK_RIGHT
tvintris.v:43:2: warning: const names cannot contain uppercase letters, use snake_case instead
   41 |     P2UP = C.SDLK_UP
   42 |     P2DOWN = C.SDLK_DOWN
   43 |     P2LEFT = C.SDLK_LEFT
      |     ~~~~~~
   44 |     P2RIGHT = C.SDLK_RIGHT
   45 |
tvintris.v:44:2: warning: const names cannot contain uppercase letters, use snake_case instead
   42 |     P2DOWN = C.SDLK_DOWN
   43 |     P2LEFT = C.SDLK_LEFT
   44 |     P2RIGHT = C.SDLK_RIGHT
      |     ~~~~~~~
   45 |
   46 |     P1FIRE = C.SDLK_s
tvintris.v:46:2: warning: const names cannot contain uppercase letters, use snake_case instead
   44 |     P2RIGHT = C.SDLK_RIGHT
   45 |
   46 |     P1FIRE = C.SDLK_s
      |     ~~~~~~
   47 |     P1UP = C.SDLK_w
   48 |     P1DOWN = C.SDLK_x
tvintris.v:47:2: warning: const names cannot contain uppercase letters, use snake_case instead
   45 |
   46 |     P1FIRE = C.SDLK_s
   47 |     P1UP = C.SDLK_w
      |     ~~~~
   48 |     P1DOWN = C.SDLK_x
   49 |     P1LEFT = C.SDLK_a
tvintris.v:48:2: warning: const names cannot contain uppercase letters, use snake_case instead
   46 |     P1FIRE = C.SDLK_s
   47 |     P1UP = C.SDLK_w
   48 |     P1DOWN = C.SDLK_x
      |     ~~~~~~
   49 |     P1LEFT = C.SDLK_a
   50 |     P1RIGHT = C.SDLK_d
tvintris.v:49:2: warning: const names cannot contain uppercase letters, use snake_case instead
   47 |     P1UP = C.SDLK_w
   48 |     P1DOWN = C.SDLK_x
   49 |     P1LEFT = C.SDLK_a
      |     ~~~~~~
   50 |     P1RIGHT = C.SDLK_d
   51 |
tvintris.v:50:2: warning: const names cannot contain uppercase letters, use snake_case instead
   48 |     P1DOWN = C.SDLK_x
   49 |     P1LEFT = C.SDLK_a
   50 |     P1RIGHT = C.SDLK_d
      |     ~~~~~~~
   51 |
   52 |     NJOYMAX = 2
tvintris.v:52:2: warning: const names cannot contain uppercase letters, use snake_case instead
   50 |     P1RIGHT = C.SDLK_d
   51 |
   52 |     NJOYMAX = 2
      |     ~~~~~~~
   53 |     // joystick name => enter your own device name
   54 |     JOYP1NAME = 'Generic X-Box pad'
tvintris.v:54:2: warning: const names cannot contain uppercase letters, use snake_case instead
   52 |     NJOYMAX = 2
   53 |     // joystick name => enter your own device name
   54 |     JOYP1NAME = 'Generic X-Box pad'
      |     ~~~~~~~~~
   55 |     // following are joystick button number
   56 |     JBP1FIRE = 1
tvintris.v:56:2: warning: const names cannot contain uppercase letters, use snake_case instead
   54 |     JOYP1NAME = 'Generic X-Box pad'
   55 |     // following are joystick button number
   56 |     JBP1FIRE = 1
      |     ~~~~~~~~
   57 |     // following are joystick hat value
   58 |     JHP1UP = 1
tvintris.v:58:2: warning: const names cannot contain uppercase letters, use snake_case instead
   56 |     JBP1FIRE = 1
   57 |     // following are joystick hat value
   58 |     JHP1UP = 1
      |     ~~~~~~
   59 |     JHP1DOWN = 4
   60 |     JHP1LEFT = 8
tvintris.v:59:2: warning: const names cannot contain uppercase letters, use snake_case instead
   57 |     // following are joystick hat value
   58 |     JHP1UP = 1
   59 |     JHP1DOWN = 4
      |     ~~~~~~~~
   60 |     JHP1LEFT = 8
   61 |     JHP1RIGHT = 3
tvintris.v:60:2: warning: const names cannot contain uppercase letters, use snake_case instead
   58 |     JHP1UP = 1
   59 |     JHP1DOWN = 4
   60 |     JHP1LEFT = 8
      |     ~~~~~~~~
   61 |     JHP1RIGHT = 3
   62 |
tvintris.v:61:2: warning: const names cannot contain uppercase letters, use snake_case instead
   59 |     JHP1DOWN = 4
   60 |     JHP1LEFT = 8
   61 |     JHP1RIGHT = 3
      |     ~~~~~~~~~
   62 |
   63 |     // joystick name => enter your own device name
tvintris.v:64:2: warning: const names cannot contain uppercase letters, use snake_case instead
   62 |
   63 |     // joystick name => enter your own device name
   64 |     JOYP2NAME = 'RedOctane Guitar Hero X-plorer'
      |     ~~~~~~~~~
   65 |     // following are joystick button number
   66 |     JBP2FIRE = 0
tvintris.v:66:2: warning: const names cannot contain uppercase letters, use snake_case instead
   64 |     JOYP2NAME = 'RedOctane Guitar Hero X-plorer'
   65 |     // following are joystick button number
   66 |     JBP2FIRE = 0
      |     ~~~~~~~~
   67 |     // following are joystick hat value
   68 |     JHP2UP = 4
tvintris.v:68:2: warning: const names cannot contain uppercase letters, use snake_case instead
   66 |     JBP2FIRE = 0
   67 |     // following are joystick hat value
   68 |     JHP2UP = 4
      |     ~~~~~~
   69 |     JHP2DOWN = 1
   70 |     JHP2LEFT = 8
tvintris.v:69:2: warning: const names cannot contain uppercase letters, use snake_case instead
   67 |     // following are joystick hat value
   68 |     JHP2UP = 4
   69 |     JHP2DOWN = 1
      |     ~~~~~~~~
   70 |     JHP2LEFT = 8
   71 |     JHP2RIGHT = 2
tvintris.v:70:2: warning: const names cannot contain uppercase letters, use snake_case instead
   68 |     JHP2UP = 4
   69 |     JHP2DOWN = 1
   70 |     JHP2LEFT = 8
      |     ~~~~~~~~
   71 |     JHP2RIGHT = 2
   72 | )
tvintris.v:71:2: warning: const names cannot contain uppercase letters, use snake_case instead
   69 |     JHP2DOWN = 1
   70 |     JHP2LEFT = 8
   71 |     JHP2RIGHT = 2
      |     ~~~~~~~~~
   72 | )
   73 |
tvintris.v:112:2: warning: const names cannot contain uppercase letters, use snake_case instead
  110 |     ]
  111 |     // Each tetro has its unique color
  112 |     Colors = [
      |     ~~~~~~
  113 |         vsdl2.Color{byte(0), byte(0), byte(0), byte(0)},        // unused ?
  114 |         vsdl2.Color{byte(0), byte(0x62), byte(0xc0), byte(0)},    // quad : darkblue 0062c0
tvintris.v:124:2: warning: const names cannot contain uppercase letters, use snake_case instead
  122 |     ]
  123 |     // Background color
  124 |     BackgroundColor = vsdl2.Color{byte(0), byte(0), byte(0), byte(0)}
      |     ~~~~~~~~~~~~~~~
  125 | //    BackgroundColor = vsdl2.Color{byte(255), byte(255), byte(255), byte(0)}
  126 |     // Foreground color
tvintris.v:127:2: warning: const names cannot contain uppercase letters, use snake_case instead
  125 | //    BackgroundColor = vsdl2.Color{byte(255), byte(255), byte(255), byte(0)}
  126 |     // Foreground color
  127 |     ForegroundColor = vsdl2.Color{byte(0), byte(170), byte(170), byte(0)}
      |     ~~~~~~~~~~~~~~~
  128 | //    ForegroundColor = vsdl2.Color{byte(0), byte(0), byte(0), byte(0)}
  129 |     // Text color
tvintris.v:130:2: warning: const names cannot contain uppercase letters, use snake_case instead
  128 | //    ForegroundColor = vsdl2.Color{byte(0), byte(0), byte(0), byte(0)}
  129 |     // Text color
  130 |     TextColor = vsdl2.Color{byte(0xca), byte(0x7d), byte(0x5f), byte(0)}
      |     ~~~~~~~~~
  131 | //    TextColor = vsdl2.Color{byte(0), byte(0), byte(0), byte(0)}
  132 | )
tvintris.v:247:9: warning: use `(mut f Foo)` instead of `(f mut Foo)`
  245 |
  246 |
  247 | fn (sdl mut SdlContext) set_sdl_context(w int, h int, title string) {
      |         ~~~
  248 |     C.SDL_Init(C.SDL_INIT_VIDEO | C.SDL_INIT_AUDIO | C.SDL_INIT_JOYSTICK)
  249 |     C.atexit(C.SDL_Quit)
tvintris.v:463:10: warning: use `(mut f Foo)` instead of `(f mut Foo)`
  461 |         idle space fire
  462 | }
  463 | fn (game mut Game) handle_key(key int) {
      |          ~~~
  464 |     // global keys
  465 |     mut action := Action.idle
tvintris.v:506:10: warning: use `(mut f Foo)` instead of `(f mut Foo)`
  504 | }
  505 |
  506 | fn (game mut Game) handle_jbutton(jb int, joyid int) {
      |          ~~~
  507 |     if joyid != game.joy_id {
  508 |         return
tvintris.v:528:10: warning: use `(mut f Foo)` instead of `(f mut Foo)`
  526 | }
  527 |
  528 | fn (game mut Game) handle_jhat(jh int, jv int, joyid int) {
      |          ~~~
  529 |     if joyid != game.joy_id {
  530 |         return
tvintris.v:544:7: warning: use `(mut f Foo)` instead of `(f mut Foo)`
  542 | }
  543 |
  544 | fn (g mut Game) init_game() {
      |       ~~~
  545 |     g.score = 0
  546 |     g.tetro_total = 0
tvintris.v:567:7: warning: use `(mut f Foo)` instead of `(f mut Foo)`
  565 | }
  566 |
  567 | fn (g mut Game) parse_tetros() {
      |       ~~~
  568 |     for btetros in b_tetros {
  569 |         for btetro in btetros {
tvintris.v:577:7: warning: use `(mut f Foo)` instead of `(f mut Foo)`
  575 | }
  576 |
  577 | fn (g mut Game) run() {
      |       ~~~
  578 |     for {
  579 |         if g.state == .running {
tvintris.v:600:10: warning: use `(mut f Foo)` instead of `(f mut Foo)`
  598 | }
  599 |
  600 | fn (game mut Game) rotate_tetro() {
      |          ~~~
  601 |     // Rotate the tetro
  602 |     old_rotation_idx := game.rotation_idx
tvintris.v:617:7: warning: use `(mut f Foo)` instead of `(f mut Foo)`
  615 | }
  616 |
  617 | fn (g mut Game) move_tetro() {
      |       ~~~
  618 |     // Check each block in current tetro
  619 |     for block in g.tetro {
tvintris.v:643:7: warning: use `(mut f Foo)` instead of `(f mut Foo)`
  641 | }
  642 |
  643 | fn (g mut Game) move_right(dx int) bool {
      |       ~~~
  644 |     // Reached left/right edge or another tetro?
  645 |     for i := 0; i < TetroSize; i++ {
tvintris.v:686:7: warning: use `(mut f Foo)` instead of `(f mut Foo)`
  684 |
  685 | // Draw a rand tetro index
  686 | fn (g mut Game) rand_tetro() int {
      |       ~~~
  687 |     cur := g.tetro_next
  688 |     g.tetro_next = rand_r(&g.seed)
tvintris.v:694:7: warning: use `(mut f Foo)` instead of `(f mut Foo)`
  692 |
  693 | // Place a new tetro on top
  694 | fn (g mut Game) generate_tetro() {
      |       ~~~
  695 |     g.pos_y = 0
  696 |     g.pos_x = FieldWidth / 2 - TetroSize / 2
tvintris.v:706:7: warning: use `(mut f Foo)` instead of `(f mut Foo)`
  704 |
  705 | // Get the right tetro from cache
  706 | fn (g mut Game) get_tetro() {
      |       ~~~
  707 |     idx := g.tetro_idx * TetroSize * TetroSize + g.rotation_idx * TetroSize
  708 |     g.tetro = g.tetros_cache[idx .. idx + TetroSize]
tvintris.v:10:8: warning: module 'rand' is imported but never used
    8 | module main
    9 |
   10 | import rand
      |        ~~~~
   11 | import time
   12 | import os
builder error: cannot import module "nsauzede.vsdl2" (not found)
@nsauzede
Copy link
Owner

I know that v install doesn't work very well
I for one just create a symbolic link to 'nsauzede' in the .vmodules folder in my home
But this is for Linux
I don't know how to do that for Windows

Anyway
Not sure that the v install problem is related to vsdl2
V should be fixed for that separately

@ManPython
Copy link
Author

Right, V need some fix. Any way can You confirm that this working with v-0.1.29? If current compilated syntax is ok then should work. And how to ommit insall to reach reqiuments for nsauzede.vsdl2 ?

@nsauzede
Copy link
Owner

Yes syntax works with V of last week
For the requirements of V modules please refer to V documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants