• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Android making windows tabs

S

SuperAzrai

Guest
i need help with makeing windows tabs
i have a store room where you can buy items now i want to have tabs like 1tabe for swords 2 for armor and so on any idea
 

Yal

šŸ§ *penguin noises*
GMC Elder
You can use different layers and then turn them on / off using layer_set_visible. Also make the shop objects ignore interactions if their layer is invisible.
 

Gamebot

Member
You will have to change mouse_x and mouse_y to the device functions. Here is the basic idea:

CREATE:
GML:
tabs = ["Armor", "Potions", "Junk", "More junk"];
over = false;
sel = -1;
GLOBAL MOUSE LEFT PRESS:
GML:
if ( !over ) {
 sel = -1;
}

else{

/*
You would probably want a switch statement here...
To keep things simple for now the debug show_message in the output window.
*/
    
show_debug_message("You clicked on " + tabs[sel]);
}
DRAW:
GML:
var xx = x;
var pad = 24;
var col = c_white;

draw_set_font(fnt_txt);

for (i = 0; i < array_length(tabs); i++) {
 
 var entry = tabs[i];
 var wid = string_width(entry);
 var hei = string_height(entry);
 
 if ( point_in_rectangle(mouse_x, mouse_y, xx, y, xx + wid, y + hei)) {
  col = c_orange;
  over = true;
  sel = i;
 }
  else {
  col = c_white;
  }
 
 draw_text(xx, y, entry);
 xx += wid;
 xx += pad;
 
}

// DEBUG //
draw_set_color(c_fuchsia)
draw_text(x, y + 64, string(sel));


The other option is to have a controller set up all tabs where each tab is a different instance in which you can then hold or load a list, 2d array, grid, map...of all information for each tab. If you want to draw rectangles for each tab you can draw them in the point_in_rectangle ( over color ) and the else ( Normal color ). If you do that you will have to use draw_set_color right before your text.
 
Top