Menu

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.

Show posts Menu

Messages - ByteByter

#1
Quote...and it's slow as molasses running uphill compared to other languages.
Hey, it's much better than it used to be. I would describe it now more as a soapy water concoction, great for cleaning but hard to swallow.
#2
Quote
Code (glbasic) Select

LOCAL a[]
DIM a[4][5]
...
REDIM a[7][7]

Like this?


Not exactly, I was referring more to staggered arrays, and was just curious to know if they were possible in glb. (In no way is this a request, as I really have no use for a staggered array, and love glb just the way it is :) .)

Quote from: Ruidesco on 2011-Dec-16
Yes, in Java you don't have real multidimensional arrays. What you do to simulate them is creating an array in which every position contains another array, and thus you can refer to them the same way you do with 2d arrays in GLBasic or C. Since they are independent from each other, every sub-array can have a different length.

As far as I know you can't have an "array of arrays" in GLBasic.

Yeah, I found this out after putting down the wrong answer on my CS final. F!@#$#n' java, oh how I hate your modern age approach to arrays.  :rant:
...JK, I don't really hate java that much, I actually love it in a love/hate sort of way, after all, how can I stay mad at it when it allows for things such as inheritance. :doubt:
#3
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++?
#4
Works for me...sorry  :(
FYI I'm using the latest version 10.159.

[attachment deleted by admin]
#5
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.
#6
Quote from: aroldo on 2011-Sep-29
   IF (st)
Here is your problem. This should be:
Code (glbasic) Select

if (st=true)

Otherwise, there is no boolean evaluation, and therefore the if statement will never be executed.
#7
Quote from: Minion on 2011-Aug-11
If you use the BYREF command, then you can alter the value, otherwise all you are throwing into the function is a copy
Thanks, I feel stupid, I've been doing this for a while now, and hadn't noticed anything? Well, at least this explains a few errors I've been having with my program
#8
GLBasic - en / Functions...?
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.
#9
Quote from: Serpent on 2011-Jul-17
Extracting one of the updater's backups seems to work for reverting as well (see the program files folder).
Thanks, this is more of what I was looking for, as I knew Glbasic copied a backup somewhere, I just didn't know where. Thanks :)
#10
Quote from: Serpent on 2011-Jul-16
Changing that line:
Code (glbasic) Select
int keyboardPresent = (getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS) ? 1:0;
to this
Code (glbasic) Select
int keyboardPresent = (getResources().getConfiguration().keyboard != android.content.res.Configuration.KEYBOARD_NOKEYS) ? 1:0;
works compiles (edit: ok haven't run it)...
(http://developer.android.com/reference/android/content/res/Configuration.html#KEYBOARD_NOKEYS)

BTW does GLB compile the app twice?
This does indeed fix the compiling issue, however the app crashes prior to even executing one line of user code. :(
Also, at least with me, there is no longer an icon for the App once installed...either that or it's a completely transparent Icon  ::)
Quote from: Serpent on 2011-Jul-16
That seems right.  Could have sworn I used to see two "BUILDSCRIPT"s in the output...
Anyway it seems Android apps (even Hello World) won't run with 10.051.  It compiles (with the slight addition to SDLActivity.java), installs, and force closes when the app is opening.
Indeed I can confirm this, the app crashes while loading.
...Does anyone know if you can roll back to say 10.004 or whatever the last beta was easily?
#11
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]
#12
Yes It is indeed much faster at redrawing the entire surface using mem2sprite.
average of 125/1000th(8 fps) of a second in between calls at a resolution of  1024x512. :good:
Where as SetPixel was 6.7 seconds(.14 fps) on average to redraw the entire surface.
...My bad. :(

#13
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.
#14
Nope, not in fullscreen.
#15
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.