Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Spenceboy98

Pages: 1 ... 8 9 [10] 11 12 ... 39
136
Calculator C / Re: [Ndless] Tunnel
« on: June 18, 2013, 02:04:51 pm »
*BUMP*
Could someone please help? I have no idea why it's doing this. :/

137
Calculator C / Re: [Ndless] Tunnel
« on: June 17, 2013, 06:05:05 pm »
I don't know why the lines are there. :P

Here is my code:
Spoiler For Code:
Code: [Select]
#include <os.h>
#include "utils.c"
#include "graphics3.c"
#include "touchpad.c"

#define texWidth 256
#define texHeight 256
#define screenWidth 240
#define screenHeight 240

int w = 240, h = 240, x, y;

int texture[texWidth][texHeight];

int distanceTable[screenWidth][screenHeight];
int angleTable[screenWidth][screenHeight];
int buffer[screenWidth][screenHeight];

void masksprite(void *buffer, int *data, int x, int y, int width, int height, int mask){
int i, j;
for(i = 0; i < height; i++){
for(j = 0; j < width; j++){
if(data[i*width+j] != mask && x+j < 320 && x+j > 0 && y+i < 240 && y+i > 0){
setPixelBuf(buffer, x+j, y+i, data[i*width+j]);
}
}
}
}

uint16_t RGBColor(uint8_t r, uint8_t g, uint8_t b)
{
  return ((r / 8) << 11) | ((g / 4) << 5) | (b / 8);
}

int main(void) {
char *screen;
screen = (char*)malloc(SCREEN_BYTES_SIZE * sizeof(char));     // just a buffer
if(!screen)
{
exit(0);
}
initTP();
lcd_ingray();
for(x = 0; x < texWidth; x++)
    for(y = 0; y < texHeight; y++)
    {
uint8_t c = x ^ y;
        texture[x][y] = RGBColor(c, c, c);
    }
for(x = 0; x < w; x++)
    for(y = 0; y < h; y++)
    {
        int angle, distance;
        float ratio = 32.0;
        distance = (int)(ratio * texHeight / sqrt((x - w / 2.0) * (x - w / 2.0) + (y - h / 2.0) * (y - h / 2.0))) % texHeight;
        angle = (unsigned int)(0.5 * texWidth * atan2(y - h / 2.0, x - w / 2.0) / M_PI);
        distanceTable[x][y] = distance;
        angleTable[x][y] = angle;
    }
float animation = 0;
int shiftY = (int)(texHeight * 0.25);
    //begin the loop
    while(!isKeyPressed(KEY_NSPIRE_ESC))
    {
        animation = animation+0.01;
readTP();
int TZ = getTouchedZone4();
        //calculate the shift values out of the animation value
        int shiftX = (int)(texWidth * 1.0 * animation);
if(isKeyPressed(KEY_NSPIRE_RIGHT) || TZ==6)
shiftY++;
if(isKeyPressed(KEY_NSPIRE_LEFT) || TZ==4)
shiftY--;
        for(x = 0; x < w; x++)
        for(y = 0; y < h; y++)
        {
            //get the texel from the texture by using the tables, shifted with the animation values
            int color = texture[(unsigned int)(distanceTable[x][y] + shiftX)  % texWidth][(unsigned int)(angleTable[x][y] + shiftY) % texHeight];
            buffer[x][y] = color;
        }
        masksprite(screen, buffer[0], 0, 0, 240, 240, 0xf800);
refresh(screen);
clearBuf(screen);
    } 
free(screen);
endTP();
return 0;
}


138
Calculator C / [Ndless] Tunnel
« on: June 17, 2013, 04:08:44 pm »
Hello all. I saw this tutorial on how to make a tunnel and I decided to port it to Nspire. I'm having problems though. It only displays half of the tunnel correctly(the right side).

Could you guys help(I directly ported the code from the tutorial)?

Gif is attached(faster on calc).

139
News / Re: It's here! Slova released!
« on: June 15, 2013, 10:04:33 pm »
I get this error when trying to convert 8xp to 8xv:


Help?

Edit: Nevermind.

140
TI-Nspire / Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« on: June 15, 2013, 01:39:41 pm »
@Spenceboy98 no problem, but you'd prefer to wait a little until I put in the lib some things to make its use easier (I have some defines in mind).

I actually got the most recent version to work(though there are some weird display errors :/ ). :P But I'll wait for updates.

141
TI-Nspire / Re: [Ndless C] nRayC, a raycasting library for TI-Nspire
« on: June 15, 2013, 01:47:55 am »
Could I please port this to Prizm?

This is great. Keep up the good work! :D

142
Humour and Jokes / Re: Weird/funny pictures thread
« on: June 13, 2013, 02:46:57 pm »
Why did they write their answers in English? :P

143
TI-Nspire / Re: Minecraft 2D for TI-Nspire
« on: June 12, 2013, 03:12:56 pm »
@adriweb:
1) Yes, I think the problem is at enable/disable elements on-the-fly, I use that function to sort out items, that needs a crafting table.
2) I'm using this tool: http://hoffa.zzl.org/index.php and it looks like this compresses the images as much as possible
3) Without any saves the .tns is 29KB. Every save takes about 1-2KB. Btw every world is 200x100 Blocks large (but the code supports larger).

@ben_g:
Yes I used the original textures and for the other questions just look at the first post :P

Where did you get your textures(I've looked but could never find them)?

144
Calculator C / Re: [Ndless] Problem with raycasting
« on: June 11, 2013, 05:25:31 pm »
When you get a decent version working, could I have the source so I can port it to Prizm(or, if you want, you can give me the code that you have now)? :P

Anyways, it looks good right now, and I hope you can get a working version with floors/ceiling/textures. :)

145
TI-Nspire / Re: nCraft (3D minecraft-like game for the nspire)
« on: June 11, 2013, 03:57:21 pm »
I hope he'll get around to optimizing(code and speed), so it will be easier to port to Prizm. I tried porting to Prizm, but it seems that the mallocs are way too big for it. :( Maybe if he does optimize it, it will be easier(I've tried to make the arrays smaller, but there has been no results). I did try instead of mallocing just "world[CUBE_WORLD_X*CUBE_WORLD_Y*CUBE_WORLD_Z]" to see if that would work and it kinda did, but then it gave me a segfault at the part of the code that draws the cubes/triangles/individual-horizontal-lines. I don't know what the problem is(I did port the pre-alpha version of nCraft successfully but with some crashes).

146
Miscellaneous / Re: Random YouTube Videos
« on: June 03, 2013, 08:59:21 pm »
I'll just drop this off here:


Also, I've been watching this series on Youtube lately:


Very fun! :P

147
TI-Nspire / Re: [Nspire C] Zombie Chase
« on: May 27, 2013, 04:14:33 pm »
Looks nice, is it like Scipi/HOMER-16's computer zombie game? And yeah maybe the points could be a bit larger and there should be a bit of color.

It should work on a CX, but no one has tested my most recent upload.

About the points, do you mean the amount taken off of the health when you get touched by a zombie?

148
Humour and Jokes / Re: Weird/funny pictures thread
« on: May 26, 2013, 09:42:53 pm »
LOL
what are your options: how many chars for highlighting?

I'm assuming because it had just crashed, so that's why, I guess. :P

149
Humour and Jokes / Re: Weird/funny pictures thread
« on: May 26, 2013, 04:52:55 pm »
Just happened in omnomIRC:

150
TI-Nspire / Re: kArmTI - TI-Nspire emulator with skin
« on: May 26, 2013, 02:20:42 pm »
Quote
Where can I find a good boot1 image(CX 3.1)?
It's not distributed anywhere...

I guess this won't work then(I got my other boot1 from a pm from a member here on omnimaga). :P

Pages: 1 ... 8 9 [10] 11 12 ... 39