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 ... 12 13 [14] 15 16 ... 39
196
Casio PRIZM / [PRIZM] Paint
« on: May 03, 2013, 08:09:14 pm »
I was disappointed when zeldaking never finished his Paint program, so I Decided to make my own!





It's got circle drawing(no ellipse), rectangle drawing, line drawing, pen, floodfill, zooming in(plus button), zooming out(minus), has a grid for larger than 3x, and a color picker(hope I didn't leave anything out). It took me a while to figure out how to make it actually draw, but then I realized that I could draw a sprite to the screen and just edit the sprite data. The problems that I'm having is, opening files(.ppf files stands for Prizm Picture Files, I already have saving working okay), rotating image(I couldn't figure out how, I asked in my topic, but no one helped), resizing properly(resize it so the new image doesn't look corrupted and just adds white pixels in those places), displaying the hex of the color in the color picker(it is only displaying the #?), scaling gets corrupted after the displayed pic gets over 115(or something like that) pixels high or wide, and I think that's it unless I forgot.

Here is the opening code(if you can help, it segfaults the calc at the end of the progress bar):
Code: [Select]
void openFile(char *PATH, color_t *data, int width, int height){
    char databuf[5];
    unsigned short buffer[sizeof(PATH)*2];
    Bfile_StrToName_ncpy(buffer, (unsigned char*)PATH, strlen(PATH)+1);
    int hFile = Bfile_OpenFile_OS(buffer, 0);
    for(int i = 0; i < height; i++){
        for(int j = 0; j < width; j++){
            ProgressBar((i*width)+j, width*height);
            Bfile_ReadFile_OS(hFile, databuf, 5, ((i*width+j)+2)*5);
            data[(i*width+j)] = strtol(databuf, NULL, 10);
        }
    }
    Bfile_CloseFile_OS(hFile);
    return;
}

I don't have any code for rotating(90 degree increments), but if you could help, it would be nice.

Here is my resizing code, so if you could help make the output less corrupted:
Code: [Select]
void resizeImage(color_t *image, int w1, int h1, int w2, int h2){
    int w, h;
    color_t* holder = image;
    color_t* temp = (color_t*)malloc(((w1*h1)*2)*sizeof(color_t));
    temp = (color_t*)realloc(temp, ((w2*h2)*2)*sizeof(color_t));
    if ( temp != NULL ){
        image = temp;
    } else {
        free(temp);
        return;
    }
    if(w1 < w2){
        w = w1;
    } else {
        w = w2;
    }
    if(h1 < h2){
        h = h1;
    } else {
        h = h2;
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            image[(i*w)+j] = holder[(i*w)+j];
        }
    }
}

Here is the code for changing the RGB values to Hex(based off of my TI-BASIC program):
Code: [Select]
char* RGBtoHex(int r, int g, int b, char buffer[7]){
    char val[16] = "0123456789ABCDEF";
    float a = (r/16);
    float c = (g/16);
    float d = (b/16);
    int e = floor(a);
    int f = floor(c);
    int h = floor(d);
    if(e > a)
        e--;
    if(f > d)
        f--;
    if(h > c)
        h--;
    a = a - e;
    c = c - h;
    d = d - f;
    a = a * 16;
    c = c * 16;
    d = d * 16;
    buffer[0] = '#';
    buffer[1] = val[e];
    buffer[2] = val[(int)a];
    buffer[3] = val[f];
    buffer[4] = val[(int)d];
    buffer[5] = val[h];
    buffer[6] = val[(int)c];
    return buffer;
}

And, finally here is my nearest-neighbor scaling routine:
Code: [Select]
color_t* Scale(color_t *temp, const color_t* data,int w1,int h1,int w2,int h2) {
    if((w2 <= 0) || (h2 <= 0)){
        return 0;
    } else {
        color_t* milk = (color_t*)realloc(temp, (w2*h2*2)*sizeof(color_t));
        temp = milk;
        int x_ratio = ((w1<<16)/w2)+1;
        int y_ratio = ((h1<<16)/h2)+1;
        int x2, y2;
        for(int i=0;i<h2;i++) {
            for(int j=0;j<w2;j++) {
                x2 = ((j*x_ratio)>>16);
                y2 = ((i*y_ratio)>>16);
                temp[(i*w2)+j] = data[(y2*w1)+x2];
            }
        }
    }
    return temp;
}

I really hope you can help with this. This is pretty much the farthest I've ever made on a Prizm C program from pretty much scratch.

Also, if you help, you get some credit(I'll make an About on the program that lists people who help).

Here's what I have right now:
-Rectangle
-Circle(not ellipses)
-Line
-Dropper
-Fill
-Color Picker with RGB editing(and hopefully hex code editing, but I need to get the hex displaying fixed first) and some preset colors(the same ones from Paint on Windows)
-Resizing(glitchy)
-Zooming/Scaling(glitchy, needs to be fixed; code is in first post)
-Saving(hopefully editing soon if I can get it to work; code is also in first post)

Planning for eventually:
-Eraser
-Select Tool with Copy, Paste, Crop, etc.

I'll take any suggestions if you have any.

197
Humour and Jokes / Re: Weird/funny pictures thread
« on: April 30, 2013, 07:24:37 pm »
I just saw this on Tumblr:


It's so creepy, but so funny at the same time! XD

198
TI-Nspire / Re: Nspire Movie Player - alternative to nPlayer
« on: April 29, 2013, 11:54:50 pm »
I was bored so I put asdfmovie5 on my calc. Tis a lot faster than the gif shows.

199
Calculator C / Re: [Ndless] Program Won't Run
« on: April 29, 2013, 05:26:45 pm »
This is normal I guess. Look at the console in nspire_emu, it should complain about something like "unsupported blf loader".
This is a bug in the MakeFile generation using the not-ready-yet blf loader. You should try to copy a Makefile generated before this version of the SDK that does not use blf loader.
I do not know why ExtendeD released this version of the trunk with this bug since I already noticed him.
Or, if the trunk has been fixed (I did not looked it in details yet), then sorry for my doubts, and you should update your Ndless on the calc.
But anyway, AFAIK, the trunk has not updated the blf loader (if it was, it has to appear in news since it did not.. ! )

Thank you! It works now!

200
Calculator C / Re: [Ndless] Program Won't Run
« on: April 29, 2013, 04:06:48 pm »
did you compile it or just send the program that comes with the sdk? I had problems with the sdk, too.

I compiled it, and then I sent the tns to my Nspire and it gave me the error message. Any ideas?

201
Calculator C / Re: [Ndless] Program Won't Run
« on: April 29, 2013, 01:44:29 am »
These messages are the symptom of Ndless not being installed, hence TheNlightenedOne's question.

I'm pretty sure it is because other Ndless programs are running. Also, I tried to reinstall it to see if it would work then too, but it didn't work.

202
We need to keep OmniRPG going guys! Don't want it to go dead, do we?

203
Calculator C / Re: [Ndless] Program Won't Run
« on: April 28, 2013, 07:20:21 pm »
Is Ndless installed on your calc?

Yes. As far as I know it is.

204
Calculator C / [Ndless] Program Won't Run
« on: April 28, 2013, 05:20:32 pm »
I send the hello world program from here, and it keeps popping up, "This document format is not supported. Test.tns"

Can anyone help? I'm using the SDK version beta-r765.

205
Casio PRIZM / [Prizm C] Zombie Chase
« on: April 27, 2013, 10:35:55 pm »
Crosspost:

I made a little zombie game today. I was bored. If you gave any suggestions or comments, it will be appreciated.
Here is the download: http://www.cemetech.net/programs/index.php?mode=file&id=891





In this game you are white square and you have to run away from the green squares(zombies). Health bar is at the top. You collect the red squares to gain health. It's a fairly simple game. Good luck.

206
TI-Nspire / Re: TI-Nspire emulator
« on: April 27, 2013, 02:20:03 am »
Which version of Ndless, on which OS version ?

OS 3.1 and Ndless 3.1.

207
TI-Nspire / Re: TI-Nspire emulator
« on: April 26, 2013, 10:05:58 pm »
I can't get Ndless to set up on on this. Can someone help me?

208
TI-Nspire / Re: z80 emulator for Nspire
« on: April 25, 2013, 04:11:42 pm »
I got an Nspire the other day, so I got this program. The only problem I have is that it freezes whenever I try to open the program more than once. I have to delete the save file and reset the calc to use it again. Is this supposed to happen?

209
Casio Calculators / Re: [LuaZM] pFighter
« on: April 21, 2013, 09:29:38 pm »
As for the global variables, I don't think I'll change those(I don't really know how, plus I'd probably end up screwing it up :P).

When you declare the variables, just tag local on them. Like this:

Code: [Select]
local var = blah
local var2

What difference will it make?

Well, for one thing, it will make running the program twice in a row not give Error: Not enough memory. ;)

Plus it could increase speed.

Would I do this with all the variables(ALL)?

Also, now more colorful:



Same download link as in first post.

210
Casio Calculators / Re: [LuaZM] pFighter
« on: April 21, 2013, 07:19:54 pm »
As for the global variables, I don't think I'll change those(I don't really know how, plus I'd probably end up screwing it up :P).

When you declare the variables, just tag local on them. Like this:

Code: [Select]
local var = blah
local var2

What difference will it make?

Pages: 1 ... 12 13 [14] 15 16 ... 39