Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
26 May, 2013, 05:02:53 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: 1 ... 4 5 [6] 7 8 ... 24   Go Down
  Print  
Author Topic: nCraft (3D minecraft-like game for the nspire) -  (Read 14022 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
lkj
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Today at 00:09:31
Date Registered: 07 September, 2011, 20:05:25
Posts: 350

Total Post Ratings: +40

View Profile
« Reply #75 on: 29 April, 2012, 01:15:53 »
0

Hello everybody !

I have problems with color support, and I would need your help...
I have to change my buffer from uint8_t* to void*.

But in a function to change a pixel, I have to cast a void* value to an uint8_t if the screen is in 4 bpp mode.
So I tried :

1
2
3
4
5
6
function setPixel(void *buffer,int x,int y,int color)
{
    //...
    uint8_t px=*((uint8_t *)buffer[pos])     //pos is an int
    //...
}
But gcc does not like that... What should I do instead?

A function doesn't have a "function" in front of its name, although I'm not sure you wrote it in your code like that.

For the cast, try this:

1
uint8_t px=(((uint8_t *)buffer)[pos]);

If you write a * in front of it and a [] at the end, you're dereferencing the pointer twice, the * is wrong here.
I'm not sure if you need the parentheses around "(uint8_t*)buffer", but they certainly don't do any harm.
Logged

My Nspire Ndless C projects:
Chockosta
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 19:34:35
Date Registered: 03 June, 2011, 20:14:17
Location: France
Posts: 440


Topic starter
Total Post Ratings: +159

View Profile
« Reply #76 on: 29 April, 2012, 11:01:30 »
0

Oh yeah, small confusion with  Lua Smiley
(Obviously, I did not write that in my code)

But this doesn't work either...
GCC says :
buffer.c:19:35: warning : dereferencing ‘void *’ pointer [enabled by default]
buffer.c:19:5: error : invalid use of void expression

EDIT : Anyway, I found another way to do this (I just copied the setPixel function in particles, the ndless sample)
« Last Edit: 29 April, 2012, 11:18:50 by Chockosta » Logged

Chockosta (Loic Pujet) - Sorry for my poor English...
Look at my projects :
in C code : Periodic table, Space invaders, Fall, Snake, Minesweeper, nCraft (WIP)
in Lua : Snake, Space invaders, Bobby Carrot, Minesweeper, Mazes 3D, nSpaint, FreeCell, Tiny3D-Viewer, CubeField, Gravity Guy
lkj
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Today at 00:09:31
Date Registered: 07 September, 2011, 20:05:25
Posts: 350

Total Post Ratings: +40

View Profile
« Reply #77 on: 29 April, 2012, 13:26:03 »
0

I tested it with an older x86 gcc and it worked...
But I'm glad you found another solution Smiley
Logged

My Nspire Ndless C projects:
Chockosta
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 19:34:35
Date Registered: 03 June, 2011, 20:14:17
Location: France
Posts: 440


Topic starter
Total Post Ratings: +159

View Profile
« Reply #78 on: 29 April, 2012, 14:23:33 »
0

So, CX compatibility should be okay, but for random reasons it keep crashing when I open it with the emulator...
I really do not understand.

The CX emulator works fine, I can run other programs that I compiled.
But it doesn't seem that the error comes from the code, since it runs perfectly on non-CX emulator.
I have no clue...
Logged

Chockosta (Loic Pujet) - Sorry for my poor English...
Look at my projects :
in C code : Periodic table, Space invaders, Fall, Snake, Minesweeper, nCraft (WIP)
in Lua : Snake, Space invaders, Bobby Carrot, Minesweeper, Mazes 3D, nSpaint, FreeCell, Tiny3D-Viewer, CubeField, Gravity Guy
Levak
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: Today at 00:47:36
Date Registered: 04 April, 2010, 23:42:49
Location: France
Posts: 845


Total Post Ratings: +148

View Profile WWW
« Reply #79 on: 29 April, 2012, 17:07:56 »
0

So, CX compatibility should be okay, but for random reasons it keep crashing when I open it with the emulator...
I really do not understand.

The CX emulator works fine, I can run other programs that I compiled.
But it doesn't seem that the error comes from the code, since it runs perfectly on non-CX emulator.
I have no clue...

When it crashes, does it say something, like bad write word at 0x..... or it just Resets ?
Logged

Human always wants to survive and that's why he will fall one day.
My website - TI-Planet - iNspired-Lua
Chockosta
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 19:34:35
Date Registered: 03 June, 2011, 20:14:17
Location: France
Posts: 440


Topic starter
Total Post Ratings: +159

View Profile
« Reply #80 on: 29 April, 2012, 17:14:41 »
0

When I enter "c" in the bebugger, I get :
"Warning at PC=114DA7EC: Bad read_word: 900d000c"...
Maybe a malloc failed ?
Logged

Chockosta (Loic Pujet) - Sorry for my poor English...
Look at my projects :
in C code : Periodic table, Space invaders, Fall, Snake, Minesweeper, nCraft (WIP)
in Lua : Snake, Space invaders, Bobby Carrot, Minesweeper, Mazes 3D, nSpaint, FreeCell, Tiny3D-Viewer, CubeField, Gravity Guy
Levak
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: Today at 00:47:36
Date Registered: 04 April, 2010, 23:42:49
Location: France
Posts: 845


Total Post Ratings: +148

View Profile WWW
« Reply #81 on: 29 April, 2012, 17:21:32 »
0

No, this is normal. On emulator I haven't been able to edit (write) neither timer 1, timer 2 nor RTC.
It appears that, for the RTC, it is synchronized with the real time of the computer and you can't edit it. I don't know for the timer 1 and timer 2, maybe the same story.
« Last Edit: 29 April, 2012, 17:22:31 by Levak » Logged

Human always wants to survive and that's why he will fall one day.
My website - TI-Planet - iNspired-Lua
calc84maniac
Epic z80 roflpwner
Coder Of Tomorrow
LV11 Super Veteran (Next: 3000)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 16:59:06
Date Registered: 28 August, 2008, 05:09:05
Location: Right behind you.
Posts: 2735


Total Post Ratings: +373

View Profile
« Reply #82 on: 29 April, 2012, 17:42:42 »
0

The timers work, but they are a different module on the Nspire CX than on the original Nspire. The list of registers is here, and as you can see, Base+0x0C is a write-only register.
Logged

"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 23:34:24
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50238


Total Post Ratings: +2615

View Profile WWW
« Reply #83 on: 29 April, 2012, 20:11:44 »
0

Does it work perfectly on calc, though? Sometimes emulators do not emulate stuff 100% accurately.
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
calc84maniac
Epic z80 roflpwner
Coder Of Tomorrow
LV11 Super Veteran (Next: 3000)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 16:59:06
Date Registered: 28 August, 2008, 05:09:05
Location: Right behind you.
Posts: 2735


Total Post Ratings: +373

View Profile
« Reply #84 on: 29 April, 2012, 20:36:18 »
0

It wouldn't work oncalc either because it has been programmed using only the classic Nspire timers. The CX timers have to be programmed differently.
Logged

"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman
Chockosta
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 19:34:35
Date Registered: 03 June, 2011, 20:14:17
Location: France
Posts: 440


Topic starter
Total Post Ratings: +159

View Profile
« Reply #85 on: 29 April, 2012, 20:38:47 »
0

I never tested any of my ndless programs on calc...
Actually, I don't have ndless on my calc. (Or else I would be too tempted to play in class Smiley )

So I hope that it will work like in nspire_emu...
« Last Edit: 29 April, 2012, 20:42:05 by Chockosta » Logged

Chockosta (Loic Pujet) - Sorry for my poor English...
Look at my projects :
in C code : Periodic table, Space invaders, Fall, Snake, Minesweeper, nCraft (WIP)
in Lua : Snake, Space invaders, Bobby Carrot, Minesweeper, Mazes 3D, nSpaint, FreeCell, Tiny3D-Viewer, CubeField, Gravity Guy
Chockosta
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 19:34:35
Date Registered: 03 June, 2011, 20:14:17
Location: France
Posts: 440


Topic starter
Total Post Ratings: +159

View Profile
« Reply #86 on: 30 April, 2012, 19:32:17 »
0

Thanks for your link, calc84maniac, but I still have problems.
According to this, the timer value address should be 0x900D0004, right ?

But the value at 0x900D0004 is 0 and doesn't change...
Logged

Chockosta (Loic Pujet) - Sorry for my poor English...
Look at my projects :
in C code : Periodic table, Space invaders, Fall, Snake, Minesweeper, nCraft (WIP)
in Lua : Snake, Space invaders, Bobby Carrot, Minesweeper, Mazes 3D, nSpaint, FreeCell, Tiny3D-Viewer, CubeField, Gravity Guy
Chockosta
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: Yesterday at 19:34:35
Date Registered: 03 June, 2011, 20:14:17
Location: France
Posts: 440


Topic starter
Total Post Ratings: +159

View Profile
« Reply #87 on: 01 May, 2012, 19:08:42 »
+3

(Sorry for the triple post...)

By the way, even if I can't use the timers, the color display works great.
Here is some eye-candy...
(In the first picture, you can see iron, gold and diamond, and in the second one, there is pretty much every block I added Smiley )


* screenshot28.png (8.14 KB, 640x238 - viewed 402 times.)
Logged

Chockosta (Loic Pujet) - Sorry for my poor English...
Look at my projects :
in C code : Periodic table, Space invaders, Fall, Snake, Minesweeper, nCraft (WIP)
in Lua : Snake, Space invaders, Bobby Carrot, Minesweeper, Mazes 3D, nSpaint, FreeCell, Tiny3D-Viewer, CubeField, Gravity Guy
AzNg0d1030
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Male
Last Login: 19 May, 2013, 23:04:34
Date Registered: 26 October, 2011, 04:43:09
Location: Over the rainbow
Posts: 488


Total Post Ratings: +37

View Profile
« Reply #88 on: 01 May, 2012, 23:42:13 »
0

Ohohoho, the triple post is fine when you need to make us see THESE BEAUTIFUL PICTURES! Cheesy
Try to not triple in such a short time though Tongue
Logged

What? WHAT? WHATTTT?Huh??

You just lost the game.

Suck it up.
annoyingcalc
the annoying calculator
LV10 31337 u53r (Next: 2000)
**********
Online Online

Gender: Male
Last Login: Today at 04:45:56
Date Registered: 14 April, 2011, 23:02:24
Location: In the glorious land of minecraft
Posts: 1779


Total Post Ratings: +57

View Profile WWW
« Reply #89 on: 04 May, 2012, 00:56:50 »
0

(Sorry for the triple post...)

By the way, even if I can't use the timers, the color display works great.
Here is some eye-candy...
(In the first picture, you can see iron, gold and diamond, and in the second one, there is pretty much every block I added Smiley )
WOW! I cant wait for more updates
Logged

Click here to see where you got your post ratings

My minecraft server is usually up, even if mcserverlist says it is down

Spoiler for siq:
Spoiler for signature:
Pages: 1 ... 4 5 [6] 7 8 ... 24   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.311 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.