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.


Topics - ByteByter

Pages: [1]
1
Off Topic / MultiDimensional Madness!!
« on: 2011-Dec-16 »
So apparently in java you can resize an inner array of a 2 dimensional array. :rant:
Code: GLBasic [Select]
public class Test {
            public static void main(String[] args){
                int [][] a=new int [4][5]; //Creating the initial array of 4x5
                a[0]=new int[6]; //Resizing an array inside of the 2d array
                System.out.println(a[0].length); //This will print 6.
                System.out.println(a[1].length); //This will print 5
                System.out.println(a.length); //This will print 4
            }
}
 

Which I had no clue was even possible and thus, I ended up losing some points on my final in a cs class. :'(
So the question is can you do this in Glbasic? Or for that matter c/c++?

2
Off Topic / finding Derivatives.
« on: 2011-Oct-27 »
Does anybody know a way of doing this with a non simplified string expression?
 For example the string "((x+5)*(x+5))" would simplify to "x^2+10x+25" which would derive to "2X+10"
I'm doing this in Java, which is why it is the off topic forum. However any code glbasic or otherwise, that works, is acceptable to me.

3
GLBasic - en / Functions...?
« on: 2011-Aug-11 »
Code: GLBasic [Select]
Global B;B=10

AddOne(B)
Print B,0,0
Showscreen
Mouswait

Function AddOne:A
A=A+1
endfunction
 

Returns 10, has GLB always been like this? Because In most languages this would modify the variable that was input into the function, changing it's value to 11, and I could have sworn GLB was not like this before.

Using GLB V10.054 Beta.

4
Beta Tests / Another Comic Viewer for Wiz
« on: 2011-Jan-26 »
Here's a free somewhat complete comic viewer I programmed for the wiz.
Currently only supports Png (Sorry It's due to hardcoding the png extension in.)
Features Include:
-Comic Loading from Directory.(See Readme...or just look into comic dir. It's pretty self explanitory)
-Touchscreen Scrolling(Currently Non Adjustable)
-Goto Page Screen([Menu] Hardcoded...Yeah I know sloppy.)
-Fast Page-Change (Hold Down L/R for >1 sec)
-Adjustable Scroll Lengths(A/Y to +/-)
-Locked Scroll Mode([Select] Sucks right now though.)
-See Readme

Other keys are as follows
+/- (Pushed Together) Exit Application

Included is a free comic (Partial) and the source code. (FYI Yes I know the keypress handling looks very sloppy. However it works great so, so what.)
Anyways enjoy. If you can find any bugs aside from the locked scrollmode completely sucking then don't hesitate to say something. :good:

[attachment deleted by admin]

5
GLBasic - en / Mem2Sprite Speed.
« on: 2010-Nov-22 »
So why is Mem2Sprite slower than the function setpixel?
I would think that changing the values while in an array and then copying the array to the output buffer(I'm assuming this is how mem2sprite works...kind of similar to the win api function setdibits) would be faster then setpixel.(not sure what method setpixel uses...just in every basic language I have ever used setpixel is almost always the slowest method of graphics output I know.)
Code: GLBasic [Select]
GLOBAL Rnum#
DIM sprArray%[640*480]
//SetPixel Method
Regen:
IF KEY(16) THEN END

        FOR I=0 TO (640*480)-1
                Rnum#=RND(100)
                IF Rnum#=2 THEN SETPIXEL RND(640),RND(480),RGB(255,255,255)
        NEXT
PRINT "SetPixel Method",0,0
SHOWSCREEN
IF KEY(30) THEN GOTO RegenB
GOTO Regen
//Mem2Sprite Method
RegenB:
REDIM sprArray%[640*480]
IF KEY(16) THEN END
   FOR I=0 TO (640*480)-1
      Rnum#=RND(100)
      IF Rnum#=2 THEN sprArray%[I]=INTEGER(0xffffffff)
      NEXT
MEM2SPRITE(sprArray%[],0,640,480)
DRAWSPRITE 0,0,0
PRINT "Mem2Sprite Method",0,0
SHOWSCREEN
REDIM sprArray%[0] //fastest way to reset everything back to 0
IF KEY(30) THEN GOTO Regen
GOTO RegenB
 

...although it's not much faster it is quiet obvious even without writing an fps counter setpixel pulls off a few more fps.

6
Code:
file$=filerequest$(True,"Pictures|*.bmp;*.jpg;*.png")
print file$,0,0
showscreen
mousewait

That is the code I was using to test filerequest$ function.
Produces a blank white screen, presumably due to a winapi call failure.
print function by itself works fine, but if I use the filerequest$ function then I can't get anything to print on screen afterwards.
kind of sad about this as I am trying to code a little app to make sprite descriptor files... oh well for now all just write them by hand.
Any insight would be appreciated, thanks in advance.

Pages: [1]